Lightning API Developer Guide

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 59

DownloadLightning API Developer Guide
Open PDF In BrowserView PDF
Lightning API Developer Guide
Version 39.0, Spring ’17

@salesforcedocs
Last updated: March 10, 2017

© Copyright 2000–2017 salesforce.com, inc. All rights reserved. Salesforce is a registered trademark of salesforce.com, inc.,

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

CONTENTS
Chapter 1: Get Started with Lightning API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Lightning API Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Status Codes and Error Responses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

Chapter 2: Lightning API Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Record UI, Get . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Record Layout, Get . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Object Info, Get . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Records, Get, Delete, Patch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Records, Batch Get . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Records, Post . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Clone Record Defaults, Get . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Create Record Defaults, Get . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Picklist Values, Get . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

Chapter 3: Lightning API Request Bodies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Record Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

Chapter 4: Lightning API Response Bodies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Lightning API Top-Level Response Bodies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Batch Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Object Info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Picklist Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Record Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Record Defaults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Record Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Record UI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Lightning API Nested Response Bodies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Batch Result Item . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Canvas Layout Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Custom Link Layout Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Error Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Error with Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Field Layout Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Field Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Filtered Lookup Info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Lead Status Picklist Value Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Location Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

Contents

Opportunity Stage Picklist Value Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Picklist Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Record Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Record Exception Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Record Layout Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Record Layout Item . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Record Layout Row . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Record Layout Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Record Type Info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Reference To Info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Report Layout Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Theme Info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Visualforce Layout Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

INDEX

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

CHAPTER 1

Get Started with Lightning API

Use Lightning API to create native mobile apps and custom web apps with your own branding and
look and feel. A single REST request returns enough metadata, layout information, and data to
display, edit, or create a record! Lightning API supports most objects that are available in Lightning
Experience.

EDITIONS
Available in: Developer
Edition

Note: Lightning API is available as a Developer Preview in all DE orgs. To use the API in
another type of org, contact Salesforce.
The Lightning API base URL is
https://{your_instance}.salesforce.com/services/data/v{api_version}/lapi.

Use the resources in the pilot version of Lightning API to display records.
• GET /lapi/record-ui/{recordIds}
• GET /lapi/layout/{objectApiName}
• GET /lapi/object-info/{objectApiName}
• GET /lapi/records/{recordId}
• PATCH /lapi/records/{recordId}
• DELETE /lapi/records/{recordId}
• GET /lapi/records/batch/{recordIds}
• POST /lapi/records
• GET /lapi/record-defaults/clone/{recordId}
• GET /lapi/record-defaults/create/{apiName}
• GET /lapi/object-info/{objectApiName}/picklist-values/{recordTypeId}/{fieldApiName}
The first resource in the list, the Record UI resource, is the top dog of Lightning API. To display a record, your code makes this simple
request:
GET /lapi/record-ui/001R0000003GeJ1IAK

Behind the scenes, Salesforce does the heavy lifting.
• Checks field-level security settings, sharing settings, and perms.
• Makes SOQL queries to get record data.
• Gets object metadata and theme information.
• Gets layout information.
You are one happy developer, because Salesforce transforms the results into an easy-to-consume JSON response with all the metadata
and data you need to display a record.
Authorization
Like other Salesforce REST APIs, Lightning API uses OAuth 2.0.

1

Get Started with Lightning API

Versioning
Lightning API is versioned. Specify the API version number in each request.
GET https://{your_instance}.salesforce.com/services/data/v39.0/lapi

Response Filtering
Lightning API is built on the same REST framework as Chatter REST API and observes the same filtering rules.
Also, several Lightning API resources support additional parameters that change the response to include what your UI needs.
• formFactor—The layout display size for the record.
– Large—(Default) Use this value to get a layout for desktop display size.
– Medium—Use this value to get a layout for tablet display size.
– Small—Use this value to get a layout for phone display size.
• layoutType—The layout type for the record.
– Compact—Use this value to get a layout that contains a record's key fields.
– Full—(Default) Use this value to get a full layout.
• mode—The access mode for the record. This value determines which fields to get from a layout. Layouts have different fields
for create, edit, and view modes. For example, formula fields are rendered in view mode, but not in create mode because they’re
calculated at run time, like formulas in a spreadsheet.
– Create—Use this mode if you intend to build UI that lets a user create a record. This mode is used by the
/lapi/record-defaults/create/{apiName} resource.
– Edit—Use this mode if you intend to build UI that lets a user edit a record. This mode is used by the
/lapi/record-defaults/clone/{recordId} resource.
– View—(Default) Use this mode if you intend to build UI that displays a record.
Error Handling
The response header contains an HTTP status code. If the response isn’t successful, the response body contains an error message,
and if appropriate, information about the field or object where the error occurred.
Rate Limiting
Lightning API requests are subject to rate limiting. Lightning API has a per user, per application, per hour rate limit. When you exceed
the rate limit, all Lightning API resources return a 503 Service Unavailable error code.
Required Fields
When you’re building UI, to determine which fields to mark as required for create and update, use the
ObjectInfo.fields[].required property.
Lightning API Quick Start
The best way to learn an API is to use it. Let's go!
Status Codes and Error Responses
The response header contains an HTTP status code. If the response isn’t successful, the response body contains an error message,
and if appropriate, information about the field or object where the error occurred.
SEE ALSO:
Digging Deeper into OAuth 2.0 on Force.com

2

Get Started with Lightning API

Lightning API Quick Start

Lightning API Quick Start
The best way to learn an API is to use it. Let's go!
Sign up for a Salesforce Developer Edition (also known as a DE org).
This quick start makes a request to the top dog of Lightning APIs, the Record UI resource, /lapi/record-ui/{recordIds}.
This resource returns all the information you need to display a record in an app: layout metadata, object metadata, and record data.
1. Go to the Workbench API utility.
2. Log in to your DE org.
3. The Record UI resource requires a record ID. To grab one:
a. Click queries > SOQL Query.
b. Select an object, such as Account, select the Id field, and click Query.
c. Copy one of the IDs in the list of query results. Either keep it in your clipboard, or copy it to a notepad to grab later.
4. Select utilities > Rest Explorer.
5. Make a GET request to /lapi/record-ui/{recordIds}. Substitute the record ID from your SOQL query.
Here's a sample request:
GET /lapi/record-ui/001R0000003GeJ1IAK

