order POST request failing (400 error)

47 views
Skip to first unread message

Eli Lyonhart

unread,
Dec 17, 2015, 8:41:00 PM12/17/15
to opendining-dev
Hey all,

So, I'm making an initial request to POST /orders and believe that I've got all the fields properly filled, but I keep getting the response of: 

{"error": {
   "code": 400,
   "messages": [],
   "display_message": "One or more required parameters were missing."
}}


my request is: 

and the body is: 
 -- {"restaurant_id": "${restaurant_id}", "type": "takeout", "items": [${item1}], "order_id": "", "coupon": "", "ua": "", "app": "", "source": "", "force": "", "email": ""}


I've tried with and without the empty params. and I'm confident that my tokens and keys are correct.

What am i missing?

Thanks.
Message has been deleted

no...@opendining.net

unread,
Dec 18, 2015, 12:49:57 PM12/18/15
to opendining-dev
Hey Eli,

The fields in your request look reasonable.  You probably won't want to supply an access token or provider.

The API only accepts form/urlencoded data, not JSON, so you'll want to make sure the following are done:

1. The Content-Type header is set to application/x-www-form-urlencoded
2. Your POST body is form-urlencoded, like: restaurant_id=ID&type=takeout

Give that a shot, and if it doesn't work, please post your full request with API keys redacted.

Thanks!

Eli Lyonhart

unread,
Dec 18, 2015, 12:51:31 PM12/18/15
to opendining-dev
Follow up for posterity:


The body text needs to be set to Media Type: 'x-www-form-urlencoded' rather than 'application/json'. This isnt set as a header but in the "Media Type" dropdown above the body response.
its working like a charm now!

Eli Lyonhart

unread,
Dec 18, 2015, 12:54:16 PM12/18/15
to opendining-dev
Thanks a ton for the response. I posted my original question before seeing that this forum had been dead for ~2 years.

And yah, its working great now. I followed up with a coworker who'd worked with the calls before and he looked at it and gave me more or less the same answer as you.

So,
Thanks!
Reply all
Reply to author
Forward
0 new messages