Forbidden (403) when i try to worklog with Rest Api

hello, i am blocked here. i don’t know what to do to get this issue done ! any help pls ?

this is my code :

AP.request({
        url: '/rest/api/3/issue/' + key + '/worklog',
        type: 'POST',
        data: {
            "comment": {
                "content": [
                    {
                        "content": [
                            {
                                "text": worklog_text,
                                "type": "text"
                            }
                        ],
                        "type": "paragraph"
                    }
                ],
                "type": "doc",
                "version": 1
            },
            "started": Datestarted + "T" + Timetarted + ":00.000+0000",
            "timeSpentSeconds": converter(timeSpent)
        },
        success: function (responseText) {
            alert(responseText);
        },
        error: function (xhr, statusText, errorThrown) {
            document.getElementById('responseText').innerHTML = (arguments[0].responseText);
        }
    });

Hi @IslamZiane,

It’s hard to know what’s going on here as it’s only a short bit of code. However, is this a Confluence app calling a Jira REST API? Do you have the WRITE scope in your Connect app?

Are there any examples, e.g. GET request where it does work?

James.

hello @jrichards,

1- it’s not a conluence app
2- i don’t have WRITE scope in my connect app
3- yes, all my GETs works fine

Hi @IslamZiane,

If you don’t have WRITE scope, then you can’t make a POST request that makes an update. You will have to add it to allow updates to Jira.

James.