Re: Simple Form Post to Add Contact to Account from Web Form/PHP Script

Highlighted
Occasional Participant

Re: Simple Form Post to Add Contact to Account from Web Form/PHP Script

"[{ "error_key":"mashery.not.authorized.inactive", "error_message":"The Mashery account associated with this request is not active, or an invalid API key was used." }]"

 

I've re-copied out the key for my Mashery Account (Which is completely "active")... stumped. Did I read over instructions to use HTTPS only? I would think that might be in the error message if required?

 

The above is the result I receive from my API calls. Interesting thing: My app discretely saves the JSON for the request. When I drag it into the Mashery I/O console, and re-run the call from there, I get "201 Created" perfection.

 

All with the same CC Access Token, and Mashery API Key. I'm sending the CC Account Token as an HTTP Header, the Mashery API-Key as a  GET parameter

 

CURLOPT_HTTPHEADER => array("Authorization: Bearer " . CC_TOKEN, /* My pre-defined constant with the token */
"Content-Type: application/json"

 

 

3 REPLIES 3
Highlighted
Honored Contributor

Re: Simple Form Post to Add Contact to Account from Web Form/PHP Script

Hello,

 

Based on what you've described, it may be best to have you email us directly so that you can provide the exact details of the request. As long as things are being correctly included in the request, then this error most certainly should not be happening. You can reach us by email at webservices@constantcontact.com to send us the full request that is being sent to the API.

 

Best Regards,

Elijah G.
API Support Engineer
Highlighted
Occasional Participant

Re: Simple Form Post to Add Contact to Account from Web Form/PHP Script

Thanks for the offer. I managed to figure this out. Silly, silly amateur mistake. I was editing one PHP file, but actually running a draft version with an expired API key. I figured it out when test panel input worked perfectly, but remote calls failed.

 

This was confusing because the error message suggests that there's a problem with the mashery account being "inactive" or some such. Really, this error message should read, "INVALID API KEY."

Highlighted
Honored Contributor

Re: Simple Form Post to Add Contact to Account from Web Form/PHP Script

Hello,

 

Thank you for the feedback on the error messaging!

 

In the case of this specific error message, it is a single message that matches a few conditions, including an inactive key and an invalid key. In the API response body, the message does mention that the cause may be an invalid key as well: "The Mashery account associated with this request is not active, or an invalid API key was used."

 

If you feel that this is still to ambiguous, I would be happy to follow up with the team on this to look into how we might improve the messaging.

 

Sincerely,

Elijah G.
API Support Engineer
Developer Portal

View API documentation, code samples, get your API key.