Create a record from REST API Explorer

Khanna Ji
Tera Guru

How can I create a record from the REST API explorer with an attachment? Please help me understand this part.

Basically I want to create a record and attach the file to that record from REST API explorer or any other API testing tools like POSTMAN

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@ServiceNow User 

Out of the box TABLE API would create record on your target table.

You would require one more API call on Attachment API to add attachment to the above record created

Screenshots below:

1) 1st create record in table using POST call and give the required fields you want

find_real_file.png

find_real_file.png

find_real_file.png

2) Now attach sample file by using that record sys_id which is highlighted in blue

Give table name, file name, record sys id

Request format as text/plain since I have given txt file

find_real_file.png

 

Output: File got attached

find_real_file.png

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

5 REPLIES 5

maheshn
Mega Expert

Its not possible with single REST  Call. Need to make 2 calls one after one. One is to insert record first and then add attachment to it using one more call.

If it has to be done in single call you will have to build custom end point using scripted REST web services.