Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9005155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:04:19+00:00 2026-06-16T01:04:19+00:00

my php function to update jira issue is like this.i have hardcoded the issue

  • 0

my php function to update jira issue is like this.i have hardcoded the issue id.it generates an error in if (property_exists($result, 'errors')). saying parameter is not an object.

function post_to($resource, $data) {
$jdata = json_encode($data);
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_POST => 1,
CURLOPT_URL => JIRA_URL . '/rest/api/latest/' . $resource,
CURLOPT_USERPWD => USERNAME . ':' . PASSWORD,
CURLOPT_POSTFIELDS => $jdata,
CURLOPT_HTTPHEADER => array('Content-type: application/json'),
CURLOPT_RETURNTRANSFER => true
));
$result = curl_exec($ch);
curl_close($ch);
return json_decode($result);
}

function create_issue($issue) {
return post_to('issue/10224/editmeta', $issue);
}

$new_issue = array(
    'update' =>array(
        'fields' => array(
            'project' => array('key' => 'DOTNET'),
            'summary' => 'Test via REST',
            'description' => 'Description of issue goes here.',
            'issuetype' => array('name' => 'Task')
            ))
);

$result = create_issue($new_issue);
if (property_exists($result, 'errors')) {
echo "Error(s) creating issue:\n";
var_dump($result);
                }
            }

what am i doing wrong here? please answer.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T01:04:20+00:00Added an answer on June 16, 2026 at 1:04 am

    Not really sure, let’s try some thing:

    change

    CURLOPT_HTTPHEADER => array('Content-type: application/json'),
    

    to:

    CURLOPT_HTTPHEADER => array(
        'Accept: application/json',
        'Content-Type: application/json'
    );
    

    and:

    $new_issue = array(
        'update' =>array(
            'fields' => array(
                'project' => array('key' => 'DOTNET'),
                'summary' => 'Test via REST',
                'description' => 'Description of issue goes here.',
                'issuetype' => array('name' => 'Task')
                ))
    );
    

    to:

    $new_issue = array(
        'fields' => array(
            'project' => array('key' => 'DOTNET'),
            'summary' => 'Test via REST',
            'description' => 'Description of issue goes here.',
            'issuetype' => array('name' => 'Task')
         )
    );
    

    lastly, change:

    CURLOPT_URL => JIRA_URL . '/rest/api/latest/' . $resource,
    

    to your real address, as well as writing 2 instead of latest, i.e.:

    CURLOPT_URL=>'http://localhost/rest/api/2/issue/',
    

    try this, and let me know how it’s goes, good luck!

    EDIT

    try changing:

    CURLOPT_POST => 1,
    

    to:

    CURL_POST=>true,
    CURLOPT_VERBOSE=>1,
    

    btw, where is your jira server? didn’t you say it was hosted? localhost:8080 will work only if Jira is installed locally. If so, try opening it using a browser http://localhost:8084/rest/api/2/issue/

    EDIT 2

    Make sure the Allow Remote API Calls is turned ON under Administration > General Configuration.

    to update an issue:

    the URL should point to the soon-to-be-updated issue, i.e.:

    http://localhost/rest/api/2/issue/TEST-31
    

    and the data should be the same as before, meaning:

    $new_issue = array(
        'fields' => array(
            'project' => array('key' => 'DOTNET'),
            'summary' => 'Test via REST',
            'description' => 'Description of issue goes here.',
            'issuetype' => array('name' => 'Task')
         )
    );
    

    just as you wrote when you tried to create an issue. you can find here some simple example of how to do so.

    EDIT 3

    Are you sure you have the right jira address? try again opening a browser and going to the URL and compare it to this example. If the page won’t show, you will have to contact Jira’s support and ask them how come you can’t access the hosted Jira remote API.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code below: <?php function wp_copickpage() { color_option_update(); ?> <form method=POST action=>
UPDATE: For anyone else wondering about this, check out the comment at http://www.php.net/manual/en/function.imagecreatefromstring.php#31178 I
I have this simple PHP function in admin.php function accountMenu() { if (isset($_SESSION['user_id'])) {
I have this code, which uses ob_start php function. Which basically puts the echoed
I have a PHP function: function output_errors($errors) { return '<ul><li>' . implode('</li><li>', $errors) .
I have a (cake) php function designed to update entries in a MySQL table;
I have this PHP function : if(($_POST['id']==pm_read) && (isset($_POST['pm_id'])) && (ctype_digit($_POST['pm_id'])) && (isset($_SESSION['nickname']))) {
I have the following javascript code, which loads without error, however the update function
I have a PHP function that extract dat of an invoice from DB. The
I have a php function which returns JSON in response to a ajax request

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.