User Interface API Developer 1 Get Started with User Interface API EDITIONS Available in: Developer Edition User Interface API enables you to create native mobile apps and custom web

  • View
    239

  • Download
    1

Embed Size (px)

Text of User Interface API Developer 1 Get Started with User Interface API EDITIONS Available in: Developer...

  • User Interface API DeveloperGuide

    Version 40.0, Summer 17

    @salesforcedocsLast updated: August 9, 2017

    https://twitter.com/salesforcedocs

  • Copyright 20002017 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 User Interface API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    Authentication, Versioning, and All That Good Stuff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2User Interface API Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4Status Codes and Error Responses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

    Chapter 2: User Interface API Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

    Record UI, Get . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12Record Layout, Get . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14Object Info, Get . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16Records, Get, Delete, Patch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17Records, Batch Get . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20Records, Post . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22Clone Record Defaults, Get . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27Create Record Defaults, Get . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28Picklist Values, Get . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

    Chapter 3: User Interface API Request Bodies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

    Record Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

    Chapter 4: User Interface API Response Bodies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

    User Interface API Top-Level Response Bodies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33Batch Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33Object Info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34Picklist Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36Record Defaults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36Record Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37Record UI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

    User Interface API Nested Response Bodies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38Batch Result Item . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40Canvas Layout Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41Child Relationship . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42Custom Link Layout Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43Duplicate Record Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44Error Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44Error with Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45Field Layout Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48Field Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

  • Filtered Lookup Info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48Lead Status Picklist Value Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49Location Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49Match Result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49Opportunity Stage Picklist Value Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50Picklist Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51Record Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51Record Exception Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51Record Layout Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52Record Layout Item . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53Record Layout Row . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53Record Layout Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53Record Type Info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54Reference To Info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54Report Layout Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55Theme Info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55Visualforce Layout Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

    Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

    Contents

  • CHAPTER 1 Get Started with User Interface API

    EDITIONS

    Available in: DeveloperEdition

    User Interface API enables you to create native mobile apps and custom web apps with your ownbranding and look and feel. A single REST request returns enough metadata, layout information,and data to display, edit, or create a record.

    Note: User Interface API is available as a Developer Preview in all DE orgs. To use the API inanother type of org, contact Salesforce.

    The User Interface API base URL ishttps://{your_instance}.salesforce.com/services/data/v{api_version}/ui-api.

    Use the resources in the pilot version of User Interface API to display records.

    GET /ui-api/record-ui/{recordIds}

    GET /ui-api/layout/{objectApiName}

    GET /ui-api/object-info/{objectApiName}

    GET /ui-api/object-info/{objectApiName}/picklist-values/{recordTypeId}/{fieldApiName}

    GET /ui-api/records/{recordId}

    PATCH /ui-api/records/{recordId}

    DELETE /ui-api/records/{recordId}

    GET /ui-api/records/batch/{recordIds}

    POST /ui-api/records

    GET /ui-api/record-defaults/clone/{recordId}

    GET /ui-api/record-defaults/create/{apiName}

    The first resource in the list, the Record UI resource, is the top dog of User Interface API. To display a record, your code makes this simplerequest:

    GET /ui-api/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 metadataand data you need to display a record.

    Authentication, Versioning, and All That Good Stuff

    Learn the high-level facts about how to use User Interface API. How do you authenticate? How is the API versioned? What are therate limits? All the information you need, available at a glance.

    User Interface API Quick Start

    The best way to learn an API is to use it. Let's go!

    1

  • Status Codes and Error Responses

    The response header contains an HTTP status code. If the response isnt successful, the response body contains an error message,and if appropriate, information about the field or object where the error occurred.

    Authentication, Versioning, and All That Good Stuff

    Learn the high-level facts about how to use User Interface API. How do you authenticate? How is the API versioned? What are the ratelimits? All the information you need, available at a glance.

    AuthenticationLike other Salesforce REST APIs, User Interface API uses OAuth 2.0.

    VersioningUser Interface API is versioned. Specify the API version number in each request.

    GET https://{your_salesforce_instance}.salesforce.com/services/data/v40.0/ui-api

    Error HandlingThe response header contains an HTTP statu

Recommended

View more >