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

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.

主站蜘蛛池模板: 婺源县| 绥中县| 峨山| 清河县| 湖北省| 闵行区| 双桥区| 庆元县| 莎车县| 南丰县| 天柱县| 涞源县| 文登市| 屏东市| 阳谷县| 长垣县| 靖远县| 嘉鱼县| 云龙县| 元氏县| 凤凰县| 广元市| 罗定市| 博乐市| 盈江县| 息烽县| 深州市| 凉山| 舟山市| 阜阳市| 新巴尔虎左旗| 申扎县| 比如县| 璧山县| 博兴县| 盐山县| 竹溪县| 彝良县| 赣州市| 襄汾县| 金堂县|