Getting the organization name from the Force.com Identity Service?

salesforce

Solution

I think you are referring to the Organization object. It has an attribute called Name. From this doc: Organization.Name: The name of the organization

You can do a REST call to get this information. From this doc

curl https://na1.salesforce.com/services/data/v27.0/sobjects/Organization/00D50000000IZ3ZEAW?fields=Name -H "Authorization: Bearer token"

Edit: Corrected spelling of "Organization".

Problem

Using OAuth2 and REST with a custom created Remote APP, I can successfully get the user info from the Force.com Identity Service, however it only returns the Organization ID, not the Organization Name. This is an example packet similar to the one I get: ``` { "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" } ``` How can I send a query (possibly SOQL) with the Organization ID to get the Organization Name? I would like to get back a JSON response with data outlined in this data format. I am using CURL through PHP to get this far.

Original source