Problem on API call?

22 views
Skip to first unread message

Hien Do

unread,
Mar 7, 2021, 11:02:14 PM3/7/21
to Accelo Developers
Hello Team,

Today we experienced a problem while calling the API and I see that the cause is some extra elements have been added in the root of the response message when I turned to the next page of the GET.

Here is example, when I get the milestones from the page 0, the response message is started with "response" which it's OK, but from the page 2 (see the screenshot down below) the response message is started with "meta" 


Could you please assist me in resolving this issue?

image.png


image (1).png

Ella Hansen

unread,
Mar 8, 2021, 2:20:48 PM3/8/21
to accel...@googlegroups.com
Hi Hien!

Did you check the full response? I've noticed that the JSON elements are not sorted in the response, so it's possible that the "meta"; {"message":... element was present in the first response as well but just happened to be after the "response": {... element in the JSON payload.

Ella Hansen // they, them, theirs

Schedule a meeting:

remote desktop session

video call
onsite visit

Tech support:

415.854.0881
sup...@ignitionit.com
Luvvv us? Yelp us! ❤️



On Sun, Mar 7, 2021 at 8:02 PM Hien Do <hi...@prentow.com> wrote:
Warning: This is the first time you've received a message from hi...@prentow.com. Make sure you trust this sender.

--
You received this message because you are subscribed to the Google Groups "Accelo Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to accelo-devs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/accelo-devs/bca15b15-bd0a-4232-ad56-e0b51b83b910n%40googlegroups.com.

Joshua (Windos) King

unread,
Mar 8, 2021, 3:54:02 PM3/8/21
to accel...@googlegroups.com
This is exactly the case, all responses (that I'm aware of) have meta and response elements but they aren't ordered so you cannot rely on the order, instead you need to dive into the desired element by name.

In PowerShell that looks a little like:

$ContactResponse = Invoke-RestMethod -Uri ($Uri -f $Page) -Method Get -Headers $Headers
ContactResponse.Response


Reply all
Reply to author
Forward
0 new messages