Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,466,290
Community Members
 
Community Events
176
Community Groups

I am using unirest for API connectivity. I am able to get data but not able to post any Data.

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

2 answers

@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);



 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS

Atlassian Community Events