The response includes three nested response bodies. Each response body is a map because you can pass a list of record Ids to the request
(for example, /lapi/record-ui/001R0000003GeJ1IAK,001R0000003GKR0IAO). In our example, we passed only one
record ID.
• layouts—A map of object API names to layout information for each object
• objectInfos—A map of object API names to metadata for each object
• records—A map of record IDs to data for each record
Tip: To get these response bodies individually, use GET /lapi/layout/{objectApiName}, GET
/lapi/object-info/{objectApiName}, and GET /lapi/records/{recordId}.
{
"layouts" : {
"Account" : {
"012000000000000AAA" : {
"Full" : {
"View" : {
"id" : "00hR0000000NPP3IAO",
"layoutType" : "Full",
"mode" : "View",
"sections" : [ {
"columns" : 2,
"heading" : "Account Information",
"isCollapsed" : false,
"layoutRows" : [ {
"layoutItems" : [ {
"editableForNew" : false,
"editableForUpdate" : false,
"label" : "Account Owner",
"layoutComponents" : [ {

3

Get Started with Lightning API

Lightning API Quick Start

"componentType" : "Field",
"label" : "Owner ID",
"value" : "OwnerId"
} ],
"lookupIdApiName" : "OwnerId",
"sortable" : false
}, {
"editableForNew" : true,
"editableForUpdate" : true,
"label" : "Phone",
"layoutComponents" : [ {
"componentType" : "Field",
"label" : "Account Phone",
"value" : "Phone"
} ],
"lookupIdApiName" : null,
"sortable" : false
} ]
}, {
"layoutItems" : [ {
"editableForNew" : true,
"editableForUpdate" : true,
"label" : "Account Name",
"layoutComponents" : [ {
"componentType" : "Field",
"label" : "Account Name",
"value" : "Name"
} ],
"lookupIdApiName" : "Id",
"sortable" : false
}, {
"editableForNew" : true,
"editableForUpdate" : true,
"label" : "Fax",
"layoutComponents" : [ {
"componentType" : "Field",
"label" : "Account Fax",
"value" : "Fax"
} ],
"lookupIdApiName" : null,
"sortable" : false
} ]
}, {
"layoutItems" : [ {
"editableForNew" : true,
"editableForUpdate" : true,
"label" : "Parent Account",
"layoutComponents" : [ {
"componentType" : "Field",
"label" : "Parent Account ID",
"value" : "ParentId"
} ],
"lookupIdApiName" : "ParentId",
"sortable" : false

4

Get Started with Lightning API

Lightning API Quick Start

}, {
"editableForNew" : true,
"editableForUpdate" : true,
"label" : "Website",
"layoutComponents" : [ {
"componentType" : "Field",
"label" : "Website",
"value" : "Website"
} ],
"lookupIdApiName" : null,
"sortable" : false
} ]
} ],
"rows" : 3,
"useHeading" : false
},
... layout info about some sections removed to save space ...
{
"columns" : 3,
"heading" : "Custom Links",
"isCollapsed" : false,
"layoutRows" : [ {
"layoutItems" : [ {
"editableForNew" : false,
"editableForUpdate" : false,
"label" : "",
"layoutComponents" : [ {
"behavior" : "NewWindow",
"componentType" : "CustomLink",
"customLinkUrl" :
"/servlet/servlet.Integration?lid=00bR0000000I2Ja&eid=ENTITY_ID&ic=1",
"label" : "Google Search",
"value" : "GoogleSearch"
} ],
"lookupIdApiName" : null,
"sortable" : false
}, {
"editableForNew" : false,
"editableForUpdate" : false,
"label" : "",
"layoutComponents" : [ {
"behavior" : "NewWindow",
"componentType" : "CustomLink",
"customLinkUrl" :
"/servlet/servlet.Integration?lid=00bR0000000I2JY&eid=ENTITY_ID&ic=1",
"label" : "Google Maps",
"value" : "GoogleMaps"
} ],
"lookupIdApiName" : null,
"sortable" : false
}, {
"editableForNew" : false,

5

Get Started with Lightning API

Lightning API Quick Start

"editableForUpdate" : false,
"label" : "",
"layoutComponents" : [ {
"behavior" : "NewWindow",
"componentType" : "CustomLink",
"customLinkUrl" :
"/servlet/servlet.Integration?lid=00bR0000000I2JZ&eid=ENTITY_ID&ic=1",
"label" : "Google News",
"value" : "GoogleNews"
} ],
"lookupIdApiName" : null,
"sortable" : false
} ]
}, {
"layoutItems" : [ {
"editableForNew" : false,
"editableForUpdate" : false,
"label" : "",
"layoutComponents" : [ {
"behavior" : "NewWindow",
"componentType" : "CustomLink",
"customLinkUrl" :
"/servlet/servlet.Integration?lid=00bR0000000I2Jb&eid=ENTITY_ID&ic=1",
"label" : "Hoovers Profile",
"value" : "HooversProfile"
} ],
"lookupIdApiName" : null,
"sortable" : false
} ]
} ],
"rows" : 2,
"useHeading" : true
} ]
}
}
}
}
},
"objectInfos" : {
"Account" : {
"apiName" : "Account",
"createable" : true,
"custom" : false,
"defaultRecordTypeId" : null,
"deleteable" : true,
"feedEnabled" : true,
"fields" : {
"AnnualRevenue" : {
"apiName" : "AnnualRevenue",
"calculated" : false,
"compound" : false,
"controllerName" : null,
"createable" : true,
"custom" : false,

6

Get Started with Lightning API

Lightning API Quick Start

"dataType" : "Currency",
"extraTypeInfo" : null,
"filterable" : true,
"filteredLookupInfo" : null,
"highScaleNumber" : false,
"htmlFormatted" : false,
"label" : "Annual Revenue",
"length" : 0,
"nameField" : false,
"picklistValuesUrls" : { },
"precision" : 18,
"reference" : false,
"referenceTargetField" : null,
"referenceToInfos" : [ ],
"relationshipName" : null,
"required" : false,
"scale" : 0,
"sortable" : true,
"updateable" : true
},
... info about some fields removed to save space ...
"Website" : {
"apiName" : "Website",
"calculated" : false,
"compound" : false,
"controllerName" : null,
"createable" : true,
"custom" : false,
"dataType" : "Url",
"extraTypeInfo" : null,
"filterable" : true,
"filteredLookupInfo" : null,
"highScaleNumber" : false,
"htmlFormatted" : false,
"label" : "Website",
"length" : 255,
"nameField" : false,
"picklistValuesUrls" : { },
"precision" : 0,
"reference" : false,
"referenceTargetField" : null,
"referenceToInfos" : [ ],
"relationshipName" : null,
"required" : false,
"scale" : 0,
"sortable" : true,
"updateable" : true
}
},
"keyPrefix" : "001",
"label" : "Account",
"labelPlural" : "Accounts",

7

Get Started with Lightning API

Status Codes and Error Responses

"layoutable" : true,
"mruEnabled" : true,
"nameFields" : [ "Name" ],
"queryable" : true,
"recordTypeInfos" : {
"012000000000000AAA" : {
"available" : true,
"defaultRecordTypeMapping" : true,
"master" : true,
"name" : "Master",
"recordTypeId" : "012000000000000AAA"
}
},
"searchable" : true,
"themeInfo" : {
"color" : "7F8DE1",
"iconUrl" :
"https://na7-blitz02.soma.salesforce.com/img/icon/t4v35/standard/account_120.png"
},
"updateable" : true
}
},
"records" : {
"001R0000003GeJ1IAK" : {
"apiName" : "Account",
"fields" : {
"AnnualRevenue" : {
"displayValue" : "$50,000,000",
"value" : 5.0E7
},
... data for some fields removed to save space ...
"Website" : {
"displayValue" : null,
"value" : null
}
},
"id" : "001R0000003GeJ1IAK",
"recordTypeInfo" : null
}
}
}

SEE ALSO:
Digging Deeper into OAuth 2.0 on Force.com

Status Codes and Error Responses
The response header contains an HTTP status code. If the response isn’t successful, the response body contains an error message, and
if appropriate, information about the field or object where the error occurred.

8

Get Started with Lightning API

Status Codes and Error Responses

HTTP Status Code

Description

200

Success with GET, PATCH, or HEAD request

201

Success with POST request

204

Success with DELETE

400

The request could not be understood, usually because the ID is not valid for the particular resource.

401

The session ID or OAuth token has expired or is invalid. Or, if the request is made by a guest user, the
resource isn’t accessible to guest users. The response body contains the message and errorCode.

403

The request has been refused. Verify that the context user has the appropriate permissions to access the
requested data, or that the context user is not an external user.

404

Either the specified resource was not found, or the resource has been deleted.

409

A conflict has occurred. For example, an attempt was made to update a request to join a group, but that
request had already been approved or rejected.

412

A precondition has failed. For example, in a batch request, if haltOnError is true and a subrequest
fails, subsequent subrequests return 412.

500

An error has occurred within Force.com, so the request could not be completed. Contact Salesforce
Customer Support.

503

Too many requests in an hour or the server is down for maintenance.

Example
This request requires a 15 or 18 character record ID, but this record ID doesn't contain enough characters:
GET /lapi/record-ui/003R000000

The response body is:
HTTP/1.1 400 Bad Request
Date: Tue, 29 Nov 2016 00:16:36 GMT
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Content-Security-Policy: reflected-xss block;report-uri /_/ContentDomainCSPNoAuth?type=xss
Content-Security-Policy: referrer origin-when-cross-origin
Set-Cookie: BrowserId=q27CK9tSSCeI3klUaYMo6A;Path=/;Domain=.salesforce.com;Expires=Sat,
28-Jan-2017 00:16:36 GMT
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked

[ {
"errorCode" : "ILLEGAL_QUERY_PARAMETER_VALUE",

9

Get Started with Lightning API

Status Codes and Error Responses

"message" : "recordId should be a valid record ID: 003R000000"
} ]

SEE ALSO:
Digging Deeper into OAuth 2.0 on Force.com

10

CHAPTER 2

Lightning API Resources

This chapter contains Lightning API resources (also called endpoints).
Record UI, Get
Get layout information, metadata, and data to build UI for a single record or for a collection of records.
Record Layout, Get
Get metadata about page layouts for the specified object type.
Object Info, Get
Get metadata (field list and object properties) about a specific object.
Records, Get, Delete, Patch
Get, delete, and update a specific record's data.
Records, Batch Get
Get data for a batch of records.
Records, Post
Create a new record. Before you create a record, make a request to the Clone Record Default or Create Record Default resources to
get the default metadata and data.
Clone Record Defaults, Get
Get the default layout information, object information, and data for cloning a record. After getting the default values, make a request
to POST /lapi/records to create the record.
Create Record Defaults, Get
Get the default layout information and object information for creating a record. After getting the default values, make a request to
POST /lapi/records to create the record.
Picklist Values, Get
Get the values for a picklist.

