Versions
Personas in this Story: Default, Member.
First version of the note that name "Version 1" and body "Vrsion 1 is awesome":
Response: HTTP 200, application/json (Hide)
POST /projects/1/notes
Payload:
1 2 3 4
{ "name": "Version 1", "body": "Vrsion 1 is awesome" }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
{ "single": { "id": 1, "class": "Note", "url_path": "\/projects\/1\/notes\/1", "name": "Version 1", "comments_count": 0, "attachments": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": false, "body": "Vrsion 1 is awesome", "body_formatted": "Vrsion 1 is awesome", "body_plain_text": "Vrsion 1 is awesome", "created_on": 1430164249, "created_by_id": 1, "updated_on": 1430164249, "updated_by_id": 1, "note_id": 0, "is_subnote": false, "subnotes_count": 0, "is_in_collection": false, "position": 0, "contributor_ids": [ 1 ] }, "subscribers": [ 1 ], "comments": [], "subnotes": [] }
Oh, we made a mistake here. Lets correct it:
Response: HTTP 200, application/json (Hide)
PUT /projects/1/notes/1 (as Member)
Payload:
1 2 3
{ "body": "Version 1 is awesome" }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
{ "single": { "id": 1, "class": "Note", "url_path": "\/projects\/1\/notes\/1", "name": "Version 1", "comments_count": 0, "attachments": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": false, "body": "Version 1 is awesome", "body_formatted": "Version 1 is awesome", "body_plain_text": "Version 1 is awesome", "created_on": 1430164249, "created_by_id": 1, "updated_on": 1430164250, "updated_by_id": 2, "note_id": 0, "is_subnote": false, "subnotes_count": 0, "is_in_collection": false, "position": 0, "contributor_ids": [ 1, 2 ] }, "subscribers": [ 1 ], "comments": [], "subnotes": [] }
This will make version two look like this: name "Version 1", body: "Version 1 is awesome". Lets do one update that will create a history entry, but that will not create a new version:
Response: HTTP 200, application/json (Hide)
PUT /projects/1/notes/1
Payload:
1 2 3
{ "is_hidden_from_clients": true }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
{ "single": { "id": 1, "class": "Note", "url_path": "\/projects\/1\/notes\/1", "name": "Version 1", "comments_count": 0, "attachments": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": true, "body": "Version 1 is awesome", "body_formatted": "Version 1 is awesome", "body_plain_text": "Version 1 is awesome", "created_on": 1430164249, "created_by_id": 1, "updated_on": 1430164250, "updated_by_id": 1, "note_id": 0, "is_subnote": false, "subnotes_count": 0, "is_in_collection": false, "position": 0, "contributor_ids": [ 1, 2 ] }, "subscribers": [ 1 ], "comments": [], "subnotes": [] }
Lets create a version #3:
Response: HTTP 200, application/json (Hide)
PUT /projects/1/notes/1
Payload:
1 2 3 4
{ "name": "Version 3", "body": "Version 3 is much better" }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
{ "single": { "id": 1, "class": "Note", "url_path": "\/projects\/1\/notes\/1", "name": "Version 3", "comments_count": 0, "attachments": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": true, "body": "Version 3 is much better", "body_formatted": "Version 3 is much better", "body_plain_text": "Version 3 is much better", "created_on": 1430164249, "created_by_id": 1, "updated_on": 1430164250, "updated_by_id": 1, "note_id": 0, "is_subnote": false, "subnotes_count": 0, "is_in_collection": false, "position": 0, "contributor_ids": [ 1, 2 ] }, "subscribers": [ 1 ], "comments": [], "subnotes": [] }
and v4 that does not update both fields:
Response: HTTP 200, application/json (Hide)
PUT /projects/1/notes/1 (as Member)
Payload:
1 2 3
{ "name": "Maybe we should go with v4?" }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
{ "single": { "id": 1, "class": "Note", "url_path": "\/projects\/1\/notes\/1", "name": "Maybe we should go with v4?", "comments_count": 0, "attachments": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": true, "body": "Version 3 is much better", "body_formatted": "Version 3 is much better", "body_plain_text": "Version 3 is much better", "created_on": 1430164249, "created_by_id": 1, "updated_on": 1430164250, "updated_by_id": 2, "note_id": 0, "is_subnote": false, "subnotes_count": 0, "is_in_collection": false, "position": 0, "contributor_ids": [ 1, 2 ] }, "subscribers": [ 1 ], "comments": [], "subnotes": [] }
Lets check how this looks like:
Response: HTTP 200, application/json (Hide)
GET /projects/1/notes/1/versions
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
{ "1": { "created_on": 1430164249, "created_by_id": 1, "name": "Version 1", "body": "Vrsion 1 is awesome", "modification_id": 0 }, "2": { "created_on": 1430164250, "created_by_id": 2, "name": "Version 1", "body": "Version 1 is awesome", "modification_id": 1 }, "3": { "created_on": 1430164250, "created_by_id": 1, "name": "Version 3", "body": "Version 3 is much better", "modification_id": 3 }, "4": { "created_on": 1430164250, "created_by_id": 2, "name": "Maybe we should go with v4?", "body": "Version 3 is much better", "modification_id": 4 } }