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

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.

主站蜘蛛池模板: 阿尔山市| 开远市| 广宁县| 江都市| 海兴县| 镇雄县| 时尚| 澎湖县| 南宁市| 莱阳市| 谷城县| 博罗县| 三门县| 伊春市| 齐齐哈尔市| 吉木乃县| 文登市| 历史| 北辰区| 峡江县| 安乡县| 太白县| 八宿县| 九龙坡区| 永昌县| 昆山市| 辉南县| 珲春市| 五寨县| 杭州市| 青冈县| 彩票| 筠连县| 丹阳市| 石城县| 同仁县| 北碚区| 洪湖市| 响水县| 甘德县| 揭阳市|