Greetings,
I am using unirest lib for API connectivity. It's work find to get any data from API but when I try to add a comment on the issue using API it's gives me this error
C:\wamp64\www\sw-customer-support-portal\wp-content\themes\Avada-Child-Theme\templates\jira.php:279: object(Unirest\Response)[2942] public 'code' => int 400 public 'raw_body' => string '{"errorMessages":["The body parameters 'value' and 'identifier' are mutually exclusive."],"errors":{}}' (length=102) public 'body' => object(stdClass)[2945] public 'errorMessages' => array (size=1) 0 => string 'The body parameters 'value' and 'identifier' are mutually exclusive.' (length=68) public 'errors' => object(stdClass)[2900] public 'headers' => array (size=17) 0 => string 'HTTP/2 400' (length=10) 'date' => string 'Mon, 27 Jun 2022 11:03:56 GMT' (length=29) 'content-type' => string 'application/json;charset=UTF-8' (length=30) 'server' => string 'globaledge-envoy' (length=16) 'timing-allow-origin' => string '*' (length=1) 'x-arequestid' => string 'a6fcf1aa-97b8-42f2-8700-ae3c82992cc2' (length=36) 'set-cookie' => string 'atlassian.xsrf.token=d7e796fd-9668-4d5f-8beb-8b60f6e44b1b_0882f147621baebc4bf443ab12a51b2958954210_lin; path=/; SameSite=None; Secure' (length=133) 'x-aaccountid' => string '62b1e2fa0c77011bdfdc71e6' (length=24) 'cache-control' => string 'no-cache, no-store, no-transform' (length=32) 'x-envoy-upstream-service-time' => string '435' (length=3) 'expect-ct' => string 'report-uri="https://web-security-reports.services.atlassian.com/expect-ct-report/atlassian-proxy", max-age=86400' (length=112) 'strict-transport-security' => string 'max-age=63072000; preload' (length=25) 'x-content-type-options' => string 'nosniff' (length=7) 'x-xss-protection' => string '1; mode=block' (length=13) 'atl-traceid' => string 'efc3a5f8956ca1fb' (length=16) 'report-to' => string '{"group": "endpoint-1", "max_age": 600, "endpoints": [{"url": "https://dj9s4kmieytgz.cloudfront.net"}], "include_subdomains": true}' (length=131) 'nel' => string '{"report_to": "endpoint-1", "max_age": 600, "include_subdomains": true, "failure_fraction": 0.001}' (length=98)
is there any way to solve this issue?
thanks
Abdul
@Abdul Qadir Please try after removing "value": "Administrators"
"visibility": {
"identifier": "Administrators",
"type": "role",
"value": "Administrators"
},
This worked for me.
Here is code i am using.
Unirest\Request::auth('ifuabbas@gmail.com', 'qqmTQFZLFwxEKXrB');
$headers = array(
'Accept' => 'application/json',
'Content-Type' => 'application/json'
);
$body = <<<REQUESTBODY
{
"visibility": {
"identifier": "Administrators",
"type": "role",
"value": "Administrators"
},
"body": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper.",
"type": "text"
}
]
}
]
}
}
REQUESTBODY;
$response = Unirest\Request::post(
'https://smartwiretest.atlassian.net/rest/api/3/issue/DESK-2/comment',
$headers,
$body
);
var_dump($response);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.