Discussions

Ask a Question
ANSWERED

Can we get a simple pure C# example of Adding the RequestVerificationToken to headers for GET

(I couldn't resist modeling on Jack's post.) I'm writing a WebApi which will live outside iMIS, so I'm trying to obtain a token and then send it with a request. No matter what I do, I still get 401 Unauthorized when trying a GET. First, I created a new Contact "Remote Service" which is a member of the RemoteService role. (I have tried it as public/casual/full -- none seem to make a difference.) Then I call the /Token endpoint like this. [code] var client = new RestClient($"{_baseUri}Token"); var request = new RestRequest(Method.POST); request.AddParameter("undefined", $"grant_type=password&username={_imisLogin}&password={_imisPassword}", ParameterType.RequestBody); [/code] I get a valid response that contains a valid (looking) access_token. I use it like this: [code] var client = new RestClient(_baseUri); var request = new RestRequest(Method.GET); request.AddHeader("RequestVerificationToken", token); request.Resource = $"api/user?UserName=Equal:{username}"; IRestResponse<ImisTypes.UserData> response = client.Execute<ImisTypes.UserData>(request); if (response.StatusCode == HttpStatusCode.Unauthorized) { // FAIL } [/code] Even though all operations require the RequestVerificationToken, none of them show how to include it.
ANSWERED

Correct dataType but not able to use certain operations ?

For instance, Why would I not be able to perform the following API call ? https://class.imiscloud.com/ASI.Scheduler_IMISClass/api/Country?CountryCode=notContain:A When I can perfectly call: https://class.imiscloud.com/ASI.Scheduler_IMISClass/api/Country?CountryCode=contains:A I know sometimes certain operations won't work for certain dataTypes, but in this case ???
ANSWERED

REST postman Collections for Import

Does anyone know the place from where we can import Postman Collections? I saw at innovations that ASI shares a location from which we can Import Collections... If you know please let me know...