REST API Examples
Use REST API to create, update, or delete a record with Custom Address Fields data.
Before you create a custom address field, review the Custom Address Fields Requirements and Limitations. To discuss the feature and ask questions, join the Custom Address Fields Discussion group on the Trailblazer Community.
To create a new record, use the sObject resource. You supply the required field values in the request data, and send the request using the POST HTTP method. The response body contains the ID of the new record if the call is successful.
This example creates an Account record which includes address data stored in the Mailing Address custom address field.
Example HTTP POST method to create a new Account
Example request body newaccount.json file to create a new Account
Example response body after successfully creating a new Account
To update a record, use the sObject Rows resource. Provide the updated record information in your request data and use the PATCH method of the resource with a specific record ID to update that record. Records in a single file must be of the same object type.
This example updates the data stored in the Mailing Address custom address field for record ID 001XXXXXXXXXXXXXXX.
HTTP PATCH example for updating an Account
Example request body patchaccount.json file for updating the custom field, Mailing Address, on an Account
Example response body after successfully updating an Account: None returned
To delete address data stored within a custom address field on a record, update the record with the sObject Rows resource. Provide the updated record information in your request data and use the PATCH method of the resource with a specific record ID to update that record. Records in a single file must be of the same object type.
This example deletes the data stored in the Mailing Address custom address field for record ID 001XXXXXXXXXXXXXXX.
HTTP PATCH example for updating an Account
Example request body patchaccount.json file for updating the custom field, Mailing Address, on an Account
Example response body after successfully updating an Account: None returned
To delete records, use the sObject Rows resource. Specify the record ID and use the DELETE method of the resource to delete a record. When a record is deleted, all data for that record is deleted, including the custom address field information.
This example deletes the Account record with ID 001XXXXXXXXXXXXXXX.
HTTP DELETE example for updating an Account
Example request body: None needed
Example response body after successfully updating an Account: 200 OK