REST API V2 POST - RMAProcs 400 Bad Request

Trying to insert a record into RMAHead using the rest API (v2).
Using Postman but receiving a runtime error (400 bad request, the request cannot be fulfilled due to bad syntax).

POST https://epicap.smt.com/EpicorERPTest/api/v2/odata/MYCOMPANY/Erp.BO.ProcSvc/RMAProcs&api-key=MYAPIKEY

Body (raw)

{“OpenRMA”: true,“Company”: “MYCOMPANY”,“RMANum”: 0,“CustNum”: 134600,“BTCustNum”: 134600}

Assuming the body isn’t formatted correctly though this is copied from Swagger which adds the RMA correctly.

Turning off custom errors gives this response.

A potentially dangerous Request.Path value was detected from the client (&).

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: A potentially dangerous Request.Path value was detected from the client (&).

API Key moved from URL to header (omitting the &) and now get the dreaded 500 Internal Server Error.

This is likely a configuration on the IIS level that will need to be addressed. Is this error happening with every REST v2 call?

When you have a first argument in the URL it starts with a question mark not an &persand. & is reserved for secondary and beyond arguments.

Some “light” reading
https://datatracker.ietf.org/doc/html/rfc3986

:wink:

1 Like

Well, it works with the V1 API. Doesn’t happen with every v2 call, I have used the V2 successfully with some GET requests but this is my first POST ::grinning:

Did you try what I said? The issue is that andpersand