2

将 OAuth2 和 REST 与自定义创建的远程应用程序一起使用,我可以成功地从Force.com 身份服务获取用户信息,但是它只返回组织 ID,而不是组织名称。这是一个类似于我得到的示例数据包:

{
"id":"https://login.salesforce.com/id/00D50000000IZ3ZEAW/00550000001fg5OAAQ",
"asserted_user":true,
"user_id":"00550000001fg5OAAQ",
"organization_id":"00D50000000IZ3ZEAW",
"username":"user@example.com",
"nick_name":"user1.2950476911907334E12",
"display_name":"Sample User",
"email":"user@example.com",
"status":{
    "created_date":"2010-11-08T20:55:33.000+0000",
    "body":"Working on OAuth 2.0 article"
},
"photos":{
    "picture":"https://c.na1.content.force.com/profilephoto/005/F",
    "thumbnail":"https://c.na1.content.force.com/profilephoto/005/T"
},
"urls":{
    "enterprise":"https://na1.salesforce.com/services/Soap/c/{version}/00D50000000IZ3Z",
    "metadata":"https://na1.salesforce.com/services/Soap/m/{version}/00D50000000IZ3Z",
    "partner":"https://na1.salesforce.com/services/Soap/u/{version}/00D50000000IZ3Z",
    "rest":"https://na1.salesforce.com/services/data/v{version}/",
    "sobjects":"https://na1.salesforce.com/services/data/v{version}/sobjects/",
    "search":"https://na1.salesforce.com/services/data/v{version}/search/",
    "query":"https://na1.salesforce.com/services/data/v{version}/query/",
    "recent":"https://na1.salesforce.com/services/data/v{version}/recent/",
    "profile":"https://na1.salesforce.com/00550000001fg5OAAQ"
},
"active":true,
"user_type":"STANDARD",
"language":"en_US",
"locale":"en_US",
"utcOffset":-28800000,
"last_modified_date":"2011-01-14T23:28:01.000+0000"
}

如何发送带有组织 ID 的查询(可能是 SOQL)以获取组织名称?我想用这种数据格式列出的数据返回一个 JSON 响应。

我正在通过 PHP 使用 CURL 来实现这一目标。

4

1 回答 1

6

我认为您指的是组织对象。它有一个名为 Name 的属性。 来自此文档:Organization.Name:组织的名称

您可以进行 REST 调用来获取此信息。 从这个文档

curl https://na1.salesforce.com/services/data/v27.0/sobjects/Organization/00D50000000IZ3ZEAW?fields=Name -H“授权:不记名令牌

编辑:更正了“组织”的拼写。

于 2013-02-22T01:24:41.777 回答