Netflix API Developer Blog
New API Proposal: Bulk Queue Update
This is our first blog posting soliciting feedback on a future Netflix API. The post is also the first by Hans Granqvist, one of our API team developers. -Mike
A queue bulk operation makes it easier to perform queue managment. Currently one must make do with multiple API calls to adds, deletes, format changes, and moves. The set of calls can be tricky to get right, and each call also counts against your quota.
We're adding bulk operations to the API. Here are the two main types of APIs we're considering. Let us know which one you think works best and why!
QUEUE STATE
The bulk operation input is a representation of what the queue should look like. It ignores current queue state and replaces the queue. If a title contains multiple discs those discs will be added beginning at the index specfiied. The indices of other titles with are adjusted to make room for the additional titles.
Since this is a modification in place, is idempotent, and ignores previous state of the queue it uses the PUT method.
PUT /users/userID/queues/{disc|instant}
Parameters
title_ref[n] |
req. The catalog title to be in position [n] of the queue. |
format[n] |
opt. The format of the title in position [n]. Default format for queue used if not specified. |
Etag |
opt. ETag value returned last time queue was read. |
OAuth |
req. Consumer key + access token + signature |
Result
| 200 | Success |
| 400 (660) |
If given format is not available for the user in the queue |
| 304 |
If incoming queue representation is equal to current. |
| 412 |
Etag concurrency error |
| 500 |
Internal error. Partial replace of queue may have occurred. |
Possible variations include:
- Use XML/JSON to pass the queue params.
- Impose an order to the title references, so accepting a sequence of {title_ref,format} would be enough to represent the queue without the added positional marker.
- In addition, we could accept a subset of the queue with the same semantics as above, so that the subset given replaces corresponding subset in the queue, and queue items skipped will remain unchanged. This would mean that bulk deletes wouldn't be possible, since omitted queue items would be skipped vs. deleted.
SEQUENTIAL OPERATIONS
For this version, input is a list in terms of inserts, deletions, and modifications, intended to be executed in sequence.
Since this is a modification that is not idempotent (issuing the same request twice may change the queue twice) it uses the POST method.
The resource is the same as other proposal. There is a clash here with the existing POST operation on the queue, so care has to be taken to pass input params correctly.
POST /users/userID/queues/{disc|instant}
Input format
The input format to this proposal uses XML/JSON.
Parameters
inject_after Keyword takes a position + list of titles
deleted Keyword takes a list of titles
Template:
{
'inject_after' : [n, title foo, ..., title bar],
'delete' : [title baz}]
}
Example:
{
"delete" :
[
"http://www.netflix.com/Movie/The_Tale_of_Despereaux/70075482",
"http://www.netflix.com/Movie/Lakeview_Terrace/70098896"
],
"inject_after" : [1,
"http://www.netflix.com/Movie/Mac_and_Me/70000001"
]
}
Results
We anticipate being able to use the set of results codes that is used by existing API operations around queue updates.
To discuss: should multiple 'inject_after' and 'delete' arrays be supported? If so, then a second 'inject_after' with a positional argument will have dependencies on previous inserts (since they shift elements in the queue) -- which is very tricky to get right, especially when adding a TV seasons that results in multiple DVD adds.

7 Comments
Doron – 4 months ago
Would I be able to somehow bulk up gets? Say I have search results and I want to check their format availability - I'd rather have one call rather than doing 1 per search result item.
Hans Granqvist – 4 months ago
Quick note: Bulk search operations are easier to map since each search can be executed independently. Input could be a list of searches and returns a list of result. Maybe a different type of input fits this operation better?
eddiewebb – 2 months ago
is the Queue State bulk update available yet? this would be extremely helpful!
Hans Granqvist – 2 months ago
Eddie,
We have the code ready, but there are some holes in the OAuth spec how to secure non name/value data in requests.
Any other content, such as XML, is left outside the signature, and therefore susceptible to man-in-the-middle attacks.
There is a draft standard that addresses such signatures but it isn't standard yet.
http://oauth.googlecode.com/svn/spec/ext/body_hash/1.0/oauth-bodyhash.html
Here is some more background discussion on OAuth list:
http://groups.google.com/group/oauth/browse_thread/thread/42ef5fecc54a7e9a
We're figuring out the best way forward over the next few days. Please share your views!
Hans
eddiewebb – 2 months ago
DOes not Google use OAuth for their APIs? I know they allow bulk operations using atom, would be interesting to see how they protect against MiM attacks. Maybe I am wrong though.
Hans Granqvist – 2 months ago
Good thinking. Yep, they do, but they bundle it all up in non-REST batched XML via POST. Interesting.
See more:
http://code.google.com/apis/gdata/batch.html
eddiewebb – 7 days ago
Just following up on this proposal from a few months back..
My application, QueueMan, runs on Android phones, so connectivity and performance is a major issue. Having to make signed HTTP POSTS for each action as simple as shuffling Q order, and having to parse xml response is costly.
A bulk update would have a huge impact on usability and perceived 'snappiness'
Please escalate this task and keep us informed.
Please sign in to post a comment.