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

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.

主站蜘蛛池模板: 新平| 南开区| 玛曲县| 佛山市| 航空| 乐陵市| 伊宁市| 海兴县| 修武县| 泸水县| 高密市| 师宗县| 正定县| 武安市| 洛宁县| 廉江市| 富顺县| 石渠县| 施秉县| 兴义市| 新兴县| 泾川县| 萨嘎县| 宜春市| 五莲县| 西华县| 蛟河市| 五常市| 兰考县| 平度市| 肃北| 广丰县| 晋州市| 溆浦县| 澳门| 家居| 静安区| 突泉县| 通海县| 肥乡县| 青神县|