Attachment API doesn't move all attachments

joel_tan1991
Kilo Contributor

Hi,

I've been having trouble with migrating all of my attachments of a particular table to another instance (From Helsinki to Kingston). I have used the REST attachment API (POST) and created a scheduled job script to run but not all attachments are moved.

REST message:

find_real_file.png

 

Script used:

find_real_file.png

Results are as follow:

 

find_real_file.png

 

 

I went over to manually attach the particular file and was able to do so. However, I am unable to attach via REST api of another instance.

find_real_file.png

As I have posted another issue possibly similar to this, I've decided to remove it and edit it onto this post as it may be related. 

 

Any ideas on where did I go wrong or know the solution to the attachment extension issue?

Thanks

1 ACCEPTED SOLUTION

Joel,

If your target instance returns 404, isn't it simply because the record you are trying to attach the file to doesn't exist on this instance with this table_sys_id ?

View solution in original post

13 REPLIES 13

Syvo
Mega Guru

Hi,

Have you tried sending the same attachment via the REST API using a REST client? Postman, RESTED extension, or event the REST API explorer in Servicenow?

I have used the REST API explorer but was returned with the error 400

find_real_file.png

 

The issue for the invalid attachment has been solved. However, another issue arises. Upon executing the script, the logs indicated "No Record found","detail":"Record doesn't exist or ACL restricts the record retrieval".

Using the same script, I have created a scheduled script to run on demand. 

find_real_file.png

Logs:

find_real_file.png

The user executing the script is an admin and has the roles:

1. web_service_admin

2. rest_service role

The attachment exists in the table as well as the table form.

find_real_file.png

 

I have even enabled the option to allow web service to access the table.

find_real_file.png

 

Any help will be appreciated!

Are you able to open the file? Maybe the attachment is here in the sys_attachment table, but not the data in the sys_attachment_doc table.

Upon clicking the file name, I am able to download the file and opening it seems fine.