Troubleshooting creation of new customer in testing

david.ells's Avatar

david.ells

28 Sep, 2009 08:44 PM

I'm testing out the CG api using my own java client library, but I'm running into an issue early on.

The following API call works just fine for adding a customer without credit card information to our trial plan:

URL: https://cheddargetter.com/xml/customers/new/productCode/SCORM_CLOUD...
post data:

code=EXAMPLE_CUSTOMER&email=test%40test.com&firstName=Example&subscription%5BplanCode%5D=SCORM_CLOUD_TRIAL&company=Test+Inc.&lastName=Customer

However, with everything else equal, the following call results in a 412 response:

URL: https://cheddargetter.com/xml/customers/new/productCode/SCORM_CLOUD...
post data:

subscription%5BccExpiration%5D=04-2011&code=EXAMPLE_CUSTOMER&subscription%5BccLastName%5D=Customer&email=test%40test.com&firstName=Example&subscription%5BccZip%5D=90210&subscription%5BccNumber%5D=4111111111111111&subscription%5BccFirstName%5D=Example&subscription%5BplanCode%5D=SCORM_CLOUD_LITTLE&company=Test+Inc.&lastName=Customer

Can you see any reason why I'm running into problems with the second test?

Also, is there any way to get more detailed information when an API call fails? A response of 412 leaves me in the dark about what parameter may be invalid or missing.

  1. Support Staff 1 Posted by Marc Guyer on 28 Sep, 2009 08:58 PM

    Marc Guyer's Avatar

    David - The response should contain information about the missing or
    invalid parameter. A small XML document with an error node is returned.

  2. 2 Posted by david.ells on 28 Sep, 2009 09:19 PM

    david.ells's Avatar

    Marc, thank you. That was one part misreading the error message section on the API page and one part being a java dummy and forgetting about getErrorStream() on a URLConnection. Thanks, I can see a much more informative error message now, which actually tells me that the subscription[ccExpirationDate] should be in MM/YYYY format, not MM-YYYY, as listed in the API doc.

  3. Support Staff 3 Posted by Marc Guyer on 29 Sep, 2009 03:32 PM

    Marc Guyer's Avatar

    Oops. Just corrected the docs. Thanks for letting us know.

    Yeah -- I remember how java didn't think it should give you the body of an error document without jumping through some hoops. That's annoying. There's a similar annoyance in .Net I've heard.

  4. Support Staff 4 Posted by Marc Guyer on 05 Oct, 2009 07:21 PM

    Marc Guyer's Avatar

    Will you be making your java client publicly available?

    If nothing else, I'd greatly appreciate a bit of sample java code.

  5. 5 Posted by david.ells on 06 Oct, 2009 08:25 PM

    david.ells's Avatar

    Absolutely. Just need to clean it up a bit, but was certainly planning on it. Is there a preferred method to share the code? Github?

  6. Support Staff 6 Posted by Marc Guyer on 06 Oct, 2009 10:12 PM

    Marc Guyer's Avatar

    Good news!

    All of the other API wrappers are on GitHub so that would make the most sense. It's up to you though.

  7. Marc Guyer closed this discussion on 06 Oct, 2009 10:12 PM.

  8. Marc Guyer re-opened this discussion on 18 Mar, 2010 04:28 PM

  9. Support Staff 7 Posted by Marc Guyer on 18 Mar, 2010 04:28 PM

    Marc Guyer's Avatar

    Hello again David! Are you ready to release your Java wrapper to the world?

  10. 8 Posted by Jack Li on 26 May, 2010 05:13 PM

    Jack Li's Avatar

    Hey David,

    I am interested in your Java wrapper for CG. Can you release your code on github? Thanks for your help

  11. 9 Posted by Tryggvi Larusso... on 15 Jun, 2010 10:16 AM

    Tryggvi Larusson's Avatar

    Hey David,

    I'm also interested in your Java Wrapper for CG. Would be brilliant to get it out on github. Thanks in advance!

    Tryggvi

  12. 10 Posted by david.ells on 27 Apr, 2011 10:21 PM

    david.ells's Avatar

    I know it's monstrously overdue, but we've finally published our CheddarGetter java wrapper as a public repository on GitHub. https://github.com/RusticiSoftware/CheddarClient

  13. Support Staff 11 Posted by Marc Guyer on 28 Apr, 2011 07:23 PM

    Marc Guyer's Avatar

    Very cool David. We'll put the word out.

  14. Marc Guyer closed this discussion on 28 Apr, 2011 07:23 PM.

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

Recent Discussions

28 Mar, 2024 10:45 PM
24 Jan, 2024 08:33 AM
11 Jan, 2024 07:13 AM
30 Nov, 2023 02:07 AM
22 Nov, 2023 08:41 AM