Record UI, Get
Get layout information, metadata, and data to build UI for a single record or for a collection of records.
Resource
/lapi/record-ui/{recordIds}

Available version
39.0
HTTP methods
GET

11

Lightning API Resources

Record UI, Get

Request parameters for GET
Parameter
Name

Type

Description

Required or
Optional

formFactor

String

The layout display size for the record. One Optional
of these values:

Available
Version
39.0

• Large—(Default) Use this value to
get a layout for desktop display size.
• Medium—Use this value to get a
layout for tablet display size.
• Small—Use this value to get a
layout for phone display size.
layoutTypes

String[]

The layout type for the record. A collection Optional
of any of these values:

39.0

• Compact—Use this value to get a
layout that contains a record's key
fields.
• Full—(Default) Use this value to get
a full layout.
modes

String[]

The access mode for the record. This value Optional
determines which fields to get from a
layout. Layouts have different fields for
create, edit, and view modes. For example,
formula fields are rendered in view mode,
but not in create mode because they’re
calculated at run time, like formulas in a
spreadsheet. A collection of any of these
values:
• Create—Use this mode if you
intend to build UI that lets a user
create a record. This mode is used by
the
/lapi/record-defaults/create/{apiName}

resource.
• Edit—Use this mode if you intend
to build UI that lets a user edit a record.
This mode is used by the
/lapi/record-defaults/clone/{recordId}

resource.
• View—(Default) Use this mode if you
intend to build UI that displays a
record.

12

39.0

Lightning API Resources

Parameter
Name

Record Layout, Get

Type

optionalFields String[]

Description

Required or
Optional

A collection of optional field names. If a Optional
field is accessible to the context user, it’s
included in the response. If a field isn’t
accessible to the context user, it isn’t
included in the response, but it doesn’t
cause an error. Specify optional field names
using the format:

Available
Version
39.0

{ObjectApiName}.{FieldName}

Response body for GET
Record UI
SEE ALSO:
Lightning API Quick Start

Record Layout, Get
Get metadata about page layouts for the specified object type.
Resource
/lapi/layout/{objectApiName}

Available version
39.0
HTTP methods
GET
Request parameters for GET
Parameter
Name

Type

Description

Required or
Optional

formFactor

String

The layout display size for the record. One Optional
of these values:
• Large—(Default) Use this value to
get a layout for desktop display size.
• Medium—Use this value to get a
layout for tablet display size.
• Small—Use this value to get a
layout for phone display size.

13

Available
Version
39.0

Lightning API Resources

Record Layout, Get

Parameter
Name

Type

Description

Required or
Optional

Available
Version

layoutType

String

The layout type for the record. One of
these values:

Optional

39.0

The access mode for the record. This value Optional
determines which fields to get from a
layout. Layouts have different fields for
create, edit, and view modes. For example,
formula fields are rendered in view mode,
but not in create mode because they’re
calculated at run time, like formulas in a
spreadsheet. One of these values:

39.0

• Compact—Use this value to get a
layout that contains a record's key
fields.
• Full—(Default) Use this value to get
a full layout.
mode

String

• Create—Use this mode if you
intend to build UI that lets a user
create a record. This mode is used by
the
/lapi/record-defaults/create/{apiName}

resource.
• Edit—Use this mode if you intend
to build UI that lets a user edit a record.
This mode is used by the
/lapi/record-defaults/clone/{recordId}

resource.
• View—(Default) Use this mode if you
intend to build UI that displays a
record.
recordTypeId

Id

The ID of the record type (RecordType
Optional
object) for the new record. If not provided,
the default record type is used.

Response body for GET
Record Layout
SEE ALSO:
Lightning API Quick Start

14

39.0

Lightning API Resources

Object Info, Get

Object Info, Get
Get metadata (field list and object properties) about a specific object.
Resource
/lapi/object-info/{objectApiName}

Available version
39.0
HTTP methods
GET
Request parameters for GET
Parameter
Name

Type

Description

Required or
Optional

layoutTypes

String[]

The layout type for the record. A collection Optional
containing any of these values:

Available
Version
39.0

• Compact—Use this value to get a
layout that contains a record's key
fields.
• Full—(Default) Use this value to get
a full layout.
modes

String[]

The access mode for the record. This value Optional
determines which fields to get from a
layout. Layouts have different fields for
create, edit, and view modes. For example,
formula fields are rendered in view mode,
but not in create mode because they’re
calculated at run time, like formulas in a
spreadsheet. A collection containing any
of these values:
• Create—Use this mode if you
intend to build UI that lets a user
create a record. This mode is used by
the
/lapi/record-defaults/create/{apiName}

resource.
• Edit—Use this mode if you intend
to build UI that lets a user edit a record.
This mode is used by the
/lapi/record-defaults/clone/{recordId}

resource.
• View—(Default) Use this mode if you
intend to build UI that displays a
record.

15

39.0

Lightning API Resources

Records, Get, Delete, Patch

Parameter
Name

Type

Description

Required or
Optional

recordTypeId

Id

The ID of the record type (RecordType
Optional
object) for the new record. If not provided,
the default record type is used.

Available
Version
39.0

Response body for GET
Object Info
SEE ALSO:
Lightning API Quick Start

Records, Get, Delete, Patch
Get, delete, and update a specific record's data.
Resource
/lapi/records/{recordId}

Available version
39.0
HTTP methods
GET, DELETE, PATCH
Request parameters for GET
Parameter
Name

Type

Description

Required or
Optional

fields

String[]

Specifies the fields to return. If this property Either fields or 39.0
is specified, the response is a union of
layoutTypes is
fields and optionalFields.
required.
If the context user doesn’t have access to
a field, an error is returned.
If you’re not sure whether the context user
has access to a field and you don’t want
the request to fail if they don’t, use the
optionalFields parameter instead.

16

Available
Version

Lightning API Resources

Records, Get, Delete, Patch

Parameter
Name

Type

Description

Required or
Optional

Available
Version

layoutTypes

String[]

Specifies the fields to return. If this property Either fields or 39.0
is specified, the response is a union of
layoutTypes is
layoutTypes, modes, and
required.
optionalFields.
A collection containing any of these values:
• Compact—Use this value to get a
layout that contains a record's key
fields.
• Full—(Default) Use this value to get
a full layout.

modes

String[]

The access mode for the record. This value
determines which fields to get from a
layout. Layouts have different fields for
create, edit, and view modes. For example,
formula fields are rendered in view mode,
but not in create mode because they’re
calculated at run time, like formulas in a
spreadsheet. A collection containing any
of these values:

Optional if the

39.0

layoutTypes

parameter is
specified.
Otherwise, this
parameter is
ignored.

• Create—Use this mode if you
intend to build UI that lets a user
create a record. This mode is used by
the
/lapi/record-defaults/create/{apiName}

resource.
• Edit—Use this mode if you intend
to build UI that lets a user edit a record.
This mode is used by the
/lapi/record-defaults/clone/{recordId}

resource.
• View—(Default) Use this mode if you
intend to build UI that displays a
record.
optionalFields String[]

A collection of optional field names. If a Optional
field is accessible to the context user, it’s
included in the response. If a field isn’t
accessible to the context user, it isn’t
included in the response, but it doesn’t
cause an error. Specify optional field names
using the format:
{ObjectApiName}.{FieldName}

17

39.0

Lightning API Resources

Records, Get, Delete, Patch

Response body for GET
Record Data
Request body for PATCH
Name

Type

Description

Required or
Optional

Available
Version

apiName

String

To create a record, specify the API name
of an Object from which to create the
record. To update a record, use null.

Required

39.0

fields

Map

Map of field names to field values.

Required

39.0

Format data types according to these rules:
• Address—JSON String
• Base64—JSON String
• Boolean—JSON Boolean, true or
false

• Currency—JSON Float
• Date—JSON string in correct format
• DateTime—JSON string in ISO 8601
format
• Double—JSON Float
• Email—JSON String
• EncryptedString—JSON String
• Int—JSON Number
• Location—JSON String
• MultiPicklist—JSON String
• Percent—JSON Float
• Phone—JSON String
• Picklist—JSON String
• Reference—JSON String.
• String—JSON String
• TextArea—JSON String
• Time—JSON String in format
HH:MM:SS
• Url—JSON String

Response body for PATCH
Record Data

18

Lightning API Resources

Records, Batch Get

Example for PATCH
PATCH /lapi/records/001R0000003Gjrt
{
"apiName": "Account",
"fields": {
"Name": "Universal Containers"
}
}

To provide an address, provide the individual fields as separate inputs. The compound field is only available in the response.
{
"apiName": "Account",
"fields" : {
"Name": "Local Boxes",
"BillingState": "WA",
"BillingStreet" : "123 Main Street",
"BillingCountry" : "USA"
}
}

