Alteryx Server Discussions

Find answers, ask questions, and share expertise about Alteryx Server.
SOLVED

Error trying to link user to group via API

markashman
8 - Asteroid

Been working with the V3 API tools and managed to create collections, groups, link those two together and create users. Now I want to link users to the groups and the yet when I try to post I get:

 

Warning: Add users to groups 7: The request to https://xxxx/webapi/v3/usergroups/64a836f9ca4fc633d7a3882c/users failed with an HTTP 400 Bad Request
error. Error message: The request is invalid. Input string '64aaa81b58097b958148c726' is not a valid number. Path '', line 1, position 24. Required. Record ID: 1

 

I have tried both singular userIds and an array and both return the same error.

 

Not entirely sure what the message is saying, as the path type is the ID of the group, which I have checked and is correct and is the one ending 3882c. The input string it quotes is the first userId (also correct) in an array and according to swagger is body type, not path type, so the Path '' bit is confusing.

 

Any help appreciated.

1 REPLY 1
markashman
8 - Asteroid

I have figured this out, as whilst you can pass a singular id into userIds the macro sees it as a string, not an array, hence the error. Furthermore, if you use a summarize tool to create a concatenated string, essentially the array this is passed as "string1, string2", but it needs to be "string1","string2" & then encased in outer [] to make an array. I have used a formula tool to prep the data for the macro and it now works fine.