Call Options Header

Specifies options for the client you’re using to access REST API resources. For example, you can provide a default namespace prefix so that you don’t need to specify the prefix in your code.

The Call Options header can be used with sObject Basic Information, sObject Rows, sObject Rows by External ID, Query, QueryAll, and Search. It is also supported in Bulk API and Bulk API 2.0.

Header Field Name and Values

Field name
Sforce-Call-Options
Field values
  • client—A string used as an identifier for the client sending the request. This string appears in log files, helping you keep track of which client sent a request.
  • defaultNamespace—A developer namespace prefix used as the default namespace for the request. With this header field, the request resolves field names in managed packages without specified namespaces. (Not supported in Bulk API.)

Example

If the developer namespace prefix is battle, and you have a custom field called botId in a package, set the default namespace with the call options header:
Sforce-Call-Options: client=caseSensitiveToken; defaultNamespace=battle
Then queries such as the following succeed:
/services/data/vXX.X/query/?q=SELECT+Id+botID__c+FROM+Account

In this case, the actual field queried is the battle__botId__c field.

Using this header allows you to write client code without having to specify the namespace prefix. In the previous example, without the header you must write battle__botId__c.

If this field is set, and the query also specifies the namespace, the response doesn’t include the prefix. For example, if you set this header to battle, and issue a query like SELECT+Id+battle__botID__c+FROM+Account, the response uses a botId__c element, not a battle_botId__c element.

The defaultNamespace field is ignored when retrieving describe information, which avoids ambiguity between namespace prefixes and customer fields of the same name.