Hello,
I have a php Project, this creates Jira Tickets over the API.
The authentification works with publickey and the atlassian OAuthWrapper class (https://bitbucket.org/atlassian_tutorial/atlassian-oauth-examples/src/default/php/src/Atlassian/OAuthWrapper.php).
The ticket creation works perfect on a Jira Development Instance but not on a productive cloud instance. On the productive instance, I get a 400 Bad Request answer.
The Source Code for the Request (shorted):
require_once __DIR__ . "libs/jira/vendor/autoload.php";
$oauth->setPrivateKey($pathToPrivateKey);
$oauth->setConsumerKey($jiraConsumerKey);
$oauth->setConsumerSecret($jiraConsumerSecret);
$oauth->setCallbackUrl(urlencode($appServerName . $appPath . "connect/callback/"));
$oauth->setRequestTokenUrl("plugins/servlet/oauth/request-token");
$oauth->setAuthorizationUrl("plugins/servlet/oauth/authorize?oauth_token=%s");
$oauth->setAccessTokenUrl("plugins/servlet/oauth/access-token");
$obj_request = $oauth->getClient($oauth_token, $auth_token_secret)
->post("rest/servicedeskapi/request", [
"Content-Type" => "application/json"
], json_encode([
serviceDeskId" => 16,
"requestTypeId" => 500,
"requestFieldValues" => [
"summary" => "SomeText",
"description" => "Ticket Discription"
]
]))->send()->json();
As written above, the 400 Bad Request happens only in productive not in the dev instance.
I hope somebody can help me with this problem.
Best regards
Oliver Hart