SEE ALSO:
Records, Batch Get
Records, Post
Lightning API Quick Start

Records, Batch Get
Get data for a batch of records.
Resource
/lapi/records/batch/{recordIds}

Available version
39.0
HTTP methods
GET
Request parameters for GET
Parameter
Name

Type

Description

Required or
Optional

fields

String[]

Specifies the fields to return. If this property Either fields or 39.0
is specified, the response is a union of
layoutTypes is
fields and optionalFields.
required.
If the context user doesn’t have access to
a field, an error is returned.

19

Available
Version

Lightning API Resources

Parameter
Name

Records, Batch Get

Type

Description

Required or
Optional

Available
Version

If you’re not sure whether the context user
has access to a field and you don’t want
the request to fail if they don’t, use the
optionalFields parameter instead.
layoutTypes

String[]

Specifies the fields to return. If this property Either fields or 39.0
is specified, the response is a union of
layoutTypes is
layoutTypes, modes, and
required.
optionalFields.
A collection containing any of these values:
• Compact—Use this value to get a
layout that contains a record's key
fields.
• Full—(Default) Use this value to get
a full layout.

modes

String[]

The access mode for the record. This value
determines which fields to get from a
layout. Layouts have different fields for
create, edit, and view modes. For example,
formula fields are rendered in view mode,
but not in create mode because they’re
calculated at run time, like formulas in a
spreadsheet. A collection containing any
of these values:

Optional if the

39.0

layoutTypes

parameter is
specified.
Otherwise, this
parameter is
ignored.

• Create—Use this mode if you
intend to build UI that lets a user
create a record. This mode is used by
the
/lapi/record-defaults/create/{apiName}

resource.
• Edit—Use this mode if you intend
to build UI that lets a user edit a record.
This mode is used by the
/lapi/record-defaults/clone/{recordId}

resource.
• View—(Default) Use this mode if you
intend to build UI that displays a
record.
optionalFields String[]

A collection of optional field names. If a
field is accessible to the context user, it’s
included in the response. If a field isn’t
accessible to the context user, it isn’t
included in the response, but it doesn’t

20

Optional

39.0

Lightning API Resources

Parameter
Name

Records, Post

Type

Description

Required or
Optional

Available
Version

cause an error. Specify optional field names
using the format:
{ObjectApiName}.{FieldName}

Response body for GET
Batch Results
SEE ALSO:
Clone Record Defaults, Get
Create Record Defaults, Get
Records, Get, Delete, Patch
Lightning API Quick Start
Batch Results

Records, Post
Create a new record. Before you create a record, make a request to the Clone Record Default or Create Record Default resources to get
the default metadata and data.
Resource
/lapi/records

Available version
39.0
HTTP methods
POST
Request body example
POST /lapi/records
{
"apiName": "Account",
"fields": {
"Name": "Universal Containers"
}
}

To provide an address, provide the individual fields as separate inputs. The compound field is only available in the response.
{
"apiName": "Account",
"fields" : {
"Name": "Local Boxes",
"BillingState": "WA",
"BillingStreet" : "123 Main Street",

21

Lightning API Resources

Records, Post

"BillingCountry" : "USA"
}
}

Request body for POST
Name

Type

Description

Required or
Optional

Available
Version

apiName

String

To create a record, specify the API name
of an Object from which to create the
record. To update a record, use null.

Required

39.0

fields

Map

Map of field names to field values.

Required

39.0

Format data types according to these rules:
• Address—JSON String
• Base64—JSON String
• Boolean—JSON Boolean, true or
false

• Currency—JSON Float
• Date—JSON string in correct format
• DateTime—JSON string in ISO 8601
format
• Double—JSON Float
• Email—JSON String
• EncryptedString—JSON String
• Int—JSON Number
• Location—JSON String
• MultiPicklist—JSON String
• Percent—JSON Float
• Phone—JSON String
• Picklist—JSON String
• Reference—JSON String.
• String—JSON String
• TextArea—JSON String
• Time—JSON String in format
HH:MM:SS
• Url—JSON String

Response body for POST
Record Data

22

Lightning API Resources

Records, Post

Response body example
{
"apiName" : "Account",
"fields" : {
"AnnualRevenue" : {
"displayValue" : null,
"value" : null
},
"BillingCity" : {
"displayValue" : null,
"value" : null
},
"BillingCountry" : {
"displayValue" : null,
"value" : null
},
"BillingPostalCode" : {
"displayValue" : null,
"value" : null
},
"BillingState" : {
"displayValue" : null,
"value" : null
},
"BillingStreet" : {
"displayValue" : null,
"value" : null
},
"CreatedBy" : {
"displayValue" : "Deanna Li",
"value" : {
"apiName" : "User",
"fields" : {
"Id" : {
"displayValue" : "005R0000000IEDsIAO",
"value" : "005R0000000IEDsIAO"
},
"Name" : {
"displayValue" : "Deanna Li",
"value" : "Deanna Li"
}
},
"id" : "005R0000000IEDsIAO",
"recordTypeInfo" : null
}
},
"CreatedById" : {
"displayValue" : "005R0000000IEDsIAO",
"value" : "005R0000000IEDsIAO"
},
"CreatedDate" : {
"displayValue" : "11/22/2016 12:36 PM",
"value" : "2016-11-22T20:36:12.000Z"

23

Lightning API Resources

Records, Post

},
"Description" : {
"displayValue" : null,
"value" : null
},
"Fax" : {
"displayValue" : null,
"value" : null
},
"Industry" : {
"displayValue" : null,
"value" : null
},
"LastModifiedBy" : {
"displayValue" : "Deanna Li",
"value" : {
"apiName" : "User",
"fields" : {
"Id" : {
"displayValue" : "005R0000000IEDsIAO",
"value" : "005R0000000IEDsIAO"
},
"Name" : {
"displayValue" : "Deanna Li",
"value" : "Deanna Li"
}
},
"id" : "005R0000000IEDsIAO",
"recordTypeInfo" : null
}
},
"LastModifiedById" : {
"displayValue" : "005R0000000IEDsIAO",
"value" : "005R0000000IEDsIAO"
},
"LastModifiedDate" : {
"displayValue" : "11/22/2016 12:36 PM",
"value" : "2016-11-22T20:36:12.000Z"
},
"Name" : {
"displayValue" : "Universal Containers",
"value" : "Universal Containers"
},
"NumberOfEmployees" : {
"displayValue" : null,
"value" : null
},
"Owner" : {
"displayValue" : "Deanna Li",
"value" : {
"apiName" : "User",
"fields" : {
"Id" : {
"displayValue" : "005R0000000IEDsIAO",

24

Lightning API Resources

Records, Post

"value" : "005R0000000IEDsIAO"
},
"Name" : {
"displayValue" : "Deanna Li",
"value" : "Deanna Li"
}
},
"id" : "005R0000000IEDsIAO",
"recordTypeInfo" : null
}
},
"OwnerId" : {
"displayValue" : "005R0000000IEDsIAO",
"value" : "005R0000000IEDsIAO"
},
"ParentId" : {
"displayValue" : null,
"value" : null
},
"Phone" : {
"displayValue" : null,
"value" : null
},
"ShippingCity" : {
"displayValue" : null,
"value" : null
},
"ShippingCountry" : {
"displayValue" : null,
"value" : null
},
"ShippingPostalCode" : {
"displayValue" : null,
"value" : null
},
"ShippingState" : {
"displayValue" : null,
"value" : null
},
"ShippingStreet" : {
"displayValue" : null,
"value" : null
},
"Type" : {
"displayValue" : null,
"value" : null
},
"Website" : {
"displayValue" : null,
"value" : null
}
},
"id" : "001R0000003GeJ1IAK",

25

Lightning API Resources

Clone Record Defaults, Get

"recordTypeInfo" : null
}

SEE ALSO:
Clone Record Defaults, Get
Create Record Defaults, Get
Records, Get, Delete, Patch
Lightning API Quick Start

Clone Record Defaults, Get
Get the default layout information, object information, and data for cloning a record. After getting the default values, make a request to
POST /lapi/records to create the record.
Resource
/lapi/record-defaults/clone/{recordId}

Available version
39.0
HTTP methods
GET
Request parameters for GET
Parameter
Name

Type

Description

Required or
Optional

formFactor

String

The layout display size for the record. One Optional
of these values:

Available
Version
39.0

• Large—(Default) Use this value to
get a layout for desktop display size.
• Medium—Use this value to get a
layout for tablet display size.
• Small—Use this value to get a
layout for phone display size.
recordTypeId

Id

The ID of the record type (RecordType
Optional
object) for the new record. If not provided,
the default record type is used.

