Newer Version Available
User Interface 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 User Interface APIs, the Record UI resource, /ui-api/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.
- Go to the Workbench API utility.
- Log in to your DE org.
-
The Record UI resource requires a record ID. To grab one:
- Click .
- Select an object, such as Account, select the Id field, and click Query.
- 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.
- Select .
-
Make a GET request to /ui-api/record-ui/{recordIds}.
Substitute the record ID from your SOQL query.
Here's a sample request:
1GET /ui-api/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, /ui-api/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
1{
2 "layouts" : {
3 "Account" : {
4 "012000000000000AAA" : {
5 "Full" : {
6 "View" : {
7 "id" : "00hR0000000NisVIAS",
8 "layoutType" : "Full",
9 "mode" : "View",
10 "sections" : [ {
11 "columns" : 2,
12 "heading" : "Account Information",
13 "isCollapsed" : false,
14 "layoutRows" : [ {
15 "layoutItems" : [ {
16 "editableForNew" : false,
17 "editableForUpdate" : false,
18 "label" : "Account Owner",
19 "layoutComponents" : [ {
20 "componentType" : "Field",
21 "label" : "Owner ID",
22 "value" : "OwnerId"
23 } ],
24 "lookupIdApiName" : "OwnerId",
25 "sortable" : false
26 }, {
27 "editableForNew" : true,
28 "editableForUpdate" : true,
29 "label" : "Phone",
30 "layoutComponents" : [ {
31 "componentType" : "Field",
32 "label" : "Account Phone",
33 "value" : "Phone"
34 } ],
35 "lookupIdApiName" : null,
36 "sortable" : false
37 } ]
38 }, {
39 "layoutItems" : [ {
40 "editableForNew" : true,
41 "editableForUpdate" : true,
42 "label" : "Account Name",
43 "layoutComponents" : [ {
44 "componentType" : "Field",
45 "label" : "Account Name",
46 "value" : "Name"
47 } ],
48 "lookupIdApiName" : "Id",
49 "sortable" : false
50 }, {
51 "editableForNew" : true,
52 "editableForUpdate" : true,
53 "label" : "Fax",
54 "layoutComponents" : [ {
55 "componentType" : "Field",
56 "label" : "Account Fax",
57 "value" : "Fax"
58 } ],
59 "lookupIdApiName" : null,
60 "sortable" : false
61 } ]
62 }, {
63 "layoutItems" : [ {
64 "editableForNew" : true,
65 "editableForUpdate" : true,
66 "label" : "Parent Account",
67 "layoutComponents" : [ {
68 "componentType" : "Field",
69 "label" : "Parent Account ID",
70 "value" : "ParentId"
71 } ],
72 "lookupIdApiName" : "ParentId",
73 "sortable" : false
74 }, {
75 "editableForNew" : true,
76 "editableForUpdate" : true,
77 "label" : "Website",
78 "layoutComponents" : [ {
79 "componentType" : "Field",
80 "label" : "Website",
81 "value" : "Website"
82 } ],
83 "lookupIdApiName" : null,
84 "sortable" : false
85 } ]
86 }, {
87 "layoutItems" : [ {
88 "editableForNew" : true,
89 "editableForUpdate" : true,
90 "label" : "Contact",
91 "layoutComponents" : [ {
92 "componentType" : "Field",
93 "label" : "Contact",
94 "value" : "Contact__c"
95 } ],
96 "lookupIdApiName" : "Id",
97 "sortable" : false
98 } ]
99 } ],
100 "rows" : 4,
101 "useHeading" : false
102 }
103
104 ... additional section info removed to save save space ...
105
106 ]
107 }
108 }
109 }
110 }
111 },
112 "objectInfos" : {
113 "Account" : {
114 "apiName" : "Account",
115 "childRelationships" : [ {
116 "childObjectApiName" : "Account",
117 "fieldName" : "ParentId",
118 "junctionIdListNames" : [ ],
119 "junctionReferenceTo" : [ ],
120 "relationshipName" : "ChildAccounts"
121 }, {
122 "childObjectApiName" : "AccountContactRole",
123 "fieldName" : "AccountId",
124 "junctionIdListNames" : [ ],
125 "junctionReferenceTo" : [ ],
126 "relationshipName" : "AccountContactRoles"
127 }
128
129 ... additional child relationships removed to save space ...
130
131 ],
132 "createable" : true,
133 "custom" : false,
134 "defaultRecordTypeId" : null,
135 "deleteable" : true,
136 "feedEnabled" : true,
137 "fields" : {
138 "AnnualRevenue" : {
139 "apiName" : "AnnualRevenue",
140 "calculated" : false,
141 "compound" : false,
142 "controllerName" : null,
143 "createable" : true,
144 "custom" : false,
145 "dataType" : "Currency",
146 "extraTypeInfo" : null,
147 "filterable" : true,
148 "filteredLookupInfo" : null,
149 "highScaleNumber" : false,
150 "htmlFormatted" : false,
151 "label" : "Annual Revenue",
152 "length" : 0,
153 "nameField" : false,
154 "picklistValuesUrls" : { },
155 "precision" : 18,
156 "reference" : false,
157 "referenceTargetField" : null,
158 "referenceToInfos" : [ ],
159 "relationshipName" : null,
160 "required" : false,
161 "scale" : 0,
162 "sortable" : true,
163 "updateable" : true
164 },
165 "BillingCity" : {
166 "apiName" : "BillingCity",
167 "calculated" : false,
168 "compound" : false,
169 "controllerName" : null,
170 "createable" : true,
171 "custom" : false,
172 "dataType" : "String",
173 "extraTypeInfo" : null,
174 "filterable" : true,
175 "filteredLookupInfo" : null,
176 "highScaleNumber" : false,
177 "htmlFormatted" : false,
178 "label" : "Billing City",
179 "length" : 40,
180 "nameField" : false,
181 "picklistValuesUrls" : { },
182 "precision" : 0,
183 "reference" : false,
184 "referenceTargetField" : null,
185 "referenceToInfos" : [ ],
186 "relationshipName" : null,
187 "required" : false,
188 "scale" : 0,
189 "sortable" : true,
190 "updateable" : true
191 }
192
193 ... additional field info removed to save space ...
194
195 },
196 "keyPrefix" : "001",
197 "label" : "Account",
198 "labelPlural" : "Accounts",
199 "layoutable" : true,
200 "mruEnabled" : true,
201 "nameFields" : [ "Name" ],
202 "queryable" : true,
203 "recordTypeInfos" : {
204 "012000000000000AAA" : {
205 "available" : true,
206 "defaultRecordTypeMapping" : true,
207 "master" : true,
208 "name" : "Master",
209 "recordTypeId" : "012000000000000AAA"
210 }
211 },
212 "searchable" : true,
213 "themeInfo" : {
214 "color" : "7F8DE1",
215 "iconUrl" : "https://na7-blitz03.soma.salesforce.com/img/icon/t4v35/standard/account_120.png"
216 },
217 "updateable" : true
218 }
219 },
220 "records" : {
221 "001R0000003I7ObIAK" : {
222 "apiName" : "Account",
223 "fields" : {
224 "AnnualRevenue" : {
225 "displayValue" : null,
226 "value" : null
227 },
228 "BillingCity" : {
229 "displayValue" : null,
230 "value" : "Toronto"
231 },
232 "BillingCountry" : {
233 "displayValue" : null,
234 "value" : "Canada"
235 },
236 "BillingPostalCode" : {
237 "displayValue" : null,
238 "value" : "L4B 1Y3"
239 },
240 "BillingState" : {
241 "displayValue" : null,
242 "value" : "Ontario"
243 },
244 "BillingStreet" : {
245 "displayValue" : null,
246 "value" : "150 Chestnut Street"
247 },
248 "Contact__c" : {
249 "displayValue" : null,
250 "value" : null
251 },
252 "Contact__r" : {
253 "displayValue" : null,
254 "value" : null
255 },
256 "CreatedBy" : {
257 "displayValue" : "Admin User",
258 "value" : {
259 "apiName" : "User",
260 "fields" : {
261 "Id" : {
262 "displayValue" : null,
263 "value" : "005R0000000IXV3IAO"
264 },
265 "Name" : {
266 "displayValue" : null,
267 "value" : "Admin User"
268 }
269 },
270 "id" : "005R0000000IXV3IAO",
271 "recordTypeInfo" : null
272 }
273 },
274 "CreatedById" : {
275 "displayValue" : null,
276 "value" : "005R0000000IXV3IAO"
277 },
278 "CreatedDate" : {
279 "displayValue" : "4/9/2017 6:13 PM",
280 "value" : "2017-04-10T01:13:22.000Z"
281 }
282
283 ... additional record data removed to save space ...
284
285 },
286 "id" : "001R0000003I7ObIAK",
287 "recordTypeInfo" : null
288 }
289 }
290}