How do I set DML Options when using the REST API?

Have you tried using the SForce-Auto-Assign Assignment Rule Header?

The Assignment Rule header is a request header applied when creating or updating Cases or Leads. If enabled, the active assignment rules are used. If disabled, the active assignment rules are not applied. If a valid AssignmentRule ID is provided, the AssignmentRule is applied. If the header is not provided with a request, REST API defaults to using the active assignment rules.

There doesn't appear to be an equavalent emailHeader. So this probably won't be sufficient.


Another possible work around - You could use Apex to implement your own REST API that already includes the required DMLOptions.

E.g.

@RestResource(urlMapping='/Case/*')
global with sharing class CaseRestResource {


  @HttpPost
    global static String doPost(String subject) {
        Case newCase = new Case();

        newCase.Subject = subject;
        // Set AccountID, etc...

        Database.DMLOptions dmo = new Database.DMLOptions();
        dmo.emailHeader.triggerUserEmail = true;
        dmo.assignmentRuleHeader.useDefaultRule = true;
        newCase.setOptions(dmo);

        insert newCase;
        return newCase.Id;
    }
}