0

I need help figuring out my error. I am using Alteryx to POST to add a user to a permission group in SP2013. The components of how it's compiled are similar to this post: Add a user to SP group using REST API

URLToAddUser: https://team.global.abcd/sites/SiteName/_api/web/sitegroups(4321)/users

Headers:

Accept: application/json;odata=verbose

Content-Type: application/json;odata=verbose

X-RequestDigest: myauthenticationNumber

body/JSON: "{'__metadata':{'type':'SP.User'},'LoginName':'i:0#.w|abcd\12345678'}"

DownloadData Error

{"error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-US","value":"Invalid JSON. A token was not recognized in the JSON content."}}}

1 Answer 1

1

The valid body for this request is just the login name:

{'LoginName':'abcd\\12345678'}

unlike the list item actions you do not need to add the __metadata blurb...

4
  • Thank you for your reply. Unfortunately, that does not work for me: {'LoginName':'abcd\\12345678'} Same JSON error :-(
    – ChasEpes
    Commented Apr 6, 2023 at 18:44
  • Have you tried the same request using Postman? just to eliminate that Alteryx is doing something nasty? Also try the same request with a GET to verify that everything else is correct... It should return the members of the group. According to the error message "A token was not recognized", as if an invalid (or unescaped) character was in the body...
    – dinos.kon
    Commented Apr 7, 2023 at 7:32
  • Long weekend. Thanks for the suggestion. I'll try today.
    – ChasEpes
    Commented Apr 11, 2023 at 12:26
  • Still not working. My code sends this {'LoginName':'abcd\\12345678'} format but no luck. I'll keep trying
    – ChasEpes
    Commented Apr 17, 2023 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.