Get the incident table records as a csv file using the rest integration

PRKK
Tera Contributor

Hello Guys,

 

I have to get the incident table records as a csv file using the rest api explorer or integration, Please guide me how to achieve the same.

 

Thank you!

2 REPLIES 2

Sankar Narayan1
Tera Contributor
  1. Open the ServiceNow instance and navigate to the "REST API Explorer" by typing "REST API Explorer" in the navigation bar.

  2. In the REST API Explorer, expand the "Table API" section and select "GET /api/now/table/{tableName}".

  3. Replace {tableName} with "incident" to get the records from the Incident table.

  4. In the "Request Parameters" section, add the "sysparm_query" parameter with the value of the query that filters the records you want to retrieve.

  5. In the "Request Headers" section, add the "Accept" header with the value of "text/csv" to specify the response format as CSV.

  6. Click on the "Try it out" button to execute the request.

  7. The response will be a CSV file containing the records that match the query you specified. You can download the CSV file by right-clicking on the "Response body" section and selecting "Save As".

Hello Sankar,

 

we dont have text/csv option in rest api explerer and also when i try to achieve the same using post man

 

GET "https://dev120611.service-now.com/api/now/table/incident?sysparm_query=active%3Dtrue"

 

and we got error msg as below(refer screenshot)

csv attachment post man.PNG