- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2022 06:52 PM
What does the following mean, which is code for calling ServiceNow's REST API?
Why is it necessary?
What is the difference between them?
" setRequestProperty("Accept", "application/json"); "
" setRequestProperty("Content-Type", "application/json"); "
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
-
Team Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2022 07:56 PM
Hi Koki,
Explained in the following IBM page.
https://www.ibm.com/docs/en/order-management?topic=services-specifying-http-headers
Other headers settings are explained in the following page in Japanese. These are standard http headers and not proprietary ServiceNow.
http://itdoc.hitachi.co.jp/manuals/3021/3021904200/PCAP0018.HTM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2022 07:48 PM
setRequestProperty("Accept", "application/json") // The format of response we want to get from the server httpURLConnection.
setRequestProperty("Content-Type", "application/json"); "//Set the “content-type” request header to “application/json” to send the request content in JSON form.
Harish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2022 07:56 PM
Hi Koki,
Explained in the following IBM page.
https://www.ibm.com/docs/en/order-management?topic=services-specifying-http-headers
Other headers settings are explained in the following page in Japanese. These are standard http headers and not proprietary ServiceNow.
http://itdoc.hitachi.co.jp/manuals/3021/3021904200/PCAP0018.HTM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2022 10:12 PM
Thank you very much.
Many of the sample codes I found on the net did not specifically mention "Accept", so I thought it was only written for ServiceNow's REST API.
I am glad to have found a site that explains it clearly.