官术网_书友最值得收藏!

Resource representation

Resource representation defines the data format of the response. The response message may be in any one of the following formats:

  • Plain text
  • Form-encoding
  • XML
  • HTML
  • JSON
  • Any other Internet media type, provided that it is a valid hypertext standard

You can specify the format of the delivery content by setting the Content-Type header value in the request headers to the service. REST APIs commonly use either the application/json or application/xml media type.

Here is an example of a header request for JSON:

Content-Type: application/json
Host: localhost:65437
Content-Length: 69

Now, we'll see an example for XML:

Content-Type: application/xml
Host: localhost:65437
Content-Length: 69
Tip

Remember to use XML to transfer documents and JSON for data transfers.

主站蜘蛛池模板: 上饶市| 库尔勒市| 织金县| 晋江市| 澜沧| 武功县| 沙坪坝区| 永丰县| 阿拉善右旗| 政和县| 历史| 都匀市| 即墨市| 于田县| 通州市| 驻马店市| 屯门区| 滁州市| 宜州市| 城口县| 资阳市| 拉萨市| 仲巴县| 阿瓦提县| 大安市| 高台县| 桦甸市| 宁都县| 宣城市| 南陵县| 巨野县| 阿鲁科尔沁旗| 象州县| 平潭县| 武川县| 青龙| 宣汉县| 伊春市| 太原市| 吴旗县| 泰安市|