Cannot put new property to issue

Hi,
I am using the connect express framework. I am using the build in httpClient to make calls to the JIRA rest API. Getting issue is working fine. However, I cannot put a new property:

        const issueId = 'ST-1';
        const property = 'newCustomProperty';
        const bodyData = {test:'testing'}; 
        this.httpClient.put({
                'method'  : 'PUT',
                "headers": {
                    "Content-Type": "application/json",
                    "Accept": "application/json"
                },
                "url": "/rest/api/3/issue/" + issueId + '/properties/' + property,
                body: bodyData
            },
            function(err: any, response: any, body: any) {
                if (err) {
                    console.log(response.statusCode + ": " + err);
                }
                else {
                    console.log(response.statusCode, body);
                    return body;
                }
            }
        );

This call fails with the error “The property newCustomProperty does not exist”.
When I try the same PUT request in Postman it is fine.
What am I missing here?

Thank you very much in advance!

ok, i got. First of all I did not set the scope “write” in the attlassian-connect.json.
Then I need to set json to true in the request:

        this.httpClient.put({
                headers: {
                    "Content-Type": "application/json",
                    "Accept": "application/json"
                },
                url: "/rest/api/3/issue/" + issueId + '/properties/' + property,
                json: true,
                body: bodyData
            },
            function(err: any, response: any, body: any) {
                if (err) {
                    console.log(response.statusCode + ": " + err);
                }
                else {
                    console.log(response.statusCode, body);
                    return body;
                }
            }
        );

Would have been cool if the rest API returned a more specific error message.

2 Likes