- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2018 07:24 AM
Hi all.
I'm very new to ServiceNow (working on my developer instance) and have been experimenting with making API calls based on ticket actions.
This is working e.g. creating a new ticket on a custom application successfully makes the API call.
I am continuing to add functionality and my most recent change is to pass a variable to the far end in the form on an HTTP parameter. As soon as this parameter was added to the outbound REST message, the trigger failed. I manually tested on the REST message and I get a failed error message complaining about invalid URI.
On closer inspection I see the URI has been truncated! I've done some searching online and have seen references to a 120 character limit. However it's not 120 characters where it's being cut; it is 157.
I've done some digging around the system tables and updated a few records of interest to be string value max 1000. I've updated all that are interesting but to no avail. If I take out the additional HTTP parameter, it works again.
Seems rather limiting given that some API URLs can be very long indeed.
If anyone can help me out I would be very appreciative. Currently I'm banging my head off the wall!
Thanks in advance!
Kind regards,
Scott
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2018 12:42 AM
Aha - so a fresh start this morning and I've managed to fix the issue!
It was just the log being truncated. The actual error was in the HTTP Parameter. I had to use HTTP encoding for the square brackets!
I changed ?variables[TF_VAR_user_email]= to ?variables%5BTF_VAR_user_email%5D
Now it works! 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2018 12:17 PM
Could you share more details around the call you're making and the error you're receiving?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2018 01:10 PM
Hi Brad, thanks for your reply!
So it's just a standard API call I'm making to a remote system where I'm running deployment jobs. It's an HTTP post and it actually was working. In its 'base' form, it used just a single HTTP Query Parameter. When testing with that single parameter, it's fine. I even have it working using a business rule when new records in my application are created.
I now want to expand functionality and pass additional variables across. I created a new field in the application and I'm passing that as a second HTTP Query Parameter. It now fails.
On closer inspection, when analysing the result of the test it gives this error (contents masked):
Error executing REST request: Invalid uri 'https://abcdef.com/api/v4/projects/123456/ref/master/trigger/pipeline?variables[TF_VAR_user_email]=abcdefghi%40abcdefghijklmn.com&token=123456789012345678
The thing is - that token is truncated, that's why there seems to be a URI error - notice we don't have the closing '.
If I go ahead and remove the second parameter, leaving just the token parameter, it works again.
The closest explanation I've found is here: https://community.servicenow.com/community?id=community_question&sys_id=ad5d83e9db9cdbc01dcaf3231f961986
I've found the ecc_queue table and increased the source field. I have then gone over to table rotation and synchronised the shard. The issue remains, and it always is truncated at the same point(157 characters). I've read that you need to update the source field on the rotations, but when I go to that section I can't see actual tables like ecc_queue001 that I can edit fields on.
If there is such a limit on outbound REST messages - it seems rather low by default? There is the ability to define multiple HTTP Query Parameters so the URI can end up fairly long! 🙂
It's driving me mad. If you're able to help at all I would be hugely grateful.
Thanks again!
Kind regards,
Scott
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2018 12:13 AM
Hi again.
I actually found the ecc_queue00x tables. I updated the source string length to 1000 on every one. Issue still persists!
I've been through all of the tables which seem to reference the REST function. Most notably I found table with label "Scripted REST API" and a field on there named "Base API Path". I've gone ahead and increased that value to 1000 and that hasn't helped either unfortunately.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2018 12:42 AM
Aha - so a fresh start this morning and I've managed to fix the issue!
It was just the log being truncated. The actual error was in the HTTP Parameter. I had to use HTTP encoding for the square brackets!
I changed ?variables[TF_VAR_user_email]= to ?variables%5BTF_VAR_user_email%5D
Now it works! 🙂
