Salesforce 集成篇零基础学习(一)Connected App
salesforce 零基础学习(三十三)通过REST方式访问外部数据以及JAVA通过rest方式访问salesforce
Pre:创建 Connected App
一. Postman的安装和配置
https://www.postman.com/downloads/ 来下载 Postman并且安装。
二. Postman模拟执行rest api的使用
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_create.htm
@RestResource(urlMapping='/account/*' global with sharing class AccountCreationService { @HttpGet global static Account doGet( { RestRequest req = RestContext.request; RestResponse res = RestContext.response; String accountId = req.requestURI.substring(req.requestURI.lastIndexOf('/'+1; Account result = [SELECT Id, Name, Phone, Website FROM Account WHERE Id = :accountId]; return result; } }
我们Authorization和上面的demo配置方式相同,自定义api的URL调用方式为 /services/apexrest/[xxx],其中xxx为类中声明的urlMapping信息。
总结:篇中介绍了 postman调用标准 rest api以及自定义rest api的前置条件,准备内容和调用方式。篇中有错误地方欢迎指出,有不懂欢迎留言。