26

39.0

Lightning API Resources

Create Record Defaults, Get

Response body for GET
Record Defaults
SEE ALSO:
Records, Post
Lightning API Quick Start

Create Record Defaults, Get
Get the default layout information and object information for creating a record. After getting the default values, make a request to POST
/lapi/records to create the record.
Resource
/lapi/record-defaults/create/{apiName}

Available version
39.0
HTTP methods
GET
Request parameters for GET
Parameter
Name

Type

Description

Required or
Optional

formFactor

String

The layout display size for the record. One Optional
of these values:

Available
Version
39.0

• Large—(Default) Use this value to
get a layout for desktop display size.
• Medium—Use this value to get a
layout for tablet display size.
• Small—Use this value to get a
layout for phone display size.
recordTypeId

Id

The ID of the record type (RecordType
Optional
object) for the new record. If not provided,
the default record type is used.

Response body for GET
Record Defaults
SEE ALSO:
Records, Post
Lightning API Quick Start

27

39.0

Lightning API Resources

Picklist Values, Get

Picklist Values, Get
Get the values for a picklist.
Resource
/lapi/object-info/{objectApiName}/picklist-values/{recordTypeId}/{fieldApiName}

Available version
39.0
HTTP methods
GET
Response body for GET
Picklist Values
Example
When you make a request to /lapi/record-ui/{recordIds} or /lapi/object-info/{objectApiName}, if
the response includes a picklist field, it also includes a picklistValueUrl property. That property contains a Picklist Values
resource with the {objectApiName}, {recordTypeId}, and {fieldApiName} filled in, as in this example:
GET /services/data/v39.0/lapi/object-info/Account/picklist-values/012000000000000AAA/Type/
{
"controllerValues" : { },
"defaultValue" : null,
"url" :
"/services/data/v39.0/lapi/object-info/Account/picklist-values/012000000000000AAA/Type",
"values" : [ {
"attributes" : null,
"label" : "Analyst",
"picklistValueType" : "Standard",
"validFor" : [ ],
"value" : "Analyst"
}, {
"attributes" : null,
"label" : "Competitor",
"picklistValueType" : "Standard",
"validFor" : [ ],
"value" : "Competitor"
},
... some picklist values removed for space ...
{
"attributes" : null,
"label" : "Other",
"picklistValueType" : "Standard",
"validFor" : [ ],
"value" : "Other"

28

Lightning API Resources

Picklist Values, Get

} ]
}

SEE ALSO:
Record UI, Get
Object Info, Get
Lightning API Quick Start

29

CHAPTER 3

Lightning API Request Bodies

The successful execution of a request to a resource can return a response body in JSON format.
A request to a resource always returns an HTTP response code, whether the request was successful or not.
Record Input
A description of a record to use in a request to create or update a record.

Record Input
A description of a record to use in a request to create or update a record.
Example
POST /lapi/records
{
"apiName": "Account",
"fields": {
"Name": "Universal Containers"
}
}

To provide an address, provide the individual fields as separate inputs. The compound field is only available in the response.
{
"apiName": "Account",
"fields" : {
"Name": "Local Boxes",
"BillingState": "WA",
"BillingStreet" : "123 Main Street",
"BillingCountry" : "USA"
}
}

Properties
Name

Type

Description

Required or
Optional

Available
Version

apiName

String

To create a record, specify the API name
of an Object from which to create the
record. To update a record, use null.

Required

39.0

30

Lightning API Request Bodies

Record Input

Name

Type

Description

Required or
Optional

Available
Version

fields

Map

Map of field names to field values.

Required

39.0

Format data types according to these rules:
• Address—JSON String
• Base64—JSON String
• Boolean—JSON Boolean, true or
false

• Currency—JSON Float
• Date—JSON string in correct format
• DateTime—JSON string in ISO 8601
format
• Double—JSON Float
• Email—JSON String
• EncryptedString—JSON String
• Int—JSON Number
• Location—JSON String
• MultiPicklist—JSON String
• Percent—JSON Float
• Phone—JSON String
• Picklist—JSON String
• Reference—JSON String.
• String—JSON String
• TextArea—JSON String
• Time—JSON String in format
HH:MM:SS
• Url—JSON String

SEE ALSO:
Records, Post

31

CHAPTER 4

Lightning API Response Bodies

A request to a resource returns a response body. Some response bodies also contain nested response bodies.
A request to a resource always returns an HTTP response code, whether the request was successful or not.
Lightning API Top-Level Response Bodies
These response bodies are returned from requests to Lightning API resources. They may contain nested response bodies.
Lightning API Nested Response Bodies
These response bodies are nested in top-level response bodies.

Lightning API Top-Level Response Bodies
These response bodies are returned from requests to Lightning API resources. They may contain nested response bodies.
A request to a resource always returns an HTTP response code, whether the request was successful or not.
Batch Results
The results from a request to a batch resource. Results include information for each subrequest in the batch.
Object Info
The metadata for an object.
Picklist Values
The picklist values for a field, scoped to a record type.
Record Data
The field data, API name, and record type information for a record.
Record Defaults
The default information and data needed to create or clone a record. Use these values in a request to POST /lapi/records.
Record Layout
The layout information for a record.
Record UI
The layout information, field information, and data for a record.
SEE ALSO:
Lightning API Nested Response Bodies

32

Lightning API Response Bodies

Batch Results

Batch Results
The results from a request to a batch resource. Results include information for each subrequest in the batch.
Property

Type

Description

Filter Group Available
and Version Version

hasErrors

Boolean

true if at least one of the results in the result set is an Small, 39.0
HTTP status code in the 400 or 500 range; false

39.0

otherwise
results

Batch Result Item[]

Collection of batch result items

Small, 39.0

39.0

SEE ALSO:
Records, Batch Get

Object Info
The metadata for an object.
Property Name

Type

Description

Filter Group and Available
Version
Version

apiName

String

The object's API name.

Small, 39.0

39.0

createable

Boolean

Indicates whether the object can be
created.

Small, 39.0

39.0

custom

Boolean

Indicates whether the object is custom. Small, 39.0

39.0

The ID for the default record type for this Medium, 39.0
object, if any. If there isn’t a default type,
or if there’s only a master type, this value
is null.

39.0

defaultRecordTypeId String

deleteable

Boolean

Indicates whether the object can be
deleted.

Small, 39.0

39.0

feedEnabled

Boolean

Indicates whether the object can have
feeds.

Medium, 39.0

39.0

fields

Map A map of field API name to information Medium, 39.0
about the field. This map only contains
fields relevant to the requested layout
and mode.

39.0

keyPrefix

String

The key prefix for IDs of this object.

Medium, 39.0

39.0

label

String

The object's display label.

Small, 39.0

39.0

labelPlural

String

The plural form of the object's display
label.

Medium, 39.0

39.0

33

Lightning API Response Bodies

Picklist Values

Property Name

Type

Description

Filter Group and Available
Version
Version

layoutable

Boolean

Indicates whether the object can have
a layout.

Small, 39.0

39.0

mruEnabled

Boolean

Indicates whether the object can appear Small, 39.0
in Most Recently Used lists.

39.0

nameFields

String[]

A collection of the API names of the
Medium, 39.0
fields used to identify the name field for
standard and custom objects. Typically
there is one name field per object,
except where FirstName and
LastName fields are used.

39.0

queryable

Boolean

Indicates whether the object can be
queried by the context user.

39.0

recordTypeInfos

Map about the record type. All record types
are visible whether or not the user has
access to them.

39.0

searchable

Boolean

Indicates whether the object can be
searched.

Small, 39.0

39.0

themeInfo

Theme Info

Theme information for the object.

Medium, 39.0

39.0

updateable

Boolean

Indicates whether the object can be
updated.

Small, 39.0

39.0

SEE ALSO:
Object Info, Get
Record UI
Clone Record Defaults, Get
Create Record Defaults, Get

Picklist Values
The picklist values for a field, scoped to a record type.

34

Small, 39.0

Lightning API Response Bodies

Property Name

Type

controllerValues Map

Record Data

Description

Filter Group and
Version

Available Version

If the picklist is independent, the map is
empty.

Small, 39.0

39.0

If the picklist is dependent, this map
contains the following:
• If the controlling field is a picklist, the
picklist value is the value index.
• If the controlling field is a boolean, 0
indicates false and 1 indicates
true. Values in the map are:
– "false": 0
– "true": 1
defaultValue

Picklist Value

The default value for the picklist, or null Small, 39.0
if there isn't one.

39.0

url

String

A self-reference URL back to the API that
can be used to retrieve this payload.

Small, 39.0

39.0

values

Picklist Value[]

