@@ -127,3 +127,95 @@ $.ajax({
127127});
128128```
129129
130+ ## ** PUT link**
131+
132+ Edit an existing link by its ID.
133+
134+ * ** URL** : Endpoint discussion in #7 .
135+ * ** Method:** ` PUT `
136+ * ** Path Parameters:**
137+
138+ * ** URL Parameters:** none
139+ * ** Body Parameters:**
140+
141+ ** Required:**
142+ * ** url** (string URL format): Shaared URL.
143+ * ** title** (string): Link title.
144+
145+ ** Optional:**
146+ * ** description** (string): Text describing the link.
147+ * ** tags** (array): list of tags associated to the link.
148+ * ** private** (boolean): set the link as private (default depending on user configuration).
149+
150+ ** Example:**
151+ ``` json
152+ {
153+ "url" : " http://ShaaredURL.com" ,
154+ "title" : " link title" ,
155+ "description" : " link description" ,
156+ "tags" : [
157+ " shaarli" ,
158+ " php" ,
159+ " api"
160+ ],
161+ "private" : true
162+ }
163+ ```
164+
165+ * **Success Response:** `200`
166+
167+ **Content:** edited link
168+ ```json
169+ {
170+ "id" : " linkID" ,
171+ "url" : " http://ShaaredURL.com" ,
172+ "title" : " link title" ,
173+ "description" : " link description" ,
174+ "tags" : [
175+ " shaarli" ,
176+ " php" ,
177+ " api"
178+ ],
179+ "private" : true ,
180+ "created" : " 2016-06-15T19:23:14+0200" ,
181+ "updated" : " not implemented yet"
182+ }
183+ ```
184+
185+ * **Error Response:**
186+ - `400`: Invalid parameters
187+
188+ **Content:**
189+ ```json
190+ { "message" : " URL is required." }
191+ ```
192+ - `401`: Invalid token/authentication.
193+ - `404`: Link ID not found.
194+ Content:
195+ ```json
196+ { "message" : " Link ID 'foobar' does not exist." }
197+ ```
198+
199+ * **Sample Call:**
200+
201+ ```javascript
202+ var formData = {
203+ "url" : " http://ShaaredURL.com" ,
204+ "title" : " link title" ,
205+ "description" : " link description" ,
206+ "tags" : [
207+ " shaarli" ,
208+ " php" ,
209+ " api"
210+ ],
211+ "private" : true ,
212+ };
213+ $.ajax({
214+ url: "[See #7]",
215+ type : "PUT",
216+ data : formData,
217+ success : function(r) {
218+ console.log(r);
219+ }
220+ });
221+ ```
0 commit comments