Newer Version Available

This content describes an older version of this product. View Latest

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 Record UI resource, /ui-api/record-ui/{recordIds}. This resource returns all the information necessary 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:
    1. Click queries | SOQL Query.
    2. Select an object, such as Account, select the Id field, and click Query.
    3. 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 /ui-api/record-ui/{recordIds}. Substitute the record ID from your SOQL query.
    Here's an example request:
    1GET /ui-api/record-ui/001R0000003GeJ1IAK
    Use request parameters to specify the form factor (Large, Medium, Small), layout type (Compact, Full), and access mode (Create, Edit, View) of the record (or records). This example uses the default values, which are Large form factor, Full layout, and View mode.
The response includes 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 1 record ID.
  • layoutUserStates—A map of layout user state IDs to user state information for each layout section
  • layouts—A map of object API names to user type 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   "layoutUserStates":{
3      "00hR0000000NurZIAS":{
4         "id":"00hR0000000NurZIAS",
5         "sectionUserStates":{
6            "01BR0000000UjAhMAK":{
7               "collapsed":false,
8               "id":"01BR0000000UjAhMAK"
9            },
10            "01BR0000000UjAmMAK":{
11               "collapsed":false,
12               "id":"01BR0000000UjAmMAK"
13            }
14         }
15      }
16   },
17   "layouts":{
18      "Account":{
19         "012000000000000AAA":{
20            "Full":{
21               "View":{
22                  "id":"00hR0000000NurZIAS",
23                  "layoutType":"Full",
24                  "mode":"View",
25                  "sections":[
26                     {
27                        "collapsible":false,
28                        "columns":2,
29                        "heading":"Account Information",
30                        "id":"01BR0000000UjAhMAK",
31                        "layoutRows":[
32                           {
33                              "layoutItems":[
34                                 {
35                                    "editableForNew":false,
36                                    "editableForUpdate":false,
37                                    "label":"Account Owner",
38                                    "layoutComponents":[
39                                       {
40                                          "apiName":"OwnerId",
41                                          "componentType":"Field",
42                                          "label":"Owner ID"
43                                       }
44                                    ],
45                                    "lookupIdApiName":"OwnerId",
46                                    "required":false,
47                                    "sortable":false
48                                 },
49                                 {
50                                    "editableForNew":true,
51                                    "editableForUpdate":true,
52                                    "label":"Phone",
53                                    "layoutComponents":[
54                                       {
55                                          "apiName":"Phone",
56                                          "componentType":"Field",
57                                          "label":"Account Phone"
58                                       }
59                                    ],
60                                    "lookupIdApiName":null,
61                                    "required":false,
62                                    "sortable":false
63                                 }
64                              ]
65                           },
66                           {
67                              "layoutItems":[
68                                 {
69                                    "editableForNew":true,
70                                    "editableForUpdate":true,
71                                    "label":"Account Name",
72                                    "layoutComponents":[
73                                       {
74                                          "apiName":"Name",
75                                          "componentType":"Field",
76                                          "label":"Account Name"
77                                       }
78                                    ],
79                                    "lookupIdApiName":"Id",
80                                    "required":true,
81                                    "sortable":false
82                                 },
83                                 {
84                                    "editableForNew":true,
85                                    "editableForUpdate":true,
86                                    "label":"Fax",
87                                    "layoutComponents":[
88                                       {
89                                          "apiName":"Fax",
90                                          "componentType":"Field",
91                                          "label":"Account Fax"
92                                       }
93                                    ],
94                                    "lookupIdApiName":null,
95                                    "required":false,
96                                    "sortable":false
97                                 }
98                              ]
99                           },
100                           {
101                              "layoutItems":[
102                                 {
103                                    "editableForNew":true,
104                                    "editableForUpdate":true,
105                                    "label":"Parent Account",
106                                    "layoutComponents":[
107                                       {
108                                          "apiName":"ParentId",
109                                          "componentType":"Field",
110                                          "label":"Parent Account ID"
111                                       }
112                                    ],
113                                    "lookupIdApiName":"ParentId",
114                                    "required":false,
115                                    "sortable":false
116                                 },
117                                 {
118                                    "editableForNew":true,
119                                    "editableForUpdate":true,
120                                    "label":"Website",
121                                    "layoutComponents":[
122                                       {
123                                          "apiName":"Website",
124                                          "componentType":"Field",
125                                          "label":"Website"
126                                       }
127                                    ],
128                                    "lookupIdApiName":null,
129                                    "required":false,
130                                    "sortable":false
131                                 }
132                              ]
133                           }
134                        ],
135                        "rows":3,
136                        "useHeading":false
137                     },
138                     ... sections removed for space ...
139                     {
140                        "collapsible":true,
141                        "columns":3,
142                        "heading":"Custom Links",
143                        "id":"01BR0000000UjAmMAK",
144                        "layoutRows":[
145                           {
146                              "layoutItems":[
147                                 {
148                                    "editableForNew":false,
149                                    "editableForUpdate":false,
150                                    "label":"",
151                                    "layoutComponents":[
152                                       {
153                                          "apiName":"GoogleSearch",
154                                          "behavior":"NewWindow",
155                                          "componentType":"CustomLink",
156                                          "customLinkUrl":"/servlet/servlet.Integration?lid=00bR0000000ICHb&eid=ENTITY_ID&ic=1",
157                                          "label":"Google Search"
158                                       }
159                                    ],
160                                    "lookupIdApiName":null,
161                                    "required":false,
162                                    "sortable":false
163                                 },
164                                 {
165                                    "editableForNew":false,
166                                    "editableForUpdate":false,
167                                    "label":"",
168                                    "layoutComponents":[
169                                       {
170                                          "apiName":"GoogleNews",
171                                          "behavior":"NewWindow",
172                                          "componentType":"CustomLink",
173                                          "customLinkUrl":"/servlet/servlet.Integration?lid=00bR0000000ICHa&eid=ENTITY_ID&ic=1",
174                                          "label":"Google News"
175                                       }
176                                    ],
177                                    "lookupIdApiName":null,
178                                    "required":false,
179                                    "sortable":false
180                                 }
181                              ]
182                           },
183                           {
184                              "layoutItems":[
185                                 {
186                                    "editableForNew":false,
187                                    "editableForUpdate":false,
188                                    "label":"",
189                                    "layoutComponents":[
190                                       {
191                                          "apiName":"HooversProfile",
192                                          "behavior":"NewWindow",
193                                          "componentType":"CustomLink",
194                                          "customLinkUrl":"/servlet/servlet.Integration?lid=00bR0000000ICHc&eid=ENTITY_ID&ic=1",
195                                          "label":"Hoovers Profile"
196                                       }
197                                    ],
198                                    "lookupIdApiName":null,
199                                    "required":false,
200                                    "sortable":false
201                                 },
202                                 {
203                                    "editableForNew":false,
204                                    "editableForUpdate":false,
205                                    "label":"",
206                                    "layoutComponents":[
207                                       {
208                                          "apiName":null,
209                                          "componentType":"EmptySpace"
210                                       }
211                                    ],
212                                    "lookupIdApiName":null,
213                                    "required":false,
214                                    "sortable":false
215                                 }
216                              ]
217                           }
218                        ],
219                        "rows":2,
220                        "useHeading":true
221                     }
222                  ]
223               }
224            }
225         }
226      }
227   },
228   "objectInfos":{
229      "Account":{
230         "apiName":"Account",
231         "childRelationships":[
232            {
233               "childObjectApiName":"Account",
234               "fieldName":"ParentId",
235               "junctionIdListNames":[
236
237               ],
238               "junctionReferenceTo":[
239
240               ],
241               "relationshipName":"ChildAccounts"
242            },
243             ... some child relationships removed for space ...
244            {
245               "childObjectApiName":"WorkOrder",
246               "fieldName":"AccountId",
247               "junctionIdListNames":[
248
249               ],
250               "junctionReferenceTo":[
251
252               ],
253               "relationshipName":"WorkOrders"
254            }
255         ],
256         "createable":true,
257         "custom":false,
258         "defaultRecordTypeId":null,
259         "deleteable":true,
260         "feedEnabled":true,
261         "fields":{
262            "AccountSource":{
263               "apiName":"AccountSource",
264               "calculated":false,
265               "compound":false,
266               "compoundComponentName":null,
267               "compoundFieldName":null,
268               "controllerName":null,
269               "createable":true,
270               "custom":false,
271               "dataType":"Picklist",
272               "extraTypeInfo":null,
273               "filterable":true,
274               "filteredLookupInfo":null,
275               "highScaleNumber":false,
276               "htmlFormatted":false,
277               "inlineHelpText":null,
278               "label":"Account Source",
279               "length":40,
280               "nameField":false,
281               "polymorphicForeignKey":false,
282               "precision":0,
283               "reference":false,
284               "referenceTargetField":null,
285               "referenceToInfos":[
286
287               ],
288               "relationshipName":null,
289               "required":false,
290               "scale":0,
291               "searchPrefilterable":false,
292               "sortable":true,
293               "unique":false,
294               "updateable":true
295            },
296            ... some field info removed for space ...
297            "Website":{
298               "apiName":"Website",
299               "calculated":false,
300               "compound":false,
301               "compoundComponentName":null,
302               "compoundFieldName":null,
303               "controllerName":null,
304               "createable":true,
305               "custom":false,
306               "dataType":"Url",
307               "extraTypeInfo":null,
308               "filterable":true,
309               "filteredLookupInfo":null,
310               "highScaleNumber":false,
311               "htmlFormatted":false,
312               "inlineHelpText":null,
313               "label":"Website",
314               "length":255,
315               "nameField":false,
316               "polymorphicForeignKey":false,
317               "precision":0,
318               "reference":false,
319               "referenceTargetField":null,
320               "referenceToInfos":[
321
322               ],
323               "relationshipName":null,
324               "required":false,
325               "scale":0,
326               "searchPrefilterable":false,
327               "sortable":true,
328               "unique":false,
329               "updateable":true
330            }
331         },
332         "keyPrefix":"001",
333         "label":"Account",
334         "labelPlural":"Accounts",
335         "layoutable":true,
336         "mruEnabled":true,
337         "nameFields":[
338            "Name"
339         ],
340         "queryable":true,
341         "recordTypeInfos":{
342            "012000000000000AAA":{
343               "available":true,
344               "defaultRecordTypeMapping":true,
345               "master":true,
346               "name":"Master",
347               "recordTypeId":"012000000000000AAA"
348            }
349         },
350         "searchable":true,
351         "themeInfo":{
352            "color":"7F8DE1",
353            "iconUrl":"https://na7.salesforce.com/img/icon/t4v35/standard/account_120.png"
354         },
355         "updateable":true
356      },
357      "User":{
358         "apiName":"User",
359         "childRelationships":[
360            {
361               "childObjectApiName":"AcceptedEventRelation",
362               "fieldName":"RelationId",
363               "junctionIdListNames":[
364
365               ],
366               "junctionReferenceTo":[
367
368               ],
369               "relationshipName":"AcceptedEventRelations"
370            },
371            ... some child relationships removed for space ...
372            {
373               "childObjectApiName":"WorkThanks",
374               "fieldName":"GiverId",
375               "junctionIdListNames":[
376
377               ],
378               "junctionReferenceTo":[
379
380               ],
381               "relationshipName":"GivenThanks"
382            }
383         ],
384         "createable":true,
385         "custom":false,
386         "defaultRecordTypeId":null,
387         "deleteable":false,
388         "feedEnabled":true,
389         "fields":{
390            "AboutMe":{
391               "apiName":"AboutMe",
392               "calculated":false,
393               "compound":false,
394               "compoundComponentName":null,
395               "compoundFieldName":null,
396               "controllerName":null,
397               "createable":true,
398               "custom":false,
399               "dataType":"TextArea",
400               "extraTypeInfo":"PlainTextArea",
401               "filterable":true,
402               "filteredLookupInfo":null,
403               "highScaleNumber":false,
404               "htmlFormatted":false,
405               "inlineHelpText":null,
406               "label":"About Me",
407               "length":1000,
408               "nameField":false,
409               "polymorphicForeignKey":false,
410               "precision":0,
411               "reference":false,
412               "referenceTargetField":null,
413               "referenceToInfos":[
414
415               ],
416               "relationshipName":null,
417               "required":false,
418               "scale":0,
419               "searchPrefilterable":false,
420               "sortable":true,
421               "unique":false,
422               "updateable":true
423            },
424             ... fields removed for space ...
425            "Username":{
426               "apiName":"Username",
427               "calculated":false,
428               "compound":false,
429               "compoundComponentName":null,
430               "compoundFieldName":null,
431               "controllerName":null,
432               "createable":true,
433               "custom":false,
434               "dataType":"String",
435               "extraTypeInfo":null,
436               "filterable":true,
437               "filteredLookupInfo":null,
438               "highScaleNumber":false,
439               "htmlFormatted":false,
440               "inlineHelpText":null,
441               "label":"Username",
442               "length":80,
443               "nameField":false,
444               "polymorphicForeignKey":false,
445               "precision":0,
446               "reference":false,
447               "referenceTargetField":null,
448               "referenceToInfos":[
449
450               ],
451               "relationshipName":null,
452               "required":true,
453               "scale":0,
454               "searchPrefilterable":false,
455               "sortable":true,
456               "unique":false,
457               "updateable":true
458            }
459         },
460         "keyPrefix":"005",
461         "label":"User",
462         "labelPlural":"People",
463         "layoutable":true,
464         "mruEnabled":true,
465         "nameFields":[
466            "FirstName",
467            "LastName",
468            "Name"
469         ],
470         "queryable":true,
471         "recordTypeInfos":{
472
473         },
474         "searchable":true,
475         "themeInfo":{
476            "color":"65CAE4",
477            "iconUrl":"https://na7.salesforce.com/img/icon/t4v35/standard/user_120.png"
478         },
479         "updateable":true
480      }
481   },
482   "records":{
483      "001R0000003ILXdIAO":{
484         "apiName":"Account",
485         "childRelationships":{
486
487         },
488         "fields":{
489            "AnnualRevenue":{
490               "displayValue":null,
491               "value":null
492            },
493             ... fields removed for space ...
494            "Website":{
495               "displayValue":null,
496               "value":null
497            }
498         },
499         "id":"001R0000003ILXdIAO",
500         "recordTypeInfo":null
501      }
502   }
503}