Videntity 101 - A Background on Communicating with Videntity through HTTP

From Videntity Documentaion Wiki

Revision as of 01:50, 24 November 2008 by Aviars (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

Communicating with the Videntity API is achieved through the HTTP method, POST. All POST data must be URL encoded and in web form format. Specifically, this means that the Content-Type is set to Content-Type: application/x-www-form-urlencoded) for transactions without binary attachments and Content-Type: multipart/form-data for transactions carrying binary data (these typically represent file or some sort of binary object.). You can create and send a HTTP POST directly and communicate with the server. You can also use a Python wrapper which can simplify your development. Other open source wrapper packages are in development including Java and C# .NET. This section can help you would build your own Videntity client. To use our Python interface please go to Python API Interface.


Contents

HTTP POST

You can do a raw HTTP POST to the Videntity server, but it is far easier to simply use some built in language specific URL opener like urllib for Python that handles all the HTTP semantics for you. Or you could use our python API interface. Anyway, the following example demonstrates a pure HTTP POST to our server.

Take the following URL example to send a login request:

    https://vidapi.com/session/login

first open a socket to the host https://videntity.com, port 443 (use the default SSL port of 443). Then, send something like the following through the socket:

    POST /session/login HTTPS/1.0
    From: cboyce@videntity.com
    User-Agent: Python-urllib/1.16
    Content-Length: 71
    Content-Type: application/x-www-form-urlencoded
    username=cboyce&password=Ry5NvPAbceAS123&account_number=210983749212839

This example would be used to send a HTTP POST of my username, password, and account_number to the login API method at videntity.com.

Note that all POST data must be url encoded and sent with the correct content type.

Content Types and URL Encoding

Currently Videntity only accepts two Content Types:

Content-Type: application/x-www-form-urlencoded

The application/x-www-form-urlencoded content type is used to take form POST data as is taken through a web browser form.

Content-Type: multipart/form-data

The multipart/form-data content type is used to take form file POST data and form POST data as is taken through a web browser file upload and form.

The form data must be URL encoded as in:

username=cboyce&password=Ry5NvPAbceAS123&account_number=210983749212839

For more on form content types please refer to w3C form content types

Methods

Every POST Request is sent to a specific method URL (i.e https://videntity.com/session/login, https://videntity.com/session/ping). For a detailed description of Methods and input form parameters please see API Methods

Responses

When a POST request is sent, the request returns a response from the Videntity server. The response is an XML document. If no data is sent to the URL (ie. you fo an HTTP GET) the service just returns the blank form information. When you send data with POST the server returns an XML document with a status code of SUCCESS, PENDING, or FAIL. For detailed description on responses goto of the response see API Responses