3

How do get Company/Work profile of Login User through Salesforce API ?

I get below response for user profile, but It does not include work/company profile in the response.

{
  "id": "https://login.salesforce.com/id/00Dj0000000J9fsEAC/005j0000000ZksaAAC",
  "asserted_user": true,
  "user_id": "005j0000000ZksaAAC",
  "organization_id": "00Dj0000000J9fsEAC",
  "username": "[email protected]",
  "nick_name": "apps1.415785279947391E12",
  "display_name": "hello r",
  "email": "[email protected]",
  "email_verified": true,
  "first_name": "hello",
  "last_name": "hi",
  "timezone": "America/Los_Angeles",
  "photos": {
    "picture": "https://c.na16.content.force.com/profilephoto/005/F",
    "thumbnail": "https://c.na16.content.force.com/profilephoto/005/T"
  },
  "addr_street": "aven apartment",
  "addr_city": "Ahmedabad",
  "addr_state": "Gujarat",
  "addr_country": "India",
  "addr_zip": "380061",
  "mobile_phone": "89034343433",
  "mobile_phone_verified": true,
  "status": {
    "created_date": null,
    "body": null
  },
  "urls": {
    "enterprise": "https://na16.salesforce.com/services/Soap/c/{version}/00Dj0000000J9fs",
    "metadata": "https://na16.salesforce.com/services/Soap/m/{version}/00Dj0000000J9fs",
    "partner": "https://na16.salesforce.com/services/Soap/u/{version}/00Dj0000000J9fs",
    "rest": "https://na16.salesforce.com/services/data/v{version}/",
    "sobjects": "https://na16.salesforce.com/services/data/v{version}/sobjects/",
    "search": "https://na16.salesforce.com/services/data/v{version}/search/",
    "query": "https://na16.salesforce.com/services/data/v{version}/query/",
    "recent": "https://na16.salesforce.com/services/data/v{version}/recent/",
    "profile": "https://na16.salesforce.com/005j0000000ZksaAAC",
    "feeds": "https://na16.salesforce.com/services/data/v{version}/chatter/feeds",
    "groups": "https://na16.salesforce.com/services/data/v{version}/chatter/groups",
    "users": "https://na16.salesforce.com/services/data/v{version}/chatter/users",
    "feed_items": "https://na16.salesforce.com/services/data/v{version}/chatter/feed-items"
  },
  "active": true,
  "user_type": "STANDARD",
  "language": "en_US",
  "locale": "en_US",
  "utcOffset": -28800000,
  "last_modified_date": "2016-01-11T11:35:08.000+0000",
  "is_app_installed": true
}
2
  • What do yo mean by Company/Work? Is it about Account/Contact object or the Organization.
    – Ashwani
    Commented Jan 12, 2016 at 6:08
  • Its about work/company profile of login user in Salesforce. Commented Jan 12, 2016 at 6:31

2 Answers 2

2

Assuming that you have already made successful connection. You can issue a SOQL query using the api like.

The endpoint is (replace {version} with version name, like 35):

https://na16.salesforce.com/services/data/v{version}/query/

Complete endpoint would look like:

https://na16.salesforce.com/services/data/v35/query?q=SELECT id, Account.Name from User WHERE User='id of user' LIMIT 1

Make sure value for the parameter q is URL encoded.

1
  • I want to access from external project, would it possible ? Commented Jan 12, 2016 at 8:04
2

I think you need to query organization object via API to get company name/organization name.

So query Something like this :

https://na16.salesforce.com/services/data/v35/query?q=SELECT id, Name , from Organization LIMIT 1

Let me know if this doesnt works.

4
  • 1
    Organization.Name field available on user object ?
    – Ratan Paul
    Commented Jan 12, 2016 at 7:56
  • 1
    Just updated the answer. Commented Jan 12, 2016 at 8:01
  • I want to access from external project, would it possible to access ? Commented Jan 12, 2016 at 8:04
  • 1
    Yes. It is accessible via api. Commented Jan 12, 2016 at 8:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .