in implementation guides ~ read.
Api Rest Industries

Api Rest Industries

DOWNLOAD

First things first !
To download this implementation guide, click the download button below.
If you need more information about the implementation guide, you can read the Table of Contents below.

Download

Industries REST API

Version Summer

salesforcedocs
Last updated June

Copyright salesforcecom inc All rights reserved Salesforce is a registered trademark of salesforcecom inc

as are other names and marks Other marks appearing herein may be trademarks of their respective owners

CONTENTS

Chapter Salesforce Industries REST API

Getting Started with REST API for Industries

Quick Start
Response Status Codes
Namespaces

Using the Industries REST API

Get Operation
Post Operation
Put Operation
Filter Results

CHAPTER

In this chapter

Getting Started with

REST API for

Industries

Using the Industries

REST API

Salesforce Industries REST API

The Salesforce Industries REST API gives you access to individuals in your org Use the POST GET and

PUT operations to create read and update your records

The API provides powerful and simple web services for interacting with Lightning Platform Its customized

for use with the Industries products such as Salesforce Health Cloud and Salesforce Financial Services
Cloud and gives you easy access to the special objects and features these products provide

To use the API requires basic familiarity with software development web services and the Salesforce

user interface For general information about the Salesforce REST API see the REST API Developers Guide

That guide explains the APIs characteristics and architecture and how to set up your development

environment It also includes information to get you started using the API and tools like cURL and

Workbench REST Explorer

Note This guide is for use with the individual data model It isnt intended for use with person
accounts

Salesforce Industries REST API

Getting Started with REST API for Industries

Getting Started with REST API for Industries

Run some sample REST requests in your development org to learn Industries REST API basics Trying out the examples now makes it

easier to build your applications later

Start with a development platform with authorization set up on it If you dont have a platform see the REST API Developers Guide for

information about creating one

Salesforce Industries REST API isnt part of the regular Lightning Platform REST API It has its own versioning scheme and makes more

use of namespaces
Quick Start

Review this short demonstration of how the Industries REST API works

Response Status Codes
Each response includes a status code indicating whether the request was successful or not
Namespaces

Check if your org has a namespace If it does include the namespace in every REST call you make Only Developer Edition orgs can

have namespaces If youre not using a DE org you dont have to use an org namespace in your REST requests

Quick Start

Review this short demonstration of how the Industries REST API works

A basic Industries REST API request has this format

servicesapexrestpackage namespacecurrent versionresource nameoptional parameters

The package namespace value is omitted for orgs that dont use a namespace If you dont know whether your org has a namespace
heres how to check

For example this GET request returns all individuals in the org

servicesapexrestorggsvindividual

Heres the response with three records returned with most values omitted for readability

statusCode
responseBody
nextRecordUrl null
individuals

BAXnplIAD

orggsbirthdatec None
Values omitted
isdeleted false

BAXncDIAT

orggsbirthdatec None
Values omitted
isdeleted false

BAXnQIAL

orggsbirthdatec None

Salesforce Industries REST API

Response Status Codes

Values omitted
isdeleted false

message Number of Individuals retrieved

You can retrieve up to records at once If there are more than records the nextRecordUrl value shows the limit used and
the offset to the next batch of records For example if this request had returned records and more records were available the next
record value would be nextRecordUrl vindividuallimitoffset

Response Status Codes
Each response includes a status code indicating whether the request was successful or not
Status Code

Description

Request completed successfully

Create Individual operation was successful

Read Individual operation was successful

Update Individual operation was successful

Create Individual operation failed

Read Individual operation failed

Update Individual operation failed

Read Individual operation is not yet complete

Namespaces

Check if your org has a namespace If it does include the namespace in every REST call you make Only Developer Edition orgs can have

namespaces If youre not using a DE org you dont have to use an org namespace in your REST requests

Enter Package in the Quick Find box or select Create Packages from Setup

Look at the Namespace Prefix value on the Packages page If the namespace is set use that name in your REST calls

Using the Industries REST API

The Industries REST API provides get post and put operations for working with Individual records plus filtering

Get Operation
Get information for one individual some individuals or all individuals in your org including all individuals with changes since a
specific date

Salesforce Industries REST API

Get Operation

Post Operation

Create individuals one at a time or in batches Use the POST method to create individuals in your org You can create more than one

individual at a time but its an allornone operation If an error occurs while creating any individuals record no individuals are
created
Put Operation
Make updates to individuals in your org one at a time or in groups
Filter Results

Filter the fields returned by a GET request so that you see only the values you want

Get Operation
Get information for one individual some individuals or all individuals in your org including all individuals with changes since a specific
date

The Industries REST API retrieves information from your org about

A specific individual

All individuals
Individuals with changes since a certain date

Retrieve One Individual

This request retrieves a specific individual identified by the individuals ID value

servicesapexrestvindividualindividualid

The individualid value is a string that uniquely identifies the individual The response body follows this format

statusCode
responseBody
nextRecordUrl null
individuals
individualidc
Values omitted

message Number of Individuals retrieved

The fields and values returned are omitted here to save space You can specify which fields to omit by using filtering

Retrieve All Individuals
This request returns all individuals in your org By default a maximum of individuals are returned at one time but you can lower the
number with the limit parameter If there are more than individuals you can page through the results retrieving all the individuals
in batches from different offsets The offset parameter specifies the end of the last batch retrieved For example to retrieve
individuals at a time
Request the first with an offset of