A list of the applicable values for this
object-record-type-field combination.

Small, 39.0

39.0

SEE ALSO:
Picklist Values, Get

Record Data
The field data, API name, and record type information for a record.
Property Name

Type

Description

Filter Group and
Version

Available Version

apiName

String

The record's API name.

Small, 39.0

39.0

fields

Map

The field data for this record, matching the Small, 39.0
requested layout and mode.

39.0

id

String

The ID of this record.

39.0

35

Small, 39.0

Lightning API Response Bodies

Property Name

Type

recordTypeInfo Record Type Info

Record Defaults

Description

Filter Group and
Version

Available Version

The record type info for this record, if any.

Small, 39.0

39.0

SEE ALSO:
Records, Get, Delete, Patch
Records, Post
Record UI
Clone Record Defaults, Get
Create Record Defaults, Get

Record Defaults
The default information and data needed to create or clone a record. Use these values in a request to POST /lapi/records.
Property Name

Type

Description

Filter Group and
Version

Available Version

layout

Record Layout

Record layout information.

Medium, 39.0

39.0

objectInfo

Object Info

Object metadata.

Big, 39.0

39.0

record

Record Data

Pre-populated record data.

Small, 39.0

39.0

SEE ALSO:
Clone Record Defaults, Get
Create Record Defaults, Get
Records, Post

Record Layout
The layout information for a record.
Property Name

Type

Description

Filter Group and
Version

Available Version

id

String

The layout ID.

Small, 39.0

39.0

layoutType

String

The layout type for the record. One of these Small, 39.0
values:

39.0

• Compact—Use this value to get a
layout that contains a record's key fields.
• Full—(Default) Use this value to get
a full layout.

36

Lightning API Response Bodies

Record UI

Property Name

Type

Description

Filter Group and
Version

mode

String

The access mode for the record. This value Small, 39.0
determines which fields to get from a layout.
Layouts have different fields for create, edit,
and view modes. For example, formula fields
are rendered in view mode, but not in create
mode because they’re calculated at run
time, like formulas in a spreadsheet. One of
these values:

Available Version
39.0

• Create—Use this mode if you intend
to build UI that lets a user create a
record. This mode is used by the
/lapi/record-defaults/create/{apiName}

resource.
• Edit—Use this mode if you intend to
build UI that lets a user edit a record.
This mode is used by the
/lapi/record-defaults/clone/{recordId}

resource.
• View—(Default) Use this mode if you
intend to build UI that displays a record.
sections

Record Layout
Section[]

A collection of layout sections.

Small, 39.0

39.0

Filter Group and
Version

Available Version

SEE ALSO:
Record Layout, Get
Record UI
Clone Record Defaults, Get
Create Record Defaults, Get

Record UI
The layout information, field information, and data for a record.
Property Name

Type

Description

layouts

Map
record layout information.

39.0

objectInfos

Map
metadata.

39.0

37

Lightning API Response Bodies

Lightning API Nested Response Bodies

Property Name

Type

Description

records

Map

Filter Group and
Version

Available Version

Small, 39.0

39.0

SEE ALSO:
Record UI, Get

Lightning API Nested Response Bodies
These response bodies are nested in top-level response bodies.
A request to a resource always returns a HTTP response code, whether the request was successful or not.
Batch Result Item
The results of one subrequest in a batch request.
Canvas Layout Component
A canvas component on a record page layout.
Custom Link Layout Component
A custom link component on a record page layout.
Error Message
An error code and error message.
Error with Output
Contains extra information about errors. In rare cases, an error message isn't enough to describe the reason for a failure. For example,
when a conflicting precondition exists, the error result can include the information about the cause of the conflict.
Field
A field's metadata.
Field Layout Component
A field in a record layout.
Field Value
The raw and displayable field values for a field in a record.
Filtered Lookup Info
Metadata for a lookup filter.
Lead Status Picklist Value Attributes
Additional picklist value attributes for lead statuses.
Location Field
A complex location value for a record field.
Opportunity Stage Picklist Value Attributes
Additional picklist value attributes for opportunity stages.
Picklist Value
A single picklist value.

38

Lightning API Response Bodies

Batch Result Item

Record Exceptions
A collection of record exception errors.
Record Exception Error
Informaiton about a record exception error.
Record Layout Component
A concrete record layout component.
Record Layout Item
An item in a record layout.
Record Layout Row
A row in a record layout.
Record Layout Section
A section in a record layout.
Record Type Info
Informaiton about a record type.
Reference To Info
Information about a reference field's referenced types and the name field names of those types.
Report Layout Component
A report chart component on a record layout page.
Theme Info
Color and icon information for a theme.
Visualforce Layout Component
A Visualforce component on a record layout page.
SEE ALSO:
Lightning API Top-Level Response Bodies

Batch Result Item
The results of one subrequest in a batch request.
Property

Type

Description

Filter Group Available
and Version Version

result

One of these types:

A response body for a record passed in a request to
/lapi/records/batch/{recordIds}.

Small, 39.0

• Record Data
• Error Message
Important:
If the
result is
an error,
the type
is a
collection

39

39.0

Lightning API Response Bodies

Property

Canvas Layout Component

Type

Description

Filter Group Available
and Version Version

An HTTP status code indicating the status of this
individual request in the batch.

Small, 39.0

of error
messages.
statusCode

Integer

39.0

Canvas Layout Component
A canvas component on a record page layout.
Property Name

Type

Description

Filter Group and
Version

Available Version

componentType String

The value is Canvas.

Small, 39.0

39.0

displayLocation String

The location in the application where the
canvas app is being called from. One of
these values:

Small, 39.0

39.0

• Chatter—The canvas app was called
from the Chatter tab.
• ChatterFeed—The canvas app was
called from a Chatter canvas feed item.
• MobileNav—The canvas app was
called from the navigation menu in
Salesforce1.
• OpenCTI—The canvas app was called
from an Open CTI component.
• PageLayout—The canvas app was
called from an element within a page
layout. If the displayLocation is
PageLayout, one of the
subLocation values can be
returned.
• Publisher—The canvas app was
called from a canvas custom quick
action.
• ServiceDesk—The canvas app was
called from a Salesforce Console
component.
• Visualforce—The canvas app was
called from a Visualforce page.
• None—The canvas app was called
from the Canvas App Previewer.

40

Lightning API Response Bodies

Property Name

Type

Custom Link Layout Component

Description

Filter Group and
Version

Available Version

The sublocation in the application
where the canvas app was called from when
the canvas app is loaded in a mobile device.
The possible values are:
• S1MobileCardFullview—The
canvas app was called from a mobile
card.
• S1MobileCardPreview—The
canvas app was called from a mobile
card preview.
• S1RecordHomePreview—The
canvas app was called from a record
detail page preview.
• S1RecordHomeFullview—The
canvas app was called from a page
layout.
height

String

The height of the component.

Small, 39.0

39.0

referenceId

String

The unique ID of the canvas app definition. Small, 39.0

39.0

showScroll

Boolean

Indicates whether to show the scroll bar on Small, 39.0
the canvas component (true) or not
(false).

39.0

width

String

The width of the component.

Small, 39.0

39.0

value

String

The API name of the canvas app.

Small, 39.0

39.0

Filter Group and
Version

Available Version

Custom Link Layout Component
A custom link component on a record page layout.
Property Name

Type

Description

behavior

String

Indicates how a link behaves on open. One Small, 39.0
of these values:
• NewWindow—Open a new window.
• NoSidebar—No sidebar
• OnClickJavaScript—When the
link is clicked, run JavaScript.
• Replace—Replace the current page.
• Sidebar—Sidebar

41

39.0

Lightning API Response Bodies

Property Name

Error Message

Type

Description

Filter Group and
Version

Available Version

componentType String

The component type. The value is
CustomLink.

Small, 39.0

39.0

customLinkUrl String

The custom link URL.

Small, 39.0

39.0

label

String

The custom link label.

Small, 39.0

39.0

value

String

The value of the custom link component.

Small, 39.0

39.0

Error Message
An error code and error message.
Property

Type

Description

Filter Group Available
and Version Version

errorCode

String

An error code with information about the error, for
example, INSUFFICIENT_PRIVILEGES

Small, 39.0

39.0

message

String

Description of error

Small, 39.0

39.0

Error with Output
Contains extra information about errors. In rare cases, an error message isn't enough to describe the reason for a failure. For example,
when a conflicting precondition exists, the error result can include the information about the cause of the conflict.
Property

Type

Description

enhancedErrorType

String

Indicates the type of the output property. The Small, 39.0
value is either null or RecordError.

39.0

message

String

Description of the error.

Small, 39.0

39.0

output

