salesforce零基础学习(一百二十四)Postman 使用

科技资讯 投稿 5200 0 评论

salesforce零基础学习(一百二十四)Postman 使用

Salesforce 集成篇零基础学习(一)Connected App

salesforce 零基础学习(三十三)通过REST方式访问外部数据以及JAVA通过rest方式访问salesforce

 Pre:创建 Connected App

一. Postman的安装和配置

https://www.postman.com/downloads/ 来下载 Postman并且安装。

 

二. Postman模拟执行rest api的使用

 https://help.salesforce.com/s/articleView?language=en_US&id=sf.remoteaccess_oauth_username_password_flow.htm&type=5

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的前置条件,准备内容和调用方式。篇中有错误地方欢迎指出,有不懂欢迎留言。

编程笔记 » salesforce零基础学习(一百二十四)Postman 使用

赞同 (26) or 分享 (0)
游客 发表我的评论   换个身份
取消评论

表情
(0)个小伙伴在吐槽