Access Salesforce Chatter API using curl

Below is the steps to access you Chatter API from curl:

curl --form client_id=YOUR_CLIENT_ID --form client_secret=YOUR_CLIENT_SECRET --form grant_type=password --form username=YOUR_USERNAME --form password=YOUR_PASSWORD_AND_SECURITY_TOKEN https://na1.salesforce.com/services/oauth2/token

Response

{"id":"https://login.salesforce.com/id/00DA0000000ao2FMAQ/005A0000000PhDwIAK","issued_at":"1335402964377","instance_url":"https://na10.salesforce.com","signature":"oEfBNefPqGORVsDg31CLMMookp3e8UmLVsiy+o9YP0A=","access_token":"00DA0000000ao2F!ASAAQLD2bw.7Y3O0hnpiXeUSOhTt9q_j_5XWbQN.gDodHuDQZBmXPBud3z9B60AP6wvLv6AkeeOIXn_Z0RmbenoiWDEjuNFh"}

See Access Token and add to curl command below

 curl -X GET https://na10.salesforce.com/services/data/v24.0/chatter/users/me -H 'Authorization: 00DA0000000ao2F!ASAAQLD2bw.7Y3O0hnpiXeUSOhTt9q_j_5XWbQN.gDodHuDQZBmXPBud3z9B60AP6wvLv6AkeeOIXn_Z0RmbenoiWDEjuNFh'

Note make sure your URL looks the same as your Salesforce URL. Check na* value.

Result

{"address":{"state":"California","country":"USA","street":null,"city":"San Francisco","zip":null},"username":"thysmichels@gmail.com","email":"thysmichels@gmail.com","groupCount":1,"currentStatus":{"url":"/services/data/v24.0/chatter/users/005A0000000PhDwIAK/status","body":{"text":"sadasdasdsadasd","messageSegments":[{"type":"Text","text":"sadasdasdsadasd"}]},"parentId":"005A0000000PhDwIAK"},"managerId":"000000000000000AAA","aboutMe":null,"isActive":true,"followersCount":0,"followingCounts":{"total":28,"records":28,"people":0},"managerName":"","phoneNumbers":[{"type":"Work","number":null},{"type":"Mobile","number":null},{"type":"Fax","number":null}],"chatterActivity":{"commentCount":0,"commentReceivedCount":0,"likeReceivedCount":0,"postCount":10},"chatterInfluence":{"rank":1,"percentile":"0.0"},"name":"John Doe","title":null,"firstName":"John","lastName":"Doe","companyName":"Persistent Systems","mySubscription":null,"photo":{"largePhotoUrl":"https://c.na10.content.force.com/profilephoto/729F00000000621/F","photoVersionId":"729F00000000621IAA","smallPhotoUrl":"https://c.na10.content.force.com/profilephoto/729F00000000621/T"},"isChatterGuest":false,"id":"005A0000000PhDwIAK","url":"/services/data/v24.0/chatter/users/005A0000000PhDwIAK","type":"User"}
About these ads

One Comment on “Access Salesforce Chatter API using curl

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 254 other followers

%d bloggers like this: