Page 1 of 1

Rest API call not seeming to function

Posted: Tue May 16, 2017 3:12 pm
by thomas.carroll
Team I am attempting to use my Rest api when i make the call i am not seeing any returns. I am using my itmgrs credentials, and the initial ivr script. you can test with 3476585 as a file number.

Re: Rest API call not seeming to function

Posted: Wed May 17, 2017 10:45 am
by support
Hello,

We looked at your call log and there is definitely data coming back from your web service (you can see it by looking at the log and clicking the + symbol next to "17 May 2017 09:14:51 AM -0600: SRI_Rest, [rest] - Success"). This will give you full debug details about what was sent and returned by your REST API. Inside of the return value you can see that it is an array of objects being returned. Therefore your data should be accessed as an array then an object. For example:

SRI_Rest[0].first_name

Your current prompt references "SRI_Rest.first_name" which is throwing an error because SRI_Rest is not an object it is an array.

Re: Rest API call not seeming to function

Posted: Wed May 17, 2017 11:27 am
by thomas.carroll
I have attempted to call the return data as you suggested. can you please exam what i have implemented and see why I am not receiving the expected returns.

Re: Rest API call not seeming to function

Posted: Thu May 18, 2017 9:11 am
by thomas.carroll
I was able to pull the Information from the return.

can you please look at my comparison on the menu page of the PmtAmt and the SRI_Rest.Balance for some reason the comparison is not returning what it should.

Re: Rest API call not seeming to function

Posted: Fri May 19, 2017 11:08 am
by support
Hello,

The issue you are experiencing is caused by the fact that both of the values you are comparing are strings. In Javascript string comparisons are considered on a character by character basis. For example, both of the following statements are true:

Code: Select all

"2" > "1"
"2" > "100"
The solution for this is to use the "parseInt()" function to cast the variables to integers before you perform the comparison. For example https://drive.google.com/open?id=0B2RqW ... XRmNy1HMnM. This will allow the comparison to work as expected by comparing the values as integers rather than strings. Let us know if you run into any other issues.

Regards,
Plum Support