When you create a Services endpoint, you can enable various request parsers that specify how requests can be sent to your service. You can also enable various response formatters, which specify the data format that will be used to return any data sent back in response to your request.

Available request parsers

Each request parser has a characterizing internet media type (also known as a MIME type or content-type). Most of the media types recognized by the Services module are subtypes of the "application" media type, indicating that the request is being submitted to an application program (your Drupal website) for processing to generate the result. The following request parsers are built into the Services module:

  • application/json: Requests are encoded using JavaScript Object Notation (JSON)
  • application/vnd.php.serialized: Requests are encoded using the data format emitted by PHPs "serialize()" function.
  • application/x-www-form-urlencoded: For requests that are submitted via an HTML form. When sent in an HTTP GET request, application/x-www-form-urlencoded data is included in the query component of the request URI. When sent in an HTTP POST request, the data is placed in the body of the message.
  • application/x-yaml: Requests are encoded using the YAML markup language.
  • multipart/form-data: For forms that use representations other than HTML, such as file attachments. a "multipart/form-data" request contains a series of parts, each of which corresponds to a separate field name in the form and has its own content-disposition header.

Available response formatters

  • bencode: The encoding used by the BitTorrent file sharing system.
  • json: JavaScript Object Notation
  • jsonp: JSON with padding
  • php: Responses are encoded using the data format emitted by PHPs "serialize()" function
  • rss
  • xml
  • yaml