Any response body The response body returned by the requested
Small, 39.0
resource. For example, if a successful request
returns a Object Info response body but an error
triggers the Error with Output response body, the
value of the output property is an Object Info
response body.

39.0

When an error occurs related to record create or
update, this value is Record Exceptions.

42

Filter Group Available
and
Version
Version

Lightning API Response Bodies

Field

Field
A field's metadata.
Property Name

Type

Description

Filter Group and Available
Version
Version

apiName

String

The API name for this field.

Small, 39.0

39.0

calculated

Boolean

Indicates whether the field is a custom Small, 39.0
formula field.

39.0

compound

Boolean

Indicates whether the field is a top-level Small, 39.0
compound field.

39.0

If the dataType is Location, this
value is usually false.
controllerName

String

The name of the field that controls the
values of this picklist.

Small, 39.0

39.0

createable

Boolean

Indicates whether the field can be
created.

Small, 39.0

39.0

custom

Boolean

Indicates whether the field is custom.

Small, 39.0

39.0

dataType

String

Field type. One of these values:

Small, 39.0

39.0

•

Address

• Base64
• Boolean
• ComplexValue—Complex Value
Type (CVT).
• Currency
• Date
• DateTime
• Double
• Email
• EncryptedString
• Int
• Location
• MultiPicklist
• Percent
• Phone
• Picklist
• Reference
• String
• TextArea
• Time

43

Lightning API Response Bodies

Property Name

Field

Type

Description

Filter Group and Available
Version
Version

• Url
extraTypeInfo

String

More data type information. One of
these values:
•

Small, 39.0

39.0

ExternalLookup—External

lookup
• ImageUrl—Image url
• IndirectLookup—Indirect
lookup
• PersonName—Person name
• PlainTextArea—Plain text
area
• RichTextArea—Rich text area
• SwitchablePersonName—Switchable
person name
filterable

Boolean

Indicates whether the field is filterable. Small, 39.0
If true, then this field can be specified in
the WHERE clause of a SOQL statement.

39.0

filteredLookupInfo

Filtered Lookup
Info

If the field is a reference field type with Small, 39.0
a lookup filter, this value contains the
lookup information.

39.0

highScaleNumber

Boolean

Indicates whether the field stores
Small, 39.0
numbers to 8 decimal places regardless
of what's specified in the field details.

39.0

htmlFormatted

Boolean

Indicates whether the field has been
formatted for HTML and should be
encoded for display in HTML. Also
indicates whether a field is a custom
formula field that has an IMAGE text
function.

Small, 39.0

39.0

label

String

Text label that is displayed next to the Small, 39.0
field in the Salesforce user interface. This
label may be localized.

39.0

length

Integer

For string fields, the maximum size of
the field in number of Unicode
characters (not bytes).

Small, 39.0

39.0

nameField

Boolean

Indicates whether the field is a name
field.

Small, 39.0

39.0

44

Lightning API Response Bodies

Field Layout Component

Property Name

Type

Description

picklistValuesUrls

Map

A mapping of record type IDs to API
Small, 39.0
URLs to use to get picklist values for this
field in the context of a record type.

39.0

precision

Integer

For double fields, indicates the
Small, 39.0
maximum number of digits that can be
stored, on both sides of the decimal
point.

39.0

reference

Boolean

Indicates whether the field is a foreign
key reference to another record.

39.0

referenceTargetField String

Filter Group and Available
Version
Version

Small, 39.0

For indirect lookup relationships on
Medium, 39.0
external objects, the target custom field
of the referenced object.

39.0

referenceToInfos

Reference To Info[] For fields that refer to other objects, this Small, 39.0
list includes information about the
object types and name fields of the
referenced objects.

39.0

relationshipName

String

The name of the relationship, if this
relationship is a master-detail
relationship field.

Small, 39.0

39.0

required

Boolean

Indicates whether the field is required
on create or update.

Small, 39.0

39.0

scale

Integer

For double fields, indicates the number Small, 39.0
of digits to the right of the decimal point.

39.0

sortable

Boolean

Indicates whether a query can sort on
this field.

Small, 39.0

39.0

updateable

Boolean

Indicates whether the field can be
updated.

Small, 39.0

39.0

Field Layout Component
A field in a record layout.
Property Name

Type

Description

Filter Group and
Version

Available Version

componentType String

The value is Field.

Small, 39.0

39.0

label

String

The label of the field.

Small, 39.0

39.0

value

String

The API name of the field.

Small, 39.0

39.0

45

Lightning API Response Bodies

Field Value

Field Value
The raw and displayable field values for a field in a record.
Property Name

Type

Description

Filter Group and
Version

Available Version

displayValue

String

The displayable value for a field. For a date, Small, 39.0
this value is familiar to users rather than an
ISO 8601 formatted date value, which is the
raw form. Currency values are also formatted
for display. If data can be localized to the
context user's language using the
toLabel() function, that value is also
displayed here.

39.0

value

Object

The value of a field in its raw data form.

Small, 39.0

39.0

Description

Filter Group and
Version

Available Version

A collection of controlling fields when the
lookup filter is dependent on the source
object.

Small, 39.0

39.0

Boolean

Indicates whether the lookup filter is
dependent on the source object.

Small, 39.0

39.0

optionalFilter Boolean

Indicates whether the lookup filter is
optional.

Small, 39.0

39.0

Filter Group and
Version

Available Version

Filtered Lookup Info
Metadata for a lookup filter.
Property Name

Type

controllingFields String[]

dependent

Lead Status Picklist Value Attributes
Additional picklist value attributes for lead statuses.
Property Name

Type

Description

converted

Boolean

If this status indicates the lead has been
Small, 39.0
converted, the value is true, otherwise
false. For more info, see the
documentation for the LeadStatus standard
object.

46

39.0

Lightning API Response Bodies

Property Name

Location Field

Type

Description

picklistAttributesValueType String

Filter Group and
Version

Available Version

The value is LeadStatus. Indicates that Small, 39.0
these value attributes are associated with
the status of a Lead.

39.0

Available Version

Location Field
A complex location value for a record field.
Property Name

Type

Description

Filter Group and
Version

latitude

Double

Gets the latitude of the location. This value Small, 39.0
maybe null if both latitude and longitude
are null.

39.0

longitude

Double

Gets the longitude of the location. This value Small, 39.0
maybe null if both latitude and longitude
are null.

39.0

Opportunity Stage Picklist Value Attributes
Additional picklist value attributes for opportunity stages.
Property Name

Type

Description

closed

Boolean

Indicates whether this opportunity stage Small, 39.0
value represents a closed opportunity.
Multiple opportunity stage values can
represent a closed opportunity. For more
info, see the doc for the
OpportunityStage standard object.

39.0

defaultProbability

Double

The default percentage estimate of the Small, 39.0
confidence in closing a specific
opportunity for this opportunity stage
value. May be null if forecasting is not
enabled for the org. For more info, see
the doc for the OpportunityStage
standard object.

39.0

The default forecast category value for Small, 39.0
this opportunity stage value. May be
null if forecasting is not enabled for
the org. For more info, see the doc for
the OpportunityStage standard object.

39.0

forecastCategoryName String

47

Filter Group and Available
Version
Version

Lightning API Response Bodies

Property Name

Picklist Value

Type

picklistAttributesValueType String

Boolean

won

Description

Filter Group and Available
Version
Version

The value is OpportunityStage. Small, 39.0
Indicates that these value attributes are
associated with the status of a
Opportunity.

39.0

Indicates whether this opportunity stage Small, 39.0
value represents a won opportunity.
Multiple opportunity stage values can
represent a won opportunity. For more
info, see the documentation for the
OpportunityStage standard object.

39.0

Picklist Value
A single picklist value.
Property Name

Type

Description

Filter Group and
Version

attributes

Either null or one For most picklist value types, this property Medium, 39.0
is null.
of these response
bodies:
If the picklist value is a lead status or an
opportunity stage, this value contains more
• Lead Status
Picklist Value
attributes to help consumers understand
Attributes
the meaning of the value.

Available Version
39.0

• Opportunity
Stage Picklist
Value Attributes
label

String

The displayable value of the picklist to use Small, 39.0
in a UI.

39.0

validFor

Integer[]

If the picklist is a dependent picklist, the
Small, 39.0
property contains a list of the controlling
value indexes for which this value is valid. If
the picklist is an independent picklist, the
list is empty.

39.0

value

String

The value of the picklist to use in the API.

39.0

Record Exceptions
A collection of record exception errors.

48

Small, 39.0

Lightning API Response Bodies

Record Exception Error

Property Name

Type

Description

Filter Group and
Version

Available Version

errors

Record Exception
Error []

