Hi,
I want to make an API call to AD manager+.
When I set up my API call and test it, the URL is built successfully and I get a positive Response.This is my API call:
Post:https://*****/RestAPI/AddUsersToGroup?PRODUCT_NAME=SDP%20AddOn%20Check&domainName=**.local&inputFormat=[%7b%22sAMAccountName%22:%22UserName%22%7d]&addGroup=[%22GroupName%22]&AuthToken=****
However, when I want to use the API in my module I always get an error.In the error log I see that he is translating : in to %3a.
I have tried converting it in every way I could think of but the error persists.
POST:https://***/RestAPI/AddUsersToGroup?PRODUCT_NAME=SDP+AddOn+Check&domainName=**.local&inputFormat={"sAMAccountName"%3a"UserName"}&addGroup=GroupName&AuthToken=***
Also I tried adding the parameters in the body, but AD manager+ won't allow it.
I also checked my devtools in chrome. The parameters that are being send are correct.
Do any of you have any tips on how to resolve this?I've been trying for 2 days now and I'm at the end of my with.
Dear Sarah VensinputFormat and addGroup should be arrays of JSON objects, like [{ },]. So, please add the array object [ ].
eg :https://***/RestAPI/AddUsersToGroup?PRODUCT_NAME=SDP+AddOn+Check&domainName=**.local&inputFormat=[{"sAMAccountName"%3a"UserName"}]&addGroup=[GroupName]&AuthToken=***
In my original request the [ ] is added, seems like it's getting rid of it to when I use the API cal in my program
I changed my Inputparameter and groupname like this:
%5b{"sAMAccountName"%3a"accountname"}%5d
%5b"ACM_CLM2__Women"%5d
Then it worked!
thx!
can you provide more details like screenshot of error log and how you are consuming the rest api ?
This is how i set up the API.
here is where I consume it:
at this point, this is the SAMAccountName and Group name
This is the error:
have you tried OnBeforeRequest to replace %3a from the query string?
I have tried to use the "on before request" on several occasions, but I never seem to get it to work. It always says that my request parameter is:
"object reference not set to an instance of an object"
Hello Sarah,
It is URL encoding the colon; %3a in a URL value is the same as a colon. Though, it is unusual to be passing JSON in a URL query parameter. Normally you would pass it in the body. However, I am not across the API you are calling.
Have a look at the HTML URL Encoding Reference and URL Encode and Decode - Online to see how URLs are encoded.
I hope this helps.
Kind regards,
Stuart