将OAuth2和REST与自定义创建的远程APP一起使用,我可以成功从Force.com Identity Service获取用户信息,但它只返回组织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)以获取组织名称?我想使用this data format中列出的数据回复JSON响应。
我通过PHP使用CURL来实现这一目标。
答案 0 :(得分:5)
我认为你指的是组织对象。它有一个名为Name的属性。 From this doc: Organization.Name:组织的名称
您可以执行REST调用以获取此信息。 From this doc
curl https://na1.salesforce.com/services/data/v27.0/sobjects/Organization/00D50000000IZ3ZEAW?fields=Name -H“授权:承载令牌”
编辑:更正了“组织”的拼写。