You need to sign in to do that
Don't have an account?
Ramesh R 26
How to create case by rest api using access_token
Hi Friends,
I posted this below url to get access_token and i got access token also
But i want to create case , i dont know how to do this, please guid me with this issue
Note : I am using Postman tool for this action please help me how to pass the value
To Get Access_Tokent : -
Request :
https://login.salesforce.com/services/oauth2/token?grant_type=password&username=r.ramesh@gmail.com&password=Ramesh@1234566QgZqsEmPk9JNxbeI6M9NV7&client_id=3MVG9pe2TCoA1Pf79wjDZewH4FE_H2OQVnt8rhRW4xG.Vn5c7OImJjmd18fUXPWRq3DJA5J3E0sB3Ci96PGd9&client_secret=8545568721922272496&redirect_uri=https://localhost:8443/RestTest/oauth/_callback
Response :
{
"access_token": "00D0o000001AkD7!ARkAQHB5ZXtMMaH3QHUvkXxQJKPySstRsLaj3NIZZrgwC5Xgfu6QKURHop5_9p0beoED4P8ARDES8e1tAaAAoIBLeh8nKGFk",
"instance_url": "https://ap8.salesforce.com",
"id": "https://login.salesforce.com/id/00D0o000001AkD7EAK/0050o00000VMLvRAAX",
"token_type": "Bearer",
"issued_at": "1546239021943",
"signature": "la6GCV2T8xhwyML9q+Xb5UnRwkOGaPG1QNddi+j2n+g="
}
I posted this below url to get access_token and i got access token also
But i want to create case , i dont know how to do this, please guid me with this issue
Note : I am using Postman tool for this action please help me how to pass the value
To Get Access_Tokent : -
Request :
https://login.salesforce.com/services/oauth2/token?grant_type=password&username=r.ramesh@gmail.com&password=Ramesh@1234566QgZqsEmPk9JNxbeI6M9NV7&client_id=3MVG9pe2TCoA1Pf79wjDZewH4FE_H2OQVnt8rhRW4xG.Vn5c7OImJjmd18fUXPWRq3DJA5J3E0sB3Ci96PGd9&client_secret=8545568721922272496&redirect_uri=https://localhost:8443/RestTest/oauth/_callback
Response :
{
"access_token": "00D0o000001AkD7!ARkAQHB5ZXtMMaH3QHUvkXxQJKPySstRsLaj3NIZZrgwC5Xgfu6QKURHop5_9p0beoED4P8ARDES8e1tAaAAoIBLeh8nKGFk",
"instance_url": "https://ap8.salesforce.com",
"id": "https://login.salesforce.com/id/00D0o000001AkD7EAK/0050o00000VMLvRAAX",
"token_type": "Bearer",
"issued_at": "1546239021943",
"signature": "la6GCV2T8xhwyML9q+Xb5UnRwkOGaPG1QNddi+j2n+g="
}
You can use the instance_url and the access_token from the previous step to make the call to create a Case.
Use access_token in Authorization Header as Authorization:
Bearer <access_token>
Use the <instance_url> along with the endpoint to access the intended API.
POST services/data/v42.0/sobjects/Case
Host: <instance_url>
Authorization: Bearer <access_token>
Content-Type: application/json
{
"Subject": "subject goes here",
...
...
}
For more detail Please refer to this link:
https://developer.salesforce.com/forums?id=9062I000000g6L9QAI
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks.
Deepali Kulshrestha
All Answers
You can use the instance_url and the access_token from the previous step to make the call to create a Case.
Use access_token in Authorization Header as Authorization:
Bearer <access_token>
Use the <instance_url> along with the endpoint to access the intended API.
POST services/data/v42.0/sobjects/Case
Host: <instance_url>
Authorization: Bearer <access_token>
Content-Type: application/json
{
"Subject": "subject goes here",
...
...
}
For more detail Please refer to this link:
https://developer.salesforce.com/forums?id=9062I000000g6L9QAI
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks.
Deepali Kulshrestha
- Retrieving Authorization token
Endpoint = Your Org URL + ”/services/oauth2/token"Method = "POST"
Content-Type = "application/x-www-form-urlencoded"
CLIENT_SECRET = '123567890’;
CLIENT_ID =’abcdefgh’;
USERNAME = Your Org UserName;
PASSWORD = Password';
BODY = "grant_type=password&client_id=abcdef&client_secret=1234567890&username=Org UseraName&password= Org pasword"
Note **: CLIENT_SECRET, CLIENT_ID, USERNAME, PASSWORD should be passed in request body .
Sample Response::
{
"access_token": "00DV0000006tZlL!AR8AQJiauiuyeiqu.sYYjN95XCLo8SmlCrFatBRjhH2OxiuH6lIv",
"instance_url": "URK",
"id": "Org Id",
"token_type": "Bearer",
"issued_at": "1541774902317",
"signature": "NVUY9BtsY5AuwiWHXgGbeVuo5++XwfGTvg43SXdVaJs="
}
2) Create Case
Endpoint = " https://instanceurl/services/data/v25.0/sobjects/Objectname"
Method = "POST"
Authorization : Bearer access_token (retrieved from 1st step)
Content-Type = "application/json"
Request Body = {
"Case field API NAme" : " Value"
}
Note ** : Request body will contains Salesforce fields to update and its updated value .
I posted the request from post man and first time it got created the case but when i tried to create second time it showing below respose and case is not creating can you please help me...
{
"objectDescribe": {
"activateable": false,
"createable": true,
"custom": false,
"customSetting": false,
"deletable": true,
"deprecatedAndHidden": false,
"feedEnabled": true,
"hasSubtypes": false,
"isSubtype": false,
"keyPrefix": "500",
"label": "Case",
"labelPlural": "Cases",
"layoutable": true,
"mergeable": false,
"mruEnabled": true,
"name": "Case",
"queryable": true,
"replicateable": true,
"retrieveable": true,
"searchable": true,
"triggerable": true,
"undeletable": true,
"updateable": true,
"urls": {
"compactLayouts": "/services/data/v42.0/sobjects/Case/describe/compactLayouts",
"rowTemplate": "/services/data/v42.0/sobjects/Case/{ID}",
"approvalLayouts": "/services/data/v42.0/sobjects/Case/describe/approvalLayouts",
"caseArticleSuggestions": "/services/data/v42.0/sobjects/Case/suggestedArticles",
"caseRowArticleSuggestions": "/services/data/v42.0/sobjects/Case/{ID}/suggestedArticles",
"defaultValues": "/services/data/v42.0/sobjects/Case/defaultValues?recordTypeId&fields",
"listviews": "/services/data/v42.0/sobjects/Case/listviews",
"describe": "/services/data/v42.0/sobjects/Case/describe",
"quickActions": "/services/data/v42.0/sobjects/Case/quickActions",
"layouts": "/services/data/v42.0/sobjects/Case/describe/layouts",
"sobject": "/services/data/v42.0/sobjects/Case"
}
},
"recentItems": []
}