Precondition Failed: planId|planCode required
Howdy, having trouble creating a new customer via the API.
Running out of ideas here... We've tried adding planId
and planCode
everywhere we can think of, yet we still
receive this error:
#<CheddarGetter::Response:0x252982c
@responseType="error", @document=<?xml version="1.0"
encoding="UTF-8"?> <error code="412">Precondition Failed:
planId|planCode required.</error>
Here's the hash we're giving to
Request#newCustomer
:
{"lastName"=>"Customer",
"code"=>"EXAMPLE_CUSTOMER",
"planId"=>"722103ea-e229-102c-a92d-40402145ee8b",
"planCode"=>"PLUS",
"firstName"=>"Example",
"subscription"=>
{"ccZip"=>"90210",
"ccNumber"=>"4111111111111111",
"planId"=>"722103ea-e229-102c-a92d-40402145ee8b",
"planCode"=>"PLUS",
"ccLastName"=>"Customer",
"ccFirstName"=>"Example",
"ccExpiration"=>"04-2011"},
"email"=>"[email blocked]"}
Discussions are closed to public comments.
If you need help with Cheddar please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Marc Guyer on 24 Aug, 2009 08:56 PM
The customer information is just basic stuff: name, email, code. The subscription array is the meat. The planCode must be part of that subscription array.
Marc Guyer closed this discussion on 24 Aug, 2009 08:56 PM.
Support Staff 2 Posted by Marc Guyer on 24 Aug, 2009 09:01 PM
That error message doesn't make it clear. I've added a todo item to make it clearer. Thanks for bringing this up!
Jon Larkowski re-opened this discussion on 24 Aug, 2009 09:14 PM
3 Posted by Jon Larkowski on 24 Aug, 2009 09:14 PM
We do have
planCode
in thesubscription
array, but it's still throwing the error. Could we maybe see an example of valid low-level POST data for the /customers/new/productCode/MY_PRODUCT_CODE action?Support Staff 4 Posted by Marc Guyer on 24 Aug, 2009 10:30 PM
I see now that you have the planCode in the subscription nested hash. I saw it in the root hash and stopped looking. It might be an issue with HTTParty handling the :query argument differently than expected.
Here's a very simple example to test using cURL at the command line. If the plan isn't "free", you'll need the rest of the subscription data.
5 Posted by Jon Larkowski on 25 Aug, 2009 12:38 PM
Turns out that using the
:body
key instead of the:query
key when callingRequest.post
solves this.Support Staff 6 Posted by Marc Guyer on 25 Aug, 2009 01:51 PM
I guess my rudimentary tests never sent a post. Hmm... Thanks for
troubleshooting that.
Marcela Poffald closed this discussion on 11 Apr, 2018 06:02 PM.