I know that in-platform automations are the way to go, but sometimes we need to think outside the box for some things we do. I happened upon the Batch Batching REST Endpoint and thought this might be one of the better ways to handle repeating work, but I've got a question or two. Forgive me for getting a little verbose.
As I was reading through the examples for Batching REST calls and I noticed one (possible) omission. The
doesn't seem to be able to be altered - in fact, it isn't even mentioned in the documentation. I'm assuming that means batching has to be done with the same RestMethod
RestMethod
. Is that correct?
Scenario: Let's say I have a user that's been created and is a member of the default (Registered Members) role, but I want to do a handful of things to that account:
- Retrieve the user details
- Add the member to an additional platform role.
- Invite them to a Private (Unlisted) group.
- Award them points.
Without batching, I'd run this as 4 different calls (in sequence):
- Get User REST Endpoint [
HttpMethod
: GET /RestMethod
: GET] - Create Role REST Endpoint [
HttpMethod
: POST /RestMethod
: GET] - Create User Invitation REST Endpoint [
HttpMethod
: POST /RestMethod
: GET] - Create Point Transaction REST Endpoint [
HttpMethod
: POST /RestMethod
: PUT]
Those steps would lead to something like this:
- Retrieve and store the user information:
/api.ashx/v2/user.json?username=PeanutB
- Add member to the role:
/api.ashx/v2/roles.json?RoleID=322&include=user&UserId=297551
- Create the user to group invitation:
/api.ashx/v2/invitations.json?GroupID=1122&GroupMembershipType=Member&Email=peanutb@domain.com&Message=We#39;d+love+for+you+to+join+our+private+group.
- Create the points award:
/api.ashx/v2/pointtransactions.json
Body:{ "ContentID": "ContentGuid", "ContentTypeId": "ContentTypeGuid", "Description": "You've been awarded a thing", "UserId": 297551, "Value": 1500 }
Since there are changes between the RestMethod
type, I'm confused if batching would even be possible.