私はこのような何か.... ブックス持つ:ユーザーたいがする場合現在のAPIを快適なAPIに変更するにはどうすればよいですか?
http://www.mydomain.com/books.php
: 私は唯一のポストの要求を受け入れることを、PHPのプログラムを持っている...が、リンクはこのようなものです 登録:: のparams:
a=c //a = action
d=a array of dataJson //d = a defined books data in Json format
u=user id
s=session key
と私は戻ります:
要求を行う、彼らはこのような何かを行う必要がありますIDの0/!0 //0 = success case, !0 will give the error code
配列//新しい項目 アレイID
読む作成:すべての書籍を返却、
a=r //a = action
id=the books id (optional) //read the books from book id
title= a books title (optional) //read the books from title
author= an author (optional) //read the books from author
u=user id
s=session key
//なしオプションのparamsの場合: のparamsを。
と私は戻ります:
更新: のparams:
a=u //a = action
id=the books id //update the books from book id
d=a dataJson //d = a defined books data in Json format
u=user id
s=session key
と私は戻ります:
のparams:0/!0 //0 = success case, !0 will give the error code
は削除
a=d //a = action
id=the books id //delete the books from book id
u=user id
s=session key
と私が返されます:私の現在の設計は、 "REST" 道に移動するため
0/!0 //0 = success case, !0 will give the error code
は、このOKですか?ありがとうございました。
あなたがあなたのコントロール下でのインターフェイスを持っているのですか? POSTのみをサポートすることは、安らかなAPIの大きな制約です。あなたは重要な「統一インターフェース」の原則を破棄します。あなたがコントロールしているAPIを持っていれば、私は他のHTTPメソッド(PUT、DELETEなど)をサポートするように努力します。 –