Skip to content
This repository was archived by the owner on Jan 4, 2024. It is now read-only.

Club API & Testing

Greg Annandale edited this page Mar 10, 2017 · 2 revisions

The documentation for api.codeclubworld.org is available here: http://docs.codeclubworldapiv2.apiary.io

The interactive portion of these docs provides a mock API server - it's possible to send calls over to it to ensure you're seeing the correct responses in return.

To do this, choose an endpoint / action, eg:

You'll see a test URL near the top on the right (https://private-xxxxx-codeclubworldapiv2.apiary-mock.com/clubs). You can use this URL for mocking calls (ie. replace the value of CCW_API_URL in the theme's inc/country-config.php with that Apiary URL, minus the /club portion). Firing off calls to the mock server will return responses such as the following on club creation:

HTTP/1.1 201 Created
Server: Cowboy
Connection: keep-alive
X-Apiary-Ratelimit-Limit: 120
X-Apiary-Ratelimit-Remaining: 119
Content-Type: application/json
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: OPTIONS,GET,HEAD,POST,PUT,DELETE,TRACE,CONNECT   
Access-Control-Max-Age: 10
X-Apiary-Transaction-Id: 58c14a56d6584c1900186e83
Content-Length: 1184
Date: Thu, 09 Mar 2017 12:28:07 GMT
Via: 1.1 vegur

{ club json here ... }

It'll display errors if the request is malformed.

You can also use Apiary to generate example API calls in many languages/formats:

Clone this wiki locally