API: ETag/If-None-Match for Get single note
This commit is contained in:
parent
002dc3ff16
commit
a2e054c672
|
@ -91,9 +91,11 @@ No valid authentication credentials supplied.
|
|||
| Parameter | Type | Description |
|
||||
|:------|:-----|:-----|
|
||||
| `id` | integer, required (path) | ID of the note to query. |
|
||||
| `If-None-Match` | HTTP header, optional | Use this in order to reduce transferred data size (see [HTTP ETag](https://en.wikipedia.org/wiki/HTTP_ETag)). You should use the value from the note's attribute `etag` or from the last request's HTTP response header `ETag`. | 1.2 |
|
||||
|
||||
#### Response
|
||||
##### 200 OK
|
||||
- **HTTP Header**: `ETag` (see [HTTP ETag](https://en.wikipedia.org/wiki/HTTP_ETag)). The value is identical to the note's attribute `etag` (see section [Note attributes](#note-attributes)).
|
||||
- **Body**: note (see section [Note attributes](#note-attributes)), example:
|
||||
```js
|
||||
{
|
||||
|
|
|
@ -68,7 +68,10 @@ class NotesApiController extends ApiController {
|
|||
return $this->helper->handleErrorResponse(function () use ($id, $exclude) {
|
||||
$exclude = explode(',', $exclude);
|
||||
$note = $this->service->get($this->helper->getUID(), $id);
|
||||
return $this->helper->getNoteData($note, $exclude);
|
||||
$noteData = $this->helper->getNoteData($note, $exclude);
|
||||
return (new JSONResponse($noteData))
|
||||
->setETag($noteData['etag'])
|
||||
;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -5029,6 +5029,19 @@
|
|||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
|
||||
},
|
||||
"node_modules/fsevents": {
|
||||
"version": "2.3.2",
|
||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
|
||||
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
|
||||
"hasInstallScript": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/function-bind": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
||||
|
@ -14816,6 +14829,12 @@
|
|||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
|
||||
},
|
||||
"fsevents": {
|
||||
"version": "2.3.2",
|
||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
|
||||
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
|
||||
"optional": true
|
||||
},
|
||||
"function-bind": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
||||
|
|
Loading…
Reference in New Issue