Skip to end of metadata
Go to start of metadata

RESTful Web Services for People and Organizations

HTTP Headers

When requesting content from ScienceBase services, use the Accept header to request a format such as

Accept: application/json

And when sending content in the body of a POST or PUT, use the Content-Type header to tell the server the format of the incoming content and add an Accept header to specify what format should be returned.

Content-Type: application/json
Accept: application/json

Older versions of some ScienceBase services conflated Content-Type and Accept headers. So some services have worked with only specifying one of these headers for both submitted and requested formats. Do not rely on that going forward. Use Accept to request a format from a service and Content-Type to describe data being sent to the service. POST and PUT methods involve both sending and receiving data so both headers should be used.



These services are being used by production applications such as ScienceBase-Catalog and are still an active work in progress. JSON (ScienceBase-JSON) is the preferred format, while there is an XML format, at least for Read operations, it's future is uncertain.  This current ScienceBase XML format might be replaced with a standard like ATOM.  To get ScienceBase-JSON make sure you add the header Accept: application/json or the query param format=json to the request.

  • No labels