API:v1r1:test key

From MixxHelp

Jump to: navigation, search

API Main

Contents

Testing with the Echo Service

Testing Your Key

To test your API key, and to test to see that the Mixx API is seeing your requests as you intend it to, we've provided a simple echo service. The echo service, like all of our API's services, requires you to pass it a valid API key as the 'api_key' parameter. If you don't, it will return this error:

<?xml version="1.0" encoding="UTF-8"?>
<rsp stat="fail" api_version="v1r1">
  <err code="1" msg="You must supply a valid API key."/>
</rsp>

If you get that error, you may be passing your key incorrectly, or it may be invalid for some other reason. If you're sure you're passing it correctly in your API calls and it's not being accepted, you may have to contact us for help.

Testing GET and POST Requests

The echo service is a good way to test keys and test other calls because it doesn't take any action on the system, it simply echoes back to you what you sent it. If you send an HTTP GET request, it will echo back the parameters it got from you.

GET http://api.mixx.com/services/v1r1/echo?api_key=VALID_KEY

<?xml version="1.0" encoding="UTF-8"?>
<rsp stat="ok" api_version="v1r1">
<params>
  <action>index</action>
  <api_key>VALID_KEY</api_key>
  <controller>services/v1r1/echo</controller>
</params>
</rsp>

If you send a POST with XML data, it will echo back the payload.

POST <? xml version='1.0' charset='utf-8' ?><body><stuff>Yay stuff!</stuff></body>

<?xml version="1.0" encoding="UTF-8"?>
<rsp stat="ok" api_version="v1r1">
<payload>
  <body>
    <stuff>Yay stuff!</stuff>
  </body>
</payload>
</rsp>

Other Errors

Under certain circumstances, the echo service may return a status indicating the request succeeded, when in fact it encountered an unrecoverable error during rendering. This is the only service in the API that does this, and it looks like this when it happens:

<?xml version="1.0" encoding="UTF-8"?>
<rsp stat="ok" api_version="v1r1">
<error>Something about your request caused an exception. We are unable to perform an echo for you. 
Sometimes this happens if you passed a parameter with no value assigned to it.</error>
</rsp>

If that happens, ensure that your request is not malformed, and that all of your parameters have an assigned value. A common cause of this error is that a parameter is present in the URL, but has no value assigned to it.

Personal tools