Most of the search features in the APIs are controlled via parameters passed in either with the query string portion of the URL, or as part of a block of text passed to the API via a HTTP POST. The Infoconnect API, and indeed many RESTful APIs, uses HTTP headers to communicate what the format of the data is coming in and going out. HTTP headers are basically a collection of key/value pair text parameters that make up part of the underlying HTTP communication between a client and a server. It's this under-the-hood nature of these that usually cause most of the confusion.

The Infoconnect API uses 2 headers to let the client communicate what format the POST data is in, and what format the client wants the data returned in:


To tell the API what kind of data you are submitting, you need to set the content type parameter to either 'application/json' when sending data in JSON format, or 'application/xml' when sending data in XML format. If you don't specify one of those two types, or don't send the Content-Type header at all, the API will fail with a HTTP status of 405. It's basically the API's way of saying, "I don't know what you are saying".


The accept header is used to tell the API what format you would like any data returned in. Just like the Content-Type parameter, you can specify 'application/json' for JSON and 'application/xml' for XML. This parameter controls all the data that the Infoconnect API returns, which includes error messages as well. If you don't include the Accept header, or specify something other than JSON or XML, the API returns a HTTP status of 415. This is the API telling you it doesn't support the format you asked for.

NOTE: One thing to keep in mind about the Accept header is that depending on the client you are using (browser, cURL, Java, what-have-you) the Accept header may have a default value. For example, most browsers will automatically send the Accept header set to '*/*' which is the browser's way of saying - "I can handle anything you send me!". The Infoconnect API will return JSON in this case as the default. Other tools might not set the accept header by default, so it's always a good idea to be explicit about what kind of data you want returned!