Salesforce Industries REST API

Get Operation

Request the second with an offset of
Request the third with an offset of
Continue until youve retrieved all records

The nextRecordUrl builds the next request for you Heres the REST code for this example

First the initial GET request Weve omitted the offset value because it would be zero for a first request

servicesapexrestvindividuallimit

And then the response

statusCode
responseBody
nextRecordUrl vindividuallimitoffset
individuals
Values omitted

message Number of Individuals retrieved

The status code tells us that the read operation isnt finished The next record URL tells us how to retrieve the next batch of records Our

next request is
servicesapexrestvindividuallimitoffset

Notice how we used the previous responses nextReordURL value in the new request The response is

statusCode
responseBody
nextRecordUrl vindividuallimitoffset
individuals
Values omitted

message Number of Individuals retrieved

According to the status code more records remain The next record URL value is almost the same as the previous value The only difference

is that the offset is now because weve read the first records If we have records total the next request gets the remainder
servicesapexrestvindividuallimitoffset

The response is

statusCode
responseBody
nextRecordUrl null
individuals
Values omitted

Salesforce Industries REST API

Post Operation

message Number of Individuals retrieved

The status code shows that the read is complete and the next record URL is not set because there are no more records The message

tells us that we retrieved individuals instead of the we expected

Retrieve Individuals with Changes

A common task is to get only those individuals with changes since a certain date For example you need all individuals that are new or

have changes since the last quarterly report You specify the date with the number of days to today from the past date For example
todays date is May and you want the records created or changed since January for all individuals Set duration to
the number of days from January to May You use the limit offset and nextRecordUrl parameters in the same
way as when retrieving multiple individuals

Lets get all the records created or modified in the last week Heres the GET request

servicesapexrestvindividualdurationlimitoffset

And the response

statusCode
responseBody
nextRecordUrl vindividualdurationlimitoffset
individuals
Values omitted

message Number of Individuals retrieved

We see from the status code that there are more records and the nextRecordUrl value has prepared our next request
servicesapexrestvindividualdurationlimitoffset

Heres the response

statusCode
responseBody
nextRecordUrl null
individuals
Values omitted

message Number of Individuals retrieved

This time we got records so we know that records were created or modified in the past week

Post Operation

Create individuals one at a time or in batches Use the POST method to create individuals in your org You can create more than one

individual at a time but its an allornone operation If an error occurs while creating any individuals record no individuals are created

Salesforce Industries REST API

Post Operation

Individuals are created using a map of field names and field values You include only the fields that must have values in your org Heres
an example that creates two individuals with minimal information using an org with the namespace clinic
servicesapexrestclinicvindividual

Heres the request body that defines the individuals to add lastname is required here because its required by the Salesforce Contact
object Contact is the parent object of an individual

individuals

firstname Robert
lastname Jones
Email RJgmailcom
SourceSystemIdc abc

firstname Virgil
lastname James
Email Jamesgmailcom
SourceSystemIdc xyz

The complete response contains all the individuals fields including the ones we didnt set The unset fields are omitted in this response
for brevity

statusCode
responseBody

email RJgmailcom
firstname Robert
lastname Jones

accountid BAfFRIAN

clinicindividualtypec Individual
clinicsourcesystemidc abc

clinicprimarycontactc BAQKIA

recordtypeid BWcIAE

id BAQKIA

email Jamesgmailcom
firstname Virgil
lastname James

accountid BAfFRIAN

clinicindividualtypec Individual
clinicsourcesystemidc xyz

clinicprimarycontactc BAQLIA

recordtypeid BWcIAE

id BAQLIA

Salesforce Industries REST API

Put Operation

message Number of Individuals created successfully

Note The clinicindividualtypec field represents the custom field individualtypec which is for
Salesforce internaluse only
The status code of tells us that the create operation was successful and the message confirms it

Put Operation
Make updates to individuals in your org one at a time or in groups

The PUT method allows partial updates so if some updates fail but others succeed the successful updates arent rolled back This behavior

is different than POST which is to roll back all changes if there is any error The individuals ID value individualidc uniquely

identifies the record so you must always include it in the request body If you omit the ID value the update request is ignored for that

individual

In the POST example we created two records Now lets modify those individuals to change their email addresses again using an org

with the namespace clinic The PUT method is servicesapexrestclinicvindividual

Heres the request body that identifies the individuals and lists the values to update

Tip Use the GET method with a duration of one day to retrieve the individualidc values

individuals

individualidc BAfFRIAN

email RJyahoocom

individualidc BAfFRIAN

email Jamesyahoocom

Heres the complete response

statusCode
responseBody

BAfFRIAN

errorFields
errorMessage
individualUpdated true

BAfFRIAN

errorFields
errorMessage
individualUpdated true

Salesforce Industries REST API

Filter Results

message Individuals UpdatedPlease check response body for detailed update status

The status code of tells us that the update operation was successful Looking at the individualUpdated values in the response
body tells us that all the updates were successful

Filter Results

Filter the fields returned by a GET request so that you see only the values you want

Enter Custom Settings in the Quick Find box or select Develop Custom Settings from Setup
Find Individual Excluded Fields in the Label column and click the label

Click Manage on the next screen

Click New and enter a field name Dont include the namespace as part of the field name

Salesforce Industries REST API

Filter Results

For more information search for Custom Settings in the Salesforce help

***