mirror of
https://github.com/laurent22/joplin.git
synced 2026-06-18 20:16:34 +02:00
Doc: Fixes #9171: Fixed data API doc
This commit is contained in:
@@ -81,7 +81,7 @@ class Command extends BaseCommand {
|
|||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('This would be an example of valid cURL call using a token:');
|
lines.push('This would be an example of valid cURL call using a token:');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('\tcurl http://localhost:41184/notes?token=ABCD123ABCD123ABCD123ABCD123ABCD123');
|
lines.push('```shell\ncurl http://localhost:41184/notes?token=ABCD123ABCD123ABCD123ABCD123ABCD123\n```');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('In the documentation below, the token will not be specified every time however you will need to include it.');
|
lines.push('In the documentation below, the token will not be specified every time however you will need to include it.');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
@@ -92,13 +92,13 @@ class Command extends BaseCommand {
|
|||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('All the calls, unless noted otherwise, receives and send **JSON data**. For example to create a new note:');
|
lines.push('All the calls, unless noted otherwise, receives and send **JSON data**. For example to create a new note:');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('\tcurl --data \'{ "title": "My note", "body": "Some note in **Markdown**"}\' http://localhost:41184/notes');
|
lines.push('```shell\ncurl --data \'{ "title": "My note", "body": "Some note in **Markdown**"}\' http://localhost:41184/notes\n```');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('In the documentation below, the calls may include special parameters such as :id or :note_id. You would replace this with the item ID or note ID.');
|
lines.push('In the documentation below, the calls may include special parameters such as :id or :note_id. You would replace this with the item ID or note ID.');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('For example, for the endpoint `DELETE /tags/:id/notes/:note_id`, to remove the tag with ID "ABCD1234" from the note with ID "EFGH789", you would run for example:');
|
lines.push('For example, for the endpoint `DELETE /tags/:id/notes/:note_id`, to remove the tag with ID "ABCD1234" from the note with ID "EFGH789", you would run for example:');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('\tcurl -X DELETE http://localhost:41184/tags/ABCD1234/notes/EFGH789');
|
lines.push('```shell\ncurl -X DELETE http://localhost:41184/tags/ABCD1234/notes/EFGH789\n```');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('The four verbs supported by the API are the following ones:');
|
lines.push('The four verbs supported by the API are the following ones:');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
@@ -112,11 +112,11 @@ class Command extends BaseCommand {
|
|||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('You can change the fields that will be returned by the API using the `fields=` query parameter, which takes a list of comma separated fields. For example, to get the longitude and latitude of a note, use this:');
|
lines.push('You can change the fields that will be returned by the API using the `fields=` query parameter, which takes a list of comma separated fields. For example, to get the longitude and latitude of a note, use this:');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('\tcurl http://localhost:41184/notes/ABCD123?fields=longitude,latitude');
|
lines.push('```shell\ncurl http://localhost:41184/notes/ABCD123?fields=longitude,latitude\n```');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('To get the IDs only of all the tags:');
|
lines.push('To get the IDs only of all the tags:');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('\tcurl http://localhost:41184/tags?fields=id');
|
lines.push('```shell\ncurl http://localhost:41184/tags?fields=id\n```');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('By default API results will contain the following fields: **id**, **parent_id**, **title**');
|
lines.push('By default API results will contain the following fields: **id**, **parent_id**, **title**');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
@@ -134,15 +134,15 @@ class Command extends BaseCommand {
|
|||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('The following call for example will initiate a request to fetch all the notes, 10 at a time, and sorted by "updated_time" ascending:');
|
lines.push('The following call for example will initiate a request to fetch all the notes, 10 at a time, and sorted by "updated_time" ascending:');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('\tcurl http://localhost:41184/notes?order_by=updated_time&order_dir=ASC&limit=10');
|
lines.push('```shell\ncurl http://localhost:41184/notes?order_by=updated_time&order_dir=ASC&limit=10\n```');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('This will return a result like this');
|
lines.push('This will return a result like this');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('\t{ "items": [ /* 10 notes */ ], "has_more": true }');
|
lines.push('```json\n{ "items": [ /* 10 notes */ ], "has_more": true }\n```');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('Then you will resume fetching the results using this query:');
|
lines.push('Then you will resume fetching the results using this query:');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('\tcurl http://localhost:41184/notes?order_by=updated_time&order_dir=ASC&limit=10&page=2');
|
lines.push('```shell\ncurl http://localhost:41184/notes?order_by=updated_time&order_dir=ASC&limit=10&page=2\n```');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('Eventually you will get some results that do not contain an "has_more" paramater, at which point you will have retrieved all the results');
|
lines.push('Eventually you will get some results that do not contain an "has_more" paramater, at which point you will have retrieved all the results');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
@@ -314,17 +314,17 @@ async function fetchAllNotes() {
|
|||||||
if (model.type === BaseModel.TYPE_RESOURCE) {
|
if (model.type === BaseModel.TYPE_RESOURCE) {
|
||||||
lines.push('Creating a new resource is special because you also need to upload the file. Unlike other API calls, this one must have the "multipart/form-data" Content-Type. The file data must be passed to the "data" form field, and the other properties to the "props" form field. An example of a valid call with cURL would be:');
|
lines.push('Creating a new resource is special because you also need to upload the file. Unlike other API calls, this one must have the "multipart/form-data" Content-Type. The file data must be passed to the "data" form field, and the other properties to the "props" form field. An example of a valid call with cURL would be:');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('\tcurl -F \'data=@/path/to/file.jpg\' -F \'props={"title":"my resource title"}\' http://localhost:41184/resources');
|
lines.push('```shell\ncurl -F \'data=@/path/to/file.jpg\' -F \'props={"title":"my resource title"}\' http://localhost:41184/resources\n```');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('To **update** the resource content, you can make a PUT request with the same arguments:');
|
lines.push('To **update** the resource content, you can make a PUT request with the same arguments:');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('\tcurl -X PUT -F \'data=@/path/to/file.jpg\' -F \'props={"title":"my modified title"}\' http://localhost:41184/resources/8fe1417d7b184324bf6b0122b76c4696');
|
lines.push('```shell\ncurl -X PUT -F \'data=@/path/to/file.jpg\' -F \'props={"title":"my modified title"}\' http://localhost:41184/resources/8fe1417d7b184324bf6b0122b76c4696\n```');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('The "data" field is required, while the "props" one is not. If not specified, default values will be used.');
|
lines.push('The "data" field is required, while the "props" one is not. If not specified, default values will be used.');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('Or if you only need to update the resource properties (title, etc.), without changing the content, you can make a regular PUT request:');
|
lines.push('Or if you only need to update the resource properties (title, etc.), without changing the content, you can make a regular PUT request:');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('\tcurl -X PUT --data \'{"title": "My new title"}\' http://localhost:41184/resources/8fe1417d7b184324bf6b0122b76c4696');
|
lines.push('```shell\ncurl -X PUT --data \'{"title": "My new title"}\' http://localhost:41184/resources/8fe1417d7b184324bf6b0122b76c4696\n```');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('**From a plugin** the syntax to create a resource is also a bit special:');
|
lines.push('**From a plugin** the syntax to create a resource is also a bit special:');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
@@ -356,21 +356,21 @@ async function fetchAllNotes() {
|
|||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('* Create a note from some Markdown text');
|
lines.push('* Create a note from some Markdown text');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push(' curl --data \'{ "title": "My note", "body": "Some note in **Markdown**"}\' http://127.0.0.1:41184/notes');
|
lines.push('```shell\ncurl --data \'{ "title": "My note", "body": "Some note in **Markdown**"}\' http://127.0.0.1:41184/notes\n```');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('* Create a note from some HTML');
|
lines.push('* Create a note from some HTML');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push(' curl --data \'{ "title": "My note", "body_html": "Some note in <b>HTML</b>"}\' http://127.0.0.1:41184/notes');
|
lines.push('```shell\ncurl --data \'{ "title": "My note", "body_html": "Some note in <b>HTML</b>"}\' http://127.0.0.1:41184/notes\n```');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('* Create a note and attach an image to it:');
|
lines.push('* Create a note and attach an image to it:');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push(' curl --data \'{ "title": "Image test", "body": "Here is Joplin icon:", "image_data_url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAANZJREFUeNoAyAA3/wFwtO3K6gUB/vz2+Prw9fj/+/r+/wBZKAAExOgF4/MC9ff+MRH6Ui4E+/0Bqc/zutj6AgT+/Pz7+vv7++nu82c4DlMqCvLs8goA/gL8/fz09fb59vXa6vzZ6vjT5fbn6voD/fwC8vX4UiT9Zi//APHyAP8ACgUBAPv5APz7BPj2+DIaC2o3E+3o6ywaC5fT6gD6/QD9/QEVf9kD+/dcLQgJA/7v8vqfwOf18wA1IAIEVycAyt//v9XvAPv7APz8LhoIAPz9Ri4OAgwARgx4W/6fVeEAAAAASUVORK5CYII="}\' http://127.0.0.1:41184/notes');
|
lines.push('```shell\ncurl --data \'{ "title": "Image test", "body": "Here is Joplin icon:", "image_data_url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAANZJREFUeNoAyAA3/wFwtO3K6gUB/vz2+Prw9fj/+/r+/wBZKAAExOgF4/MC9ff+MRH6Ui4E+/0Bqc/zutj6AgT+/Pz7+vv7++nu82c4DlMqCvLs8goA/gL8/fz09fb59vXa6vzZ6vjT5fbn6voD/fwC8vX4UiT9Zi//APHyAP8ACgUBAPv5APz7BPj2+DIaC2o3E+3o6ywaC5fT6gD6/QD9/QEVf9kD+/dcLQgJA/7v8vqfwOf18wA1IAIEVycAyt//v9XvAPv7APz8LhoIAPz9Ri4OAgwARgx4W/6fVeEAAAAASUVORK5CYII="}\' http://127.0.0.1:41184/notes\n```');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('#### Creating a note with a specific ID');
|
lines.push('#### Creating a note with a specific ID');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push('When a new note is created, it is automatically assigned a new unique ID so **normally you do not need to set the ID**. However, if for some reason you want to set it, you can supply it as the `id` property. It needs to be a **32 characters long string** in hexadecimal. **Make sure it is unique**, for example by generating it using whatever GUID function is available in your programming language.');
|
lines.push('When a new note is created, it is automatically assigned a new unique ID so **normally you do not need to set the ID**. However, if for some reason you want to set it, you can supply it as the `id` property. It needs to be a **32 characters long string** in hexadecimal. **Make sure it is unique**, for example by generating it using whatever GUID function is available in your programming language.');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
lines.push(' curl --data \'{ "id": "00a87474082744c1a8515da6aa5792d2", "title": "My note with custom ID"}\' http://127.0.0.1:41184/notes');
|
lines.push('```shell\ncurl --data \'{ "id": "00a87474082744c1a8515da6aa5792d2", "title": "My note with custom ID"}\' http://127.0.0.1:41184/notes\n```');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,9 @@ To prevent unauthorised applications from accessing the API, the calls must be a
|
|||||||
|
|
||||||
This would be an example of valid cURL call using a token:
|
This would be an example of valid cURL call using a token:
|
||||||
|
|
||||||
curl http://localhost:41184/notes?token=ABCD123ABCD123ABCD123ABCD123ABCD123
|
```shell
|
||||||
|
curl http://localhost:41184/notes?token=ABCD123ABCD123ABCD123ABCD123ABCD123
|
||||||
|
```
|
||||||
|
|
||||||
In the documentation below, the token will not be specified every time however you will need to include it.
|
In the documentation below, the token will not be specified every time however you will need to include it.
|
||||||
|
|
||||||
@@ -31,13 +33,17 @@ If needed you may also [request the token programmatically](https://github.com/l
|
|||||||
|
|
||||||
All the calls, unless noted otherwise, receives and send **JSON data**. For example to create a new note:
|
All the calls, unless noted otherwise, receives and send **JSON data**. For example to create a new note:
|
||||||
|
|
||||||
curl --data '{ "title": "My note", "body": "Some note in **Markdown**"}' http://localhost:41184/notes
|
```shell
|
||||||
|
curl --data '{ "title": "My note", "body": "Some note in **Markdown**"}' http://localhost:41184/notes
|
||||||
|
```
|
||||||
|
|
||||||
In the documentation below, the calls may include special parameters such as :id or :note_id. You would replace this with the item ID or note ID.
|
In the documentation below, the calls may include special parameters such as :id or :note_id. You would replace this with the item ID or note ID.
|
||||||
|
|
||||||
For example, for the endpoint `DELETE /tags/:id/notes/:note_id`, to remove the tag with ID "ABCD1234" from the note with ID "EFGH789", you would run for example:
|
For example, for the endpoint `DELETE /tags/:id/notes/:note_id`, to remove the tag with ID "ABCD1234" from the note with ID "EFGH789", you would run for example:
|
||||||
|
|
||||||
curl -X DELETE http://localhost:41184/tags/ABCD1234/notes/EFGH789
|
```shell
|
||||||
|
curl -X DELETE http://localhost:41184/tags/ABCD1234/notes/EFGH789
|
||||||
|
```
|
||||||
|
|
||||||
The four verbs supported by the API are the following ones:
|
The four verbs supported by the API are the following ones:
|
||||||
|
|
||||||
@@ -50,11 +56,15 @@ The four verbs supported by the API are the following ones:
|
|||||||
|
|
||||||
You can change the fields that will be returned by the API using the `fields=` query parameter, which takes a list of comma separated fields. For example, to get the longitude and latitude of a note, use this:
|
You can change the fields that will be returned by the API using the `fields=` query parameter, which takes a list of comma separated fields. For example, to get the longitude and latitude of a note, use this:
|
||||||
|
|
||||||
curl http://localhost:41184/notes/ABCD123?fields=longitude,latitude
|
```shell
|
||||||
|
curl http://localhost:41184/notes/ABCD123?fields=longitude,latitude
|
||||||
|
```
|
||||||
|
|
||||||
To get the IDs only of all the tags:
|
To get the IDs only of all the tags:
|
||||||
|
|
||||||
curl http://localhost:41184/tags?fields=id
|
```shell
|
||||||
|
curl http://localhost:41184/tags?fields=id
|
||||||
|
```
|
||||||
|
|
||||||
By default API results will contain the following fields: **id**, **parent_id**, **title**
|
By default API results will contain the following fields: **id**, **parent_id**, **title**
|
||||||
|
|
||||||
@@ -71,15 +81,21 @@ You can specify how the results should be sorted using the `order_by` and `order
|
|||||||
|
|
||||||
The following call for example will initiate a request to fetch all the notes, 10 at a time, and sorted by "updated_time" ascending:
|
The following call for example will initiate a request to fetch all the notes, 10 at a time, and sorted by "updated_time" ascending:
|
||||||
|
|
||||||
curl http://localhost:41184/notes?order_by=updated_time&order_dir=ASC&limit=10
|
```shell
|
||||||
|
curl http://localhost:41184/notes?order_by=updated_time&order_dir=ASC&limit=10
|
||||||
|
```
|
||||||
|
|
||||||
This will return a result like this
|
This will return a result like this
|
||||||
|
|
||||||
{ "items": [ /* 10 notes */ ], "has_more": true }
|
```json
|
||||||
|
{ "items": [ /* 10 notes */ ], "has_more": true }
|
||||||
|
```
|
||||||
|
|
||||||
Then you will resume fetching the results using this query:
|
Then you will resume fetching the results using this query:
|
||||||
|
|
||||||
curl http://localhost:41184/notes?order_by=updated_time&order_dir=ASC&limit=10&page=2
|
```shell
|
||||||
|
curl http://localhost:41184/notes?order_by=updated_time&order_dir=ASC&limit=10&page=2
|
||||||
|
```
|
||||||
|
|
||||||
Eventually you will get some results that do not contain an "has_more" paramater, at which point you will have retrieved all the results
|
Eventually you will get some results that do not contain an "has_more" paramater, at which point you will have retrieved all the results
|
||||||
|
|
||||||
@@ -213,21 +229,29 @@ Examples:
|
|||||||
|
|
||||||
* Create a note from some Markdown text
|
* Create a note from some Markdown text
|
||||||
|
|
||||||
curl --data '{ "title": "My note", "body": "Some note in **Markdown**"}' http://127.0.0.1:41184/notes
|
```shell
|
||||||
|
curl --data '{ "title": "My note", "body": "Some note in **Markdown**"}' http://127.0.0.1:41184/notes
|
||||||
|
```
|
||||||
|
|
||||||
* Create a note from some HTML
|
* Create a note from some HTML
|
||||||
|
|
||||||
curl --data '{ "title": "My note", "body_html": "Some note in <b>HTML</b>"}' http://127.0.0.1:41184/notes
|
```shell
|
||||||
|
curl --data '{ "title": "My note", "body_html": "Some note in <b>HTML</b>"}' http://127.0.0.1:41184/notes
|
||||||
|
```
|
||||||
|
|
||||||
* Create a note and attach an image to it:
|
* Create a note and attach an image to it:
|
||||||
|
|
||||||
curl --data '{ "title": "Image test", "body": "Here is Joplin icon:", "image_data_url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAANZJREFUeNoAyAA3/wFwtO3K6gUB/vz2+Prw9fj/+/r+/wBZKAAExOgF4/MC9ff+MRH6Ui4E+/0Bqc/zutj6AgT+/Pz7+vv7++nu82c4DlMqCvLs8goA/gL8/fz09fb59vXa6vzZ6vjT5fbn6voD/fwC8vX4UiT9Zi//APHyAP8ACgUBAPv5APz7BPj2+DIaC2o3E+3o6ywaC5fT6gD6/QD9/QEVf9kD+/dcLQgJA/7v8vqfwOf18wA1IAIEVycAyt//v9XvAPv7APz8LhoIAPz9Ri4OAgwARgx4W/6fVeEAAAAASUVORK5CYII="}' http://127.0.0.1:41184/notes
|
```shell
|
||||||
|
curl --data '{ "title": "Image test", "body": "Here is Joplin icon:", "image_data_url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAANZJREFUeNoAyAA3/wFwtO3K6gUB/vz2+Prw9fj/+/r+/wBZKAAExOgF4/MC9ff+MRH6Ui4E+/0Bqc/zutj6AgT+/Pz7+vv7++nu82c4DlMqCvLs8goA/gL8/fz09fb59vXa6vzZ6vjT5fbn6voD/fwC8vX4UiT9Zi//APHyAP8ACgUBAPv5APz7BPj2+DIaC2o3E+3o6ywaC5fT6gD6/QD9/QEVf9kD+/dcLQgJA/7v8vqfwOf18wA1IAIEVycAyt//v9XvAPv7APz8LhoIAPz9Ri4OAgwARgx4W/6fVeEAAAAASUVORK5CYII="}' http://127.0.0.1:41184/notes
|
||||||
|
```
|
||||||
|
|
||||||
#### Creating a note with a specific ID
|
#### Creating a note with a specific ID
|
||||||
|
|
||||||
When a new note is created, it is automatically assigned a new unique ID so **normally you do not need to set the ID**. However, if for some reason you want to set it, you can supply it as the `id` property. It needs to be a **32 characters long string** in hexadecimal. **Make sure it is unique**, for example by generating it using whatever GUID function is available in your programming language.
|
When a new note is created, it is automatically assigned a new unique ID so **normally you do not need to set the ID**. However, if for some reason you want to set it, you can supply it as the `id` property. It needs to be a **32 characters long string** in hexadecimal. **Make sure it is unique**, for example by generating it using whatever GUID function is available in your programming language.
|
||||||
|
|
||||||
curl --data '{ "id": "00a87474082744c1a8515da6aa5792d2", "title": "My note with custom ID"}' http://127.0.0.1:41184/notes
|
```shell
|
||||||
|
curl --data '{ "id": "00a87474082744c1a8515da6aa5792d2", "title": "My note with custom ID"}' http://127.0.0.1:41184/notes
|
||||||
|
```
|
||||||
|
|
||||||
### PUT /notes/:id
|
### PUT /notes/:id
|
||||||
|
|
||||||
@@ -333,17 +357,23 @@ Creates a new resource
|
|||||||
|
|
||||||
Creating a new resource is special because you also need to upload the file. Unlike other API calls, this one must have the "multipart/form-data" Content-Type. The file data must be passed to the "data" form field, and the other properties to the "props" form field. An example of a valid call with cURL would be:
|
Creating a new resource is special because you also need to upload the file. Unlike other API calls, this one must have the "multipart/form-data" Content-Type. The file data must be passed to the "data" form field, and the other properties to the "props" form field. An example of a valid call with cURL would be:
|
||||||
|
|
||||||
curl -F 'data=@/path/to/file.jpg' -F 'props={"title":"my resource title"}' http://localhost:41184/resources
|
```shell
|
||||||
|
curl -F 'data=@/path/to/file.jpg' -F 'props={"title":"my resource title"}' http://localhost:41184/resources
|
||||||
|
```
|
||||||
|
|
||||||
To **update** the resource content, you can make a PUT request with the same arguments:
|
To **update** the resource content, you can make a PUT request with the same arguments:
|
||||||
|
|
||||||
curl -X PUT -F 'data=@/path/to/file.jpg' -F 'props={"title":"my modified title"}' http://localhost:41184/resources/8fe1417d7b184324bf6b0122b76c4696
|
```shell
|
||||||
|
curl -X PUT -F 'data=@/path/to/file.jpg' -F 'props={"title":"my modified title"}' http://localhost:41184/resources/8fe1417d7b184324bf6b0122b76c4696
|
||||||
|
```
|
||||||
|
|
||||||
The "data" field is required, while the "props" one is not. If not specified, default values will be used.
|
The "data" field is required, while the "props" one is not. If not specified, default values will be used.
|
||||||
|
|
||||||
Or if you only need to update the resource properties (title, etc.), without changing the content, you can make a regular PUT request:
|
Or if you only need to update the resource properties (title, etc.), without changing the content, you can make a regular PUT request:
|
||||||
|
|
||||||
curl -X PUT --data '{"title": "My new title"}' http://localhost:41184/resources/8fe1417d7b184324bf6b0122b76c4696
|
```shell
|
||||||
|
curl -X PUT --data '{"title": "My new title"}' http://localhost:41184/resources/8fe1417d7b184324bf6b0122b76c4696
|
||||||
|
```
|
||||||
|
|
||||||
**From a plugin** the syntax to create a resource is also a bit special:
|
**From a plugin** the syntax to create a resource is also a bit special:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user