API Authentication

Updated on Friday, 5 April, 2013 - 16:54

You access DataSift's APIs in two ways:

  • Use HTTP headers
  • Place all the parameters in a GET/POST request

 

HTTP Headers

This is the recommended appropach for production environments.

You need to include a header that contains: "Auth: username:apikey"

Most client libraries already support this authorization system.

 

GET/POST Requests

Accessing a DataSift API endpoint using GET/POST parameters is the simpler approach. It is sometimes useful for testing. Here's an example that calls the REST API to compile a CSDL filter:

    https://api.datasift.com/compile?csdl=<csdl>&username=<username>&api_key=<api_key>

Note that when you hit the Streaming API using the Websocket protocol, you must authenticate in the URI using GET parameters - there is no other option. In this case, the URI format is:

    ws://websocket.datasift.com/<hash>?username=<username>&api_key=<api_key>