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

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.

主站蜘蛛池模板: 报价| 峡江县| 柳江县| 若羌县| 长武县| 金昌市| 获嘉县| 石城县| 蒙城县| 叶城县| 荃湾区| 乐东| 大兴区| 安福县| 祁门县| 苗栗市| 米脂县| 富源县| 成安县| 北安市| 乐昌市| 高碑店市| 平泉县| 陇西县| 儋州市| 精河县| 宜州市| 县级市| 西贡区| 连州市| 比如县| 寿阳县| 津市市| 乳山市| 定西市| 城步| 积石山| 海门市| 华宁县| 大邑县| 平谷区|