2

Doing the following using curl works...

curl "https://test.salesforce.com/services/oauth2/token" \
  --data 'grant_type=password&client_id=CONSUMER_KEY&client_secret=CONSUMER_SECRET&username=SANDBOX_USER&password=SANDBOX_USER_PASSSANDBOX_USER_TOKEN'

curl -X PUT "https://company.my.salesforce.com/services/apexrest/issue/PS-12" \
  --header 'Authorization: Bearer ACCESS_TOKEN_FROM_LAST_CURL' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{"billingType": "Subscription (Enhancement)"}'

Jira has Automation Rules with steps that include Send web request. enter image description here The Custom Data field that is clipped contains the same data I sent in the curl.

When I try to validate this step, I get a response:

{
  "error": "unsupported_grant_type",
  "error_description": "grant type not supported"
}

Any idea why Salesforce would allow the grant_type when I send via curl but not when sent from Jira?

1
  • I will advise you to set an endpoint to putsreq.com (or any other site) and to investigate how request constructed by Jira is different from your curl request
    – kurunve
    Commented Jan 2, 2021 at 22:08

1 Answer 1

3

Turns out, just needed a header... Content-Type: application/x-www-form-urlencoded

Guess curl was setting it automatically.

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