Delay time after POST or DELETE api calls

omrifakrash
New Contributor

Hello community.

When I create or delete something on my Jamf site through api call (for example, creating a new policy with  POST on "/JSSResource/policies/id/-1"), I am getting a successful response with code 200 and the newly created policy's id.
Then, I am trying to fetch all policies from my Jamf site (GET on "
/JSSResource/policies"), but the response does not contain the newly created policy. 

Should I wait for few seconds before I fetch my policies and check if the creation succeeded? (Since I am running a code that does it I need to know how much sleep time I should add). Are there a different solution than doing busy waiting?

All I wrote I experience for DELETE requests as well.

Thanks in advance 

3 REPLIES 3

talkingmoose
Moderator
Moderator

If you're using Jamf Cloud, it has multiple servers. You're likely changing one and the other hasn't synchronized yet. Usually takes a minute or less.

omrifakrash
New Contributor

@talkingmoose Thanks.
Is there a query I can do to know when the servers are synced? 
Is there a way to know if a set of API calls are going to be resolved on different server?

There's no way to tell other than to refresh the page.

It's usually less than a minute. You could build in a sleep command to wait, if it's becoming a problem for you.