General errors.

Small, 39.0

39.0

fieldErrors

Map

Small, 39.0

39.0

Filter Group and
Version

Available Version

Record Exception Error
Informaiton about a record exception error.
Property Name

Type

Description

field

String

A field API name. If no field applies, value is Small, 39.0
null.

39.0

fieldLabel

String

A field label. If no field applies, value is
null.

Small, 39.0

39.0

message

String

An error message

Small, 39.0

39.0

statusCode

String

An error status code

Small, 39.0

39.0

Description

Filter Group and
Version

Available Version

One of these values:

Small, 39.0

39.0

Small, 39.0

39.0

Record Layout Component
A concrete record layout component.
Property Name

Type

componentType String

• AnalyticsCloud
• Canvas
• CustomLink
• EmptySpace
• ExpandedLookup
• Field
• ReportChart
• Separator
• VisualforcePage
value

String

The value of this component.

49

Lightning API Response Bodies

Record Layout Item

Record Layout Item
An item in a record layout.
Property Name

Type

Description

Filter Group and
Version

Available Version

editableForNew Boolean

Indicates whether the item Small, 39.0
may be edited on create

39.0

editableForUpdate Boolean

Indicates whether the item Small, 39.0
may be edited on update

39.0

The text label for the item Small, 39.0

39.0

layoutComponents Collection of components. Collection A collection of components Small, 39.0

39.0

label

String

can contain any of these components: that make up the item
• Canvas Layout Component
• Custom Link Layout Component
• Field Layout Component
• Record Layout Component
• Report Layout Component
• Visualforce Layout Component
lookupIdApiName String

sortable

The ID field name of a
lookup field.

Boolean

Small, 39.0

39.0

Indicates whether the item Small, 39.0
is sortable

39.0

Record Layout Row
A row in a record layout.
Property Name

Type

Description

Filter Group and
Version

layoutItems

Record Layout Item[] A collection of items in the row, from left to Small, 39.0
right. Might not extend to the last column.

Available Version
39.0

Record Layout Section
A section in a record layout.
Property Name

Type

Description

Filter Group and
Version

Available Version

columns

Integer

The number of columns in the section.

Small, 39.0

39.0

50

Lightning API Response Bodies

Record Type Info

Property Name

Type

Description

Filter Group and
Version

Available Version

heading

String

The heading text for the section.

Small, 39.0

39.0

isCollapsed

Boolean

Indicates whether the section should initially Medium, 39.0
be displayed as collapsed.

layoutRows

Record Layout Row[] A collection of the rows in the section.

Small, 39.0

39.0

rows

Integer

The number of rows in the section.

Small, 39.0

39.0

useHeading

Boolean

Indicates whether the heading text is
expected to be displayed.

Medium, 39.0

39.0

39.0

Record Type Info
Informaiton about a record type.
Property Name

Type

Description

Filter Group and Available
Version
Version

available

Boolean

Indicates whether this record type is
available to the context user when
creating a new record.

Small, 39.0

39.0

defaultRecordTypeMapping Boolean

Indicates whether this is the default
Small, 39.0
record type mapping for the associated
object.

39.0

master

Boolean

Indicates whether this is the master
Small, 39.0
record type. The master record type is
the default record type that’s used when
a record has no custom record type
associated with it.

39.0

name

String

The record type's API name.

Small, 39.0

39.0

recordTypeId

String

The ID of the record type.

Small, 39.0

39.0

Reference To Info
Information about a reference field's referenced types and the name field names of those types.
Property Name

Type

Description

Filter Group and
Version

Available Version

apiName

String

The object API name of a type being
referenced in a relationship.

Small, 39.0

39.0

nameFields

String[]

A collection of names of the name fields for Small, 39.0
this object type. Combined with the

39.0

51

Lightning API Response Bodies

Property Name

Type

Report Layout Component

Description

Filter Group and
Version

Available Version

Filter Group and
Version

Available Version

relationship name, you can determine how
to query this type's name fields, for example,
Parent.Name. Typically there is one
name field per object, except where
FirstName and LastName fields are
used.

Report Layout Component
A report chart component on a record layout page.
Property Name

Type

Description

cacheData

Boolean

Indicates whether to cache data (true) or Small, 39.0
not (false).

39.0

The value is ReportChart.

Small, 39.0

39.0

componentType String
error

String

An error message.

Small, 39.0

39.0

filter

String

A filter for the report.

Small, 39.0

39.0

hideOnError

Boolean

Indicates whether to hide the component
when there's an error (true) or not
(false).

Small, 39.0

39.0

placeholder

String

A placeholder for the report.

Small, 39.0

39.0

reportId

String

The component's report ID.

Small, 39.0

39.0

showTitle

Boolean

Indicates whether to show the title of the
report (true) or not (false).

Small, 39.0

39.0

size

String

The size of the component.

Small, 39.0

39.0

value

String

The value of the component.

Small, 39.0

39.0

Theme Info
Color and icon information for a theme.
Property Name

Type

Description

Filter Group and
Version

Available Version

color

String

Color

Small, 39.0

39.0

iconUrl

String

Icon URL

Small, 39.0

39.0

52

Lightning API Response Bodies

Visualforce Layout Component

Visualforce Layout Component
A Visualforce component on a record layout page.
Property Name

Type

componentType String

Description

Filter Group and
Version

Available Version

The value is VisualforcePage.

Small, 39.0

39.0

height

String

The height of the component.

Small, 39.0

39.0

showLabel

Boolean

Indicates whether to show the section label Small, 39.0
with this Visualforce component (true) or
not (false).

39.0

showScroll

Boolean

Indicates whether to show the scroll bar on Small, 39.0
the canvas component (true) or not
(false).

39.0

value

String

The value of this component.

Small, 39.0

39.0

The Visualforce URL.

Small, 39.0

39.0

The width of the component.

Small, 39.0

39.0

visualforceUrl String
width

String

53

INDEX
Record Layout Item 50
Record Layout Row 50
Record Layout Section 50
Record Type Info 51
Record UI 37
Record UI, Get 11
Records, Batch Get 19
Records, Get 16
Records, Post 21
Reference To Info 51
Report Layout Component 52
Request bodies
Record Input 30
Resources
clone record defaults 26
create record defaults 27
error responses 8
object layout, get 13
object metadata, get 15
picklist values, get 28
record UI, get 11
records, batch get 19
records, get 16
records, post 21
Response bodies
Batch Result Item 39
Batch Results 33
Canvas Layout Component 40
Custom Link Layout Component 41
Error Message 42
Error with Output 42
Field 43
Field Layout Component 45
Field Value 46
Filtered Lookup Info 46
Lead Status Picklist Value Attributes 46
Location Field 47
Object Info 33
Opportunity Stage Picklist Value Attributes 47
Picklist Value 48
Picklist Values 34
Record 35
Record Defaults 36
Record Exception 48
Record Exception Error 49
Record Layout 36

B
Batch Result Item 39
Batch Results 33

C
Canvas Layout Component 40
Clone Record Defaults 26
Create Record Defaults 27
Custom Link Layout Component 41

E
Error Message 42
Error responses 8
Error with Output response body 42

F
Field 43
Field Layout Component Representation 45
Field Value 46
Filtered Lookup Info 46

L
Lead Status Picklist Value Attributes 46
Lightning API quick start 3
Location Field 47

O
Object Info 33
Object Layout, Get. 13
Object Metadata, Get 15
Opportunity Stage Picklist Value Attributes 47

P
Picklist Value 48
Picklist Values 34
Picklist Values, Get 28

R
Record 35
Record Defaults 36
Record Exception 48
Record Exception Error 49
Record Input 30
Record Layout 36
Record Layout Component 49

54

Index

Response bodies (continued)
Record Layout Component 49
Record Layout Item 50
Record Layout Row 50
Record Layout Section 50
Record Type Info 51
Record UI 37
Reference To Info 51
Report Layout Component 52

Response bodies (continued)
Theme Info 52
Visualforce Layout Component 53

T
Theme Info 52

V
Visualforce Layout Component 53

55



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.4
Linearized                      : Yes
Create Date                     : 2017:03:11 05:19:35Z
Author                          : salesforce.com, inc.
Date Time Generated             : 2017-03-10T21:19:30.952-08:00
Trapped                         : False
DRC                             : 206.14
Modify Date                     : 2017:03:11 05:19:35Z
Format                          : application/pdf
Title                           : Lightning API Developer Guide
Creator                         : salesforce.com, inc.
Producer                        : XEP 4.20 build 20120720
Creator Tool                    : Unknown
Page Count                      : 59
Page Mode                       : UseOutlines
EXIF Metadata provided by EXIF.tools

Navigation menu