Cannot add an Approver Requested Item via API

jamesanders
Tera Contributor

I've managed to create a Request Item and a Requested Item via API but when I try to create an Approval Requested Item it gives me a Status Code 201 but doesn't seem to add the data to the Body response. Is this even possible via API or have I put wrong Body content in the call?

 

Relative URL: /api/now/table/sysapproval_approver

 

Body:

 

{
"approver": "08e4bcf053231300e321ddeeff7b12f8",
"sysapproval": "a4076795c385d2106dd2d075e4013188",
"state": "not requested",
"sys_class_name": "sc_req_item",
"source_table": "sc_req_item"
}

 

Result:

 

{
"result": {
"approver": "",
"comments": "",
"sysapproval": "",
"due_date": "",
"sys_mod_count": "0",
"approval_journal_column": "",
"approval_column": "",
"sys_updated_on": "2024-10-04 08:27:06",
"document_id": "",
"process_step": "",
"sys_tags": "",
"expected_start": "",
"sys_id": "f1017bd1c3c5d2106dd2d075e4013105",
"state_binding": "",
"sys_updated_by": "admin",
"sys_created_on": "2024-10-04 08:27:06",
"iteration": "1",
"state": "not requested",
"approval_source": "",
"source_table": "sc_req_item",
"sys_created_by": "admin",
"group": "",
"order": ""
}
}

 

Nothing happens and the item is not created in table.

1 REPLY 1

JenniferRah
Mega Sage

I tested this in my instance and got the same results. Perhaps you could write your own Scripted REST API to handle this. It looks like others have had to do the same.

 

Refer to https://www.servicenow.com/community/developer-forum/adding-approvers-to-an-open-change-request-via-...