IS SCRIPTED REST API (OR) WEB SERVICE Import sets in this scenario(Which is Best?)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2022 08:28 PM
I HAVE 2 SCENARIOS:
SCENARIO 1:
(TRIRD PARTY APP WILL SEND CHANGE NUMBER AS INPUT
TRIRD PARTY APP WILL CONSUME SERVICENOW API
SERVICENOW SHOULD SEND STATUS AND APPROVAL FIELD VALUES)
METHOD 1:
DIRECTLY SENDING THE API BUILT USING REST API EXPLORER:
https://<your instance>.service-now.com/api/now/table/change_request?sysparm_query=number%3D<Change number>&sysparm_fields=approval%2Cstate&sysparm_limit=1
METHOD 2:
CREATING A SCRIPTED REST API => SCRIPTED REST RESOURCE:
HTTP METHOD :GET
SCRIPTED REST RESOURCE SCRIPT TO SEND THE STATE AND APPROVAL FIELD VALUES
QUESTION 1: WHICH METHOD IS BEST FIRST SCENARIO => (METHOD 1 (or) METHOD 2).
SCENARIO 2:
(TRIRD PARTY APP WILL SEND CHANGE NUMBER AS INPUT
TRIRD PARTY APP WILL CONSUME SERVICENOW API
SERVICENOW SHOULD UPADTE STATUS FIELD VALUE)
METHOD 1:
CREATING A SCRIPTED REST API => SCRIPTED REST RESOURCE:
HTTP METHOD :POST
SCRIPTED REST RESOURCE SCRIPT TO UPDATE THE STATE FIELD:
METHOD 2:(IS THIS METHOD WRIGHT OR WRONG?)
CREATING WEB SERVICES => INBOUND => WEBSERVICES FIELDS
MAPPING WEB SERVICE FIELDS TO TARGET TABLE
note: KEEPING CHANGE NUMBER AS COALESCE
WHEN THIRD PARTY SEND THE CHANGE NUMBER IF CHANGE NUMBER MATCHES IT WILL UPDATE THE CHANGE RECORD.
QUESTIONS :
HOW I NEED TO GENERATE THE END POINT IN THIS METHOD 2?
WHERE IT WILL BE PRESENT?
HOW DOES IT HIT THE END POINT AFTER SHARING THE EDNPOINT WITH THIRD PARTY?
REPEATING THE QESTIONS AGAIN.
QUESTION 1: WHICH METHOD IS BEST IN FIRST SCENARIO => (METHOD 1 (or) METHOD 2).
QUESTION 2: WHICH METHOD IS BEST IN SECOND SCENARIO => (METHOD 1 (or) METHOD 2).
QESTION 3: SECOND SCENARIO(METHOD 2)
HOW I NEED TO GENERATE THE END POINT IN THIS METHOD 2? => SECOND SCENARIO(METHOD 2)
WHERE IT WILL BE PRESENT? => SECOND SCENARIO(METHOD 2)
HOW DOES IT HIT THE END POINT AFTER SHARING THE END POINT WITH THIRD PARTY?=> SECOND SCENARIO(METHOD 2)
PLEASE SHARE IF YOU FIND ANY OTHER MISTAKES IN THESE METHODS:
THANKS.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2022 08:53 PM
Hello Surya,
Scripted rest api is a better option because you need to send only couple of fields data and update 1 or 2 fields in ServiceNow. It is easy to use Scripted rest api and you have more control on request body and response body. Using scripted rest api you can create the response body as per your requirement. Also you can show different error message as per your requirement which is easy to understand based on your validation.
You can use Scripted Rest API for your both Scenarios
Please mark my respsone as helpful/correct, if it answer your question.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2022 09:25 PM
if i go with scenario 2 what show i do?
QESTION 3: SECOND SCENARIO(METHOD 2)
HOW I NEED TO GENERATE THE END POINT IN THIS METHOD 2? => SECOND SCENARIO(METHOD 2)
WHERE IT WILL BE PRESENT? => SECOND SCENARIO(METHOD 2)
HOW DOES IT HIT THE END POINT AFTER SHARING THE END POINT WITH THIRD PARTY?=> SECOND SCENARIO(METHOD 2)
PLEASE SHARE IF YOU FIND ANY OTHER MISTAKES IN THESE METHODS:
THANKS.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2022 09:50 PM
Hi,
Yes, you can go with the Import set API and it is easy to use and you no need to create separate transaction for logging we have OOTB this functionality on import set table where you can see all the records, state and errors.
I think with your payload structure you can access in Import set so go with Import Set API if source system asked any specific response then you need to you Scripted REST API if not go with Import Set API.
Both of the API has their own benefits.
Hope you it helps you.
Please Mark ✅ Correct/helpful if applicable, Thanks!!
Regards
Pavankumar
ServiceNow Community MVP 2024.
Thanks,
Pavankumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2022 12:47 AM
Yes you are wright. now my requirementalso to do with transform map API
if i go with scenario 2 what show i do?
QESTION 3: TRANSFORM MAP API
HOW I NEED TO GENERATE THE END POINT IN TRANSFORM MAP?
WHERE IT WILL BE PRESENT?
HOW DOES tHIRD PART HIT THE END POINT WITH CHANGE NUMBER ?
How to SEND RESPONSE IN as 200 After updating the change table with the new state value??
Please do answer all these questions.