私は、他の人が私たちのサービスを自分のシステムに統合できるようにする API を作成しています。
回答を定式化する最善の方法を見つけるのは簡単ではありません。私は非常に多くの異なる方法を見てきました。多くの場合、それは非常に貧弱に行われ、私や他の人はそれを使用するのに苦労しています.
これが私がやった方法です:
<xml>
<HttpResponse>200</HttpResponse>
<data>
<report>
<id>200</id>
<date>07.03.2013 11:13:00</date>
<title>Fake report 1</title>
<content>Lorem ipsum dolor sit amet.</content>
</report>
<report>
<id>448</id>
<date>10.04.2013 12:13:34</date>
<title>Fake report 2</title>
<content>Lorem ipsum dolor sit amet.</content>
</report>
<report>
<id>927</id>
<date>25.10.2013 11:49:34</date>
<title>Fake report 3</title>
<content>Lorem ipsum dolor sit amet.</content>
</report>
</data>
</xml>
エラーがある場合、HttpResponse はこれを通知する適切なコードを提供し、データには次のようなエラーの説明が含まれます。
<xml>
<HttpResponse>418</HttpResponse>
<data>
<error>
<code>AB43</code> /* <<-- this code says what I can search for in the code to find the exact process/line where it failed */
<description>You are the one who messed up!!!</description>
</error>
</data>
</xml>
私の質問は単純です:この回答は意味がありますか?
考慮していないシナリオはありますか?
このような応答からデータを取得するのに問題はありますか?
他にどうすればこれを行うことができますか?
ところで: JSON は使用しません。議論は終わりです!