Answered
The DLAP API docs for issuing batch commands doesn't seem to state explicitly where to place the _token if I already have an authenticated session token, and the example doesn't show the token at all. Do I stick a _token attribute on the <batch> element, or do I have to repeat it in each of the <request>s? Or do you recommend including it as part of the URL query string, out of the POST body?
An example would be nice. (JSON preferred. :) Thanks!
Comments (8)
Oh, and is there an upper bound on how many requests can be stuck into a single batch command? I have a couple situations where I look up over 1000 users and courses at a time. Can I pack thousands into one batch request, or do I need to bundle them in sub-groups?
You would pass it as the "query-string" parameter.
For example:
Query-String
Post Data
You don't have to bundle them, but I personally do so that I know there is progress occurring. Otherwise, the request could take a long time.
But I normally do this in 1-2,000 chunks.
Getting items is one thing but updating them is another. If I try to update more than ~1000 items (~500 during the day) I'll get a "504 Gateway Timeout". Merge courses is the really frustrating one. If I have a ton of changes to merge I can't get one to finish without calling it multiple times. This is why I've never used the batch function, I'll just call each individual command. No need to add the additional layer of complexity. I wish you could submit things as jobs, like inferroles.
A json example would help me. The docs indicate such a thing is possible, but nothing I've tried has worked.
Howdy, Luke!
Example JSON example for a batch request:
That helps, but I'm still inches from the goal. Maybe I'm misunderstanding something. Here's my javascript ala jquery:
What got from the above before I JSON.stringified it is:
I think there's an unnecessary "/" in between the URL & your query parameters.
Try: https://gls.agilix.com/cmd?_format=json&_token=...
Not: https://gls.agilix.com/cmd/?_format=json&_token=...
That's the form that's working for me.