The Codesem API will provide access to our services and information to our authors. If you would like to see a particular function added, please click the Contact menu item above. API calls are implemented as HTTP POST calls to https://api.codsem.com/api
PHP Class with Examples: codesem-api.zip (should work on PHP 5.2 and newer).
The only setup needed is to go to the API Key tab and get your API key. You will be given a public API key used to authenticate your API calls.
Every API call has a SHA-512 HMAC signature generated with your API key. Our server generates it's own HMAC signature and compares it with the API caller's. If they don't match the API call is discarded. The HMAC signature is sent as a HTTP header called 'HMAC'.
The HMAC signature is created from the full raw POST data of your request. For example if your API key was "test" and you were using the verify_purchase function the raw request might look like:
purchase_code=client_purchase_code&version=1&cmd=verify_purchase&key=client_api_key&format=json
and the HMAC would be: 5590eac015e7692902e1a9cd5464f1d305a4b593d2f1343d826ac5affc5ac6f960a5167284f9bf31295cba0e04df9d8f7087935b5344c468ccf2dd036e159102
The API will return an array with 2 or 7 elements. The result will always have an 'code' field. If its value is 'success' (case-sensitive) the API call was a success, otherwise it will appear 'error' field contain an error message.
Copyright © 2021 Codesem