Bad Request - Invalid URL for delete rest api call

I created an delete rest api call but each time I try to call it postman it gives bad request invalid url

Changed the logging level to full to see what's happening but I can't find anything


It needs to be internal access only


In postman I use

https://personal-m20w4l3p.outsystemscloud.com/AutomationSupport/rest/DeleteOrders/CallDelete


Request

    {

  "Emiratesid": [

    {

      "Emiratesid": "12"

      

    },

     {

      "Emiratesid": "13"

      

    }

  ]

}

No authorization needed.






Can someone tell me why am I getting this ? 

AutomationSupport.oml

mvp_badge
MVP
Solution

Hi Craig,

I had the below observation when I called the API method using postman.


I guess, the 500 Internal response is because of the sql execution failure

Query Snippet

DELETE 
    FROM {TestOrders} 
WHERE {TestOrders}.[Eid] in (@EmiratesId)


I hope this helps you!


Kind regards,

Benjith Sam

Oh , but I am getting an bad request invalid url error 400 , could please send me json file you used for the postman ?
So that I can import it and know what i'm doing wrong in postman ?

Hello @Craig Rodrigues 

There happen to be another issue with the SQL. The output structure is raising an issue and probably because you have multiple deletes. The following will work though

I have also noticed that the data is not getting deleted after the errors are resolved, and am still in the process of troubleshooting that aspect.

Regards,

AJ

Hey @AJ. Upon calling the api do you get a response of 500 ?

I tried calling it but unfortunately i'm getting of response of 400 bad request. The query and output variable can be fixed. The issue I'm facing is that I can't hit the api. 

@Benjith Sam  Hey Benjith , I fixed the issue with query thank you, but the main problem is that I can't hit the api , i'm getting a response of 400 , could you please help me with this ? 

I do not get any more errors after I fixed your SQL (as Ben had noted previously) and changed the output structure. I am able to set breakpoints in the code and hit them when I execute the postman request.

Could you share a bigger screenshot of your Body request.

Also please check if you have a header for content-type set up as shown below:

mvp_badge
MVP

Hi Craig,

Sorry for the late response. As, AJ (thank you 😊) already covered all the relevant points, I hope that you have already solved the issue. WRT invoking the API method using postman I didn't do any other configuration, and the JSON value for the body section is the same as you shared..

Note: The latest API method response looks fine 

Request Body JSON Object value

{
   "Emiratesid":[
      {
         "Emiratesid":"12"
      },
      {
         "Emiratesid":"13"
      }
   ]
}


Kind regards,

Benjith Sam

@Craig Rodrigues 

I just called your API successfully, no issues.

The question is whether it actually deleted any data or not. I sent requests for Emiratesid 14 and 15. 

I won't be executing calls to your API anymore in order not to throw your process off. Just a one time request to see what happens.

I fixed it @AJ.  yesterday night. Thank you :) 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.