Documentation

Because application developers are a diverse bunch, we've set up a number of ways to use Cofactor Web functions programmatically.

Cofactor Web function APIs

You can access the REST/HTTP interfaces of Cofactor Web functions directly from your applications.

The Cofactor Web function APIs are RESTful APIs located at https://wf.cofactor.io.

The Cofactor API speaks exclusively in JSON. When carrying body data, POST requests can only include JSON payloads. You should always set the Content-Type header to application/json to ensure that your requests are properly accepted and processed by Web functions.

Authentication

Cofactor Web functions use keys for authentication/authorization. A key is a token that your application needs to provide when making HTTP requests.

There are three ways you can provide the key with your requests:

  1. Include the key in the query string. The key is sent as a value of the key query parameter. This works for both GET and POST requests:
    GET https://wf.cofactor.io/my-public-ip-address?key=YOUR_KEY
    POST https://wf.cofactor.io/my-public-ip-address?key=YOUR_KEY
  2. Include the key in the JSON payload of POST requests. The key is sent as a value of the key field of the JSON payload and is sent in the body of the request.
    POST https://wf.cofactor.io/my-public-ip-address
    
    {"key":"YOUR_KEY"}
  3. Use the X-Cofactor-Key HTTP header. Add the X-Cofactor-Key header with the value of the key. This works for both GET and POST requests.
    GET https://wf.cofactor.io/my-public-ip-address
    X-Cofactor-Key YOUR_KEY
    POST https://wf.cofactor.io/my-public-ip-address
    X-Cofactor-Key YOUR_KEY

The keys are supposed to be kept secret. Key-based authentication is only considered secure if used together with HTTPS/SSL.

Long-running jobs and polling

Some Web functions may take several minutes to run.They initially respond with the 202 status code and the job ID.

Polling is the mechanism that allows you to check the status of the long-running job using the following URL:

GET https://wf.cofactor.io/WEB_FUNCTION_NAME/JOB_ID
Web functions
BrowseDocs
Initiatives
OraPolyglotNym
Auckland · New Zealand
© 2018 Cofactor Ltd.
Cofactor