- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2017 03:23 AM
Hi Guys,
I am trying to update the cost center, location of a user in ServiceNow(Geneva) using REST api. I am using
https://devxxxxx.service-now.com/api/now/v1/import/(table) with POST type.
My input is
{
"cost_center":" ",
"user_sys_id":"<user-id>"
}
This gives me "No field values changed" message. When I change the type to patch with the following url
https://devxxxxx.service-now.com/api/now/v1/import/(table)/<user-id>
I get "Method not Supported" message.I even tried with X-http-method-override but it wasn't helpful. I went through this doc but was not able to understand what I was doing wrong. Please advice.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2017 06:14 AM
Hi Kshitiah,
As you are on Geneva and using an import set table this is the documentation URL that refers:
The import set table needs to be specified
Only POST and GET are supported methods - PUT and PATCH are not possible.
However a POST to import set table imp_user will update an existing user record based on user_id.
Any questions arising add them to this thread 🙂
If the reply was informational, please like, mark as helpful or mark as correct!
Also there is a sample CURL request mentioned:
curl "https://instance.service-now.com/api/now/import/imp_user" \
--request POST \
--header "Accept:application/json"\
--header "Content-Type:application/json" \
--data "{'first_name':'John','last_name':'Public','user_id':'john.public','email':'john.public@company.com'}" \
--user 'admin':'admin'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2017 06:14 AM
Hi Kshitiah,
As you are on Geneva and using an import set table this is the documentation URL that refers:
The import set table needs to be specified
Only POST and GET are supported methods - PUT and PATCH are not possible.
However a POST to import set table imp_user will update an existing user record based on user_id.
Any questions arising add them to this thread 🙂
If the reply was informational, please like, mark as helpful or mark as correct!
Also there is a sample CURL request mentioned:
curl "https://instance.service-now.com/api/now/import/imp_user" \
--request POST \
--header "Accept:application/json"\
--header "Content-Type:application/json" \
--data "{'first_name':'John','last_name':'Public','user_id':'john.public','email':'john.public@company.com'}" \
--user 'admin':'admin'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2017 06:19 AM
Thanks , yes you are correct. Patch and Put are not available for import set table. I am not able to update fields like cost center and location. Any idea how this can be possible? May be I will open another thread for this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2017 06:29 AM
Hi Kshitish,
If you can specify a cost center or location via user list view, ie the value you specify already exists in the location and cost center table, you should be able to populate via REST api.
If the reply was informational, please like, mark as helpful or mark as correct!