Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Scripted REST Web service not working right in Postman

DrewW
Mega Sage

I am very confused right now and am thinking I just have a giant case of the "Stupids" and hoping someone can save me from myself.

 

I need a web service that allows me to post some information to create a record.  So I created a Scripted REST web service and set the "HTTP Method" to POST.  I then just had it return "Not implemented" so I could test things.

 

I then opened Postman and added the web service there so I could call it.  When I set Postman to use "POST" and ServiceNow to POST and send the request I get this

{
    "error": {
        "message": "Method not Supported",
        "detail": "GET method not supported for API"
    },
    "status": "failure"
}

Which is odd because in ServiceNow the "HTTP Method" is set to POST.  When I change it to GET in ServiceNow and leave Postman set to use the POST method I get this

{
    "result": {
        "sys_id": "32CharAlphaNumeric",
        "number": "String40Char",
        "message": "complaint Not Implimented."
    }
}

Which is the expected response I should have gotten when I have BOTH set to POST.  When I have both set to GET it also works.

 

When I use the "REST API Explorer" everything works as expected, I have to use POST when ServiceNow is set to POST and GET when ServiceNow is set to GET.

 

So if someone could help save my sanity and can point/suggest why Postman does not work quite right I would appreciate it.

 

 

1 REPLY 1

ash1xh
Tera Contributor

Issue occurs when the URL does not include the required 'https://' protocol prefix.