The packet being submitted is this:
{ “update”: { “customfield_10051”: [ { “set”: “50028SjQAAV” } ] } }
The code is this (asApp):
const r1d1 = await api.asApp().requestJira(route/rest/api/2/issue/10091
, {
method: ‘PUT’,
headers: {
‘Accept’: ‘application/json’,
‘Content-Type’: ‘application/json’
},
body: bodyData
});
The response is this:
{“headers”:{},“ok”:false,“status”:400,“statusText”:“Bad Request”}
If I use this code (asUser):
const r1d1 = await api.asUser().requestJira(route/rest/api/2/issue/10091
, {
method: ‘PUT’,
headers: {
‘Accept’: ‘application/json’,
‘Content-Type’: ‘application/json’
},
body: bodyData
});
I get this failure-response:
{
message: ‘Authentication required’,
name: ‘NEEDS_AUTHENTICATION_ERR’,
status: 401,
serviceKey: ‘atlassian-token-service-key’
}
I have also tried the following with relevant packets, leading to more inventive failures:
await api.asApp().requestJira(route/rest/api/2/app/field/value
,
await api.asUser().requestJira(route/rest/api/3/app/field/customfield_10051/value
await api.asApp().requestJira(route/rest/api/3/app/field/customfield_10051/value
await api.asApp().requestJira(route/rest/api/2/app/field/value
None of them have worked. Please help!
BTW, I now create the field in the code, not via the manifest. So it shows up everywhere, including on the relevant screens and in the Automation pick-list (unlike when I set up the field via the manifest). I use this code to create the field:
var body_data = ‘{ “name”: “My OnInstall”, “description”: “Custom field for integration”, “type”: “com.atlassian.jira.plugin.system.customfieldtypes:textfield”, “searcherKey”: “com.atlassian.jira.plugin.system.customfieldtypes:textsearcher” }’;
var response = await api.asApp().requestJira(route/rest/api/3/field
, {
method: ‘POST’,
headers: {
‘Accept’: ‘application/json’,
‘Content-Type’: ‘application/json’
},
body: body_data
});
Anything else I can try?