Default media types

For RESTful Web services developed using the high-level framework, you can specify the MIME time or you can accept the default. The default MIME type is based on the data type.

Table 1 lists the default MIME types. These default MIME types are used when WSMedia is not set or when the Accept or Content-Type HTTP headers are not set in requests and responses. The data type determines the default MIME type for message content.
Note: A media type (also known as Multipurpose Internet Mail Extensions (MIME) type) is an identifier used by the HTTP protocol to denote message content. The format is based on standards from the Internet Assigned Numbers Authority (IANA).
Table 1. Data types and default MIME types
Data type Example MIME type
Simpletype Simple types are data structures that represent a simple value like strings, numbers, and booleans.
DEFINE x, y INTEGER
DEFINE s STRING
DEFINE b BOOLEAN
text/plain
Record (only) A structure of type RECORD that defines a fixed number of elements.
DEFINE rec RECORD
  x, y INTEGER
END RECORD
application/json

Record and array

A structured type like a dynamic array or a record with dynamic elements like an array and all other types supported by the BDL to JSON conversion class.
DEFINE arr DYNAMIC ARRAY OF STRING
DEFINE rec DYNAMIC ARRAY OF RECORD
  x, y INTEGER
END RECORD
Note: Static arrays are not supported.
application/json

The default MIME type for records and arrays in the message response or request is JSON (application/json). If you do not set the MIME type with the WSMedia attribute, the response or request will be in JSON.

BYTE A structured BYTE data type that defines a large object structure for any binary data, such as images or sounds.
DEFINE b BYTE
application/octet-stream

The Image file type (image/* )

A special media type identifies an image file. It consists of an identifier and a wildcard (image/* ) Set in WSMedia, this type allows the Web service to handle all image file types: .jpeg, .png, and so on. For an example, see Attach files with WSAttachment and WSMedia.