Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

Waiting for Web API commands with side-effects to complete

Waiting for Web API commands with side-effects to complete

Hi,

 

using the Web API, I noticed that requests to commands with side effects end earlier than the related changes appear. For example, if we call the endpoint Get the User's Queue immediately after Add Item to Playback Queue, we'll sometimes get the state of the queue, in which our item is not yet present.

 

Consequently, to get the contents of the queue after the addition has fully processed, I have to poll in a loop (with possible backoffs), calling /me/player/queue  until my element's uri comes up in the output (which is of course an arbitrary heuristic).

 

It seems that many endpoints exhibit this "non-blocking" behavior, returning a 2XX status code as soon as the action has been accepted for execution, for example:

Such an API design is understandable as it increases API responsiveness and significantly reduces server load. However, it requires additional calls to the API to keep the application in sync with the player.

 

My question is: do I understand the behavior of the API correctly and do my ways of dealing with the described problems seem reasonable? Have you ever encountered similar issues yourself?

 

Thanks in advance!

Piotr

Reply
0 Replies

Suggested posts