Search code examples
firebasegoogle-cloud-functionspostmates

Postmates API - Status Code 400 - params":{"__all__":"invalid price quote"}


I'm trying to make a post to the /v1/customers/:customer_id/deliveries endpoint using firebase. I'm sending the query params from an angular application.

Query Object

{ 
  pickup_name: 'Patrick O',
  pickup_phone_number: '619-***-****',
  dropoff_name: 'Wendell And Chad',
  dropoff_phone_number: '619-***-****',
  manifest: 'Cheese',
  quote_id: 'Mc26u6TwH_qKkF',
  dropoff_address: '4606 Market Street, San Diego, CA',
  pickup_address: '1041 Market Street, San Diego, CA' 
}

Response (Firebase Function)

Unhandled error { StatusCodeError: 400 - {"kind":"error","code":"invalid_params","message":"The parameters of your request were invalid.","params":{"__all__":"invalid price quote"}}
...
name: 'StatusCodeError',
  statusCode: 400,
  message: '400 - {"kind":"error","code":"invalid_params","message":"The parameters of your request were invalid.","params":{"__all__":"invalid price quote"}}',
  error: 
   { kind: 'error',
     code: 'invalid_params',
     message: 'The parameters of your request were invalid.',
     params: { __all__: 'invalid price quote' } }, ...

I haven't encountered the error for __all__ in the Postmates Api Docs. Thank you for your time and consideration.


Solution

  • The issue was resolved by removing the quote_id property from the query params

    Query Object

    { 
      pickup_name: 'Patrick O',
      pickup_phone_number: '619-***-****',
      dropoff_name: 'Wendell And Chad',
      dropoff_phone_number: '619-***-****',
      manifest: 'Cheese',
      dropoff_address: '4606 Market Street, San Diego, CA',
      pickup_address: '1041 Market Street, San Diego, CA' 
    }
    

    I haven't tested it but I believe the quote_id property can be used but the string has to be the full quote id.

    quote_id: 'dqt_Mc26u6TwH_qKkF', as oppose to quote_id: 'Mc26u6TwH_qKkF', like I had it.

    I will update the answer after verifying the latter