Last active
March 2, 2017 16:24
-
-
Save poupotte/1c670451f49680882bc24de81e73c26e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Token oauth | |
cozy@recette:~$ cozy-stack instances client-oauth test.zoe.fr http://localhost/ test github.com/cozy-labs/cozy-desktop | |
51e67bf69b31972f7efcd436d4163e04 | |
cozy@recette:~$ cozy-stack instances token-oauth test.zoe.fr 51e67bf69b31972f7efcd436d4163445 io.cozy.files io.cozy.calendar | |
eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhY2Nlc3MiLCJpYXQiOjE0ODg0NzAwMTAsImlzcyI6InRlc3Quem9lLmZyIiwic3ViIjoiNTFlNjdiZjY5YjMxOTcyZjdlZmNkNDM2ZDQxNjM0NDUiLCJzY29wZSI6ImlvLmNvenkuZmlsZXMgaW8uY296eS5jYWxlbmRhciJ9.uWRFY2plCmxxkmivl9Ncl7UfGbNWYLbEjV4d2dLTvPLDmspEkPJNmxyhhLq3ZYs5waKNjcXeZBEV8ruyXpuxsQ | |
## Création d'un album | |
cozy@recette:~$ curl -X POST http://localhost:8080/data/io.cozy.calendar/ -H 'Host:test.zoe.fr' -d'{"name":"test2"}' -H 'Content-Type: application/json' -H 'Accept:application/json' -H 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhY2Nlc3MiLCJpYXQiOjE0ODg0NzAwMTAsImlzcyI6InRlc3Quem9lLmZyIiwic3ViIjoiNTFlNjdiZjY5YjMxOTcyZjdlZmNkNDM2ZDQxNjM0NDUiLCJzY29wZSI6ImlvLmNvenkuZmlsZXMgaW8uY296eS5jYWxlbmRhciJ9.uWRFY2plCmxxkmivl9Ncl7UfGbNWYLbEjV4d2dLTvPLDmspEkPJNmxyhhLq3ZYs5waKNjcXeZBEV8ruyXpuxsQ' | |
{"data":{"_id":"51e67bf69b31972f7efcd436d41648a5","_rev":"1-6731a88917d225a110a2e90daffe6b48","_type":"io.cozy.calendar","name":"test2"},"id":"51e67bf69b31972f7efcd436d41648a5","ok":true,"rev":"1-6731a88917d225a110a2e90daffe6b48","type":"io.cozy.calendar"} | |
## Création d'un second album | |
cozy@recette:~$ curl -X POST http://localhost:8080/data/io.cozy.calendar/ -H 'Host:test.zoe.fr' -d'{"name":"test3"}' -H 'Content-Type: application/json' -H 'Accept:application/json' -H 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhY2Nlc3MiLCJpYXQiOjE0ODg0NzAwMTAsImlzcyI6InRlc3Quem9lLmZyIiwic3ViIjoiNTFlNjdiZjY5YjMxOTcyZjdlZmNkNDM2ZDQxNjM0NDUiLCJzY29wZSI6ImlvLmNvenkuZmlsZXMgaW8uY296eS5jYWxlbmRhciJ9.uWRFY2plCmxxkmivl9Ncl7UfGbNWYLbEjV4d2dLTvPLDmspEkPJNmxyhhLq3ZYs5waKNjcXeZBEV8ruyXpuxsQ' | |
{"data":{"_id":"51e67bf69b31972f7efcd436d416572e","_rev":"1-d121b0ebde7b2df5cc01ccb01af8c961","_type":"io.cozy.calendar","name":"test3"},"id":"51e67bf69b31972f7efcd436d416572e","ok":true,"rev":"1-d121b0ebde7b2df5cc01ccb01af8c961","type":"io.cozy.calendar"} | |
## Relation de fichier vers l'album 1 | |
cozy@recette:~$ curl -X POST http://localhost:8080/files/51e67bf69b31972f7efcd436d415f37e/relationships/referenced_by -H 'Host:test.zoe.fr' -d'{"data":[{"type":"io.cozy.calendar", "id":"51e67bf69b31972f7efcd436d41648a5"}]}' -H 'Content-Type: application/json' -H 'Accept:application/json' -H 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhY2Nlc3MiLCJpYXQiOjE0ODg0NzAwMTAsImlzcyI6InRlc3Quem9lLmZyIiwic3ViIjoiNTFlNjdiZjY5YjMxOTcyZjdlZmNkNDM2ZDQxNjM0NDUiLCJzY29wZSI6ImlvLmNvenkuZmlsZXMgaW8uY296eS5jYWxlbmRhciJ9.uWRFY2plCmxxkmivl9Ncl7UfGbNWYLbEjV4d2dLTvPLDmspEkPJNmxyhhLq3ZYs5waKNjcXeZBEV8ruyXpuxsQ' | |
Fichier : | |
{ | |
"_id": "51e67bf69b31972f7efcd436d415f37e", | |
"_rev": "2-a7477795ceda70396449c8ad78ef053b", | |
"type": "file", | |
"name": "bar.txt", | |
"dir_id": "51e67bf69b31972f7efcd436d415de1a", | |
"created_at": "2017-03-02T14:20:45.803404355Z", | |
"updated_at": "2017-03-02T14:20:45.803404355Z", | |
"size": "3", | |
"md5sum": "rL0Y20zC+Fzt72VPzMSk2A==", | |
"mime": "text/plain", | |
"class": "text", | |
"executable": false, | |
"tags": [], | |
"referenced_by": [ | |
{ | |
"id": "51e67bf69b31972f7efcd436d41648a5", | |
"type": "io.cozy.calendar" | |
} | |
] | |
} | |
## Récupération de la relation | |
cozy@recette:~$ curl http://localhost:8080/io.cozy.calendar/51e67bf69b31972f7efcd436d41648a5/relationships/references -H 'Host:test.zoe.fr' -H 'Content-Type: application/json' -H 'Accept:application/json' -H 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhY2Nlc3MiLCJpYXQiOjE0ODg0NzAwMTAsImlzcyI6InRlc3Quem9lLmZyIiwic3ViIjoiNTFlNjdiZjY5YjMxOTcyZjdlZmNkNDM2ZDQxNjM0NDUiLCJzY29wZSI6ImlvLmNvenkuZmlsZXMgaW8uY296eS5jYWxlbmRhciJ9.uWRFY2plCmxxkmivl9Ncl7UfGbNWYLbEjV4d2dLTvPLDmspEkPJNmxyhhLq3ZYs5waKNjcXeZBEV8ruyXpuxsQ' | |
Not Found :'( | |
## Relation de fichier vers l'album 2 | |
cozy@recette:~$ curl -X POST http://localhost:8080/files/51e67bf69b31972f7efcd436d415f37e/relationships/referenced_by -H 'Host:test.zoe.fr' -d'{"data":[{"type":"io.cozy.calendar", "id":"51e67bf69b31972f7efcd436d416572e"}]}' -H 'Content-Type: application/json' -H 'Accept:application/json' -H 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhY2Nlc3MiLCJpYXQiOjE0ODg0NzAwMTAsImlzcyI6InRlc3Quem9lLmZyIiwic3ViIjoiNTFlNjdiZjY5YjMxOTcyZjdlZmNkNDM2ZDQxNjM0NDUiLCJzY29wZSI6ImlvLmNvenkuZmlsZXMgaW8uY296eS5jYWxlbmRhciJ9.uWRFY2plCmxxkmivl9Ncl7UfGbNWYLbEjV4d2dLTvPLDmspEkPJNmxyhhLq3ZYs5waKNjcXeZBEV8ruyXpuxsQ' | |
Fichier: | |
{ | |
"_id": "51e67bf69b31972f7efcd436d415f37e", | |
"_rev": "3-0b9a7a5c46c6872727b00d9a3fe0c1d4", | |
"type": "file", | |
"name": "bar.txt", | |
"dir_id": "51e67bf69b31972f7efcd436d415de1a", | |
"created_at": "2017-03-02T14:20:45.803404355Z", | |
"updated_at": "2017-03-02T14:20:45.803404355Z", | |
"size": "3", | |
"md5sum": "rL0Y20zC+Fzt72VPzMSk2A==", | |
"mime": "text/plain", | |
"class": "text", | |
"executable": false, | |
"tags": [], | |
"referenced_by": [ | |
{ | |
"id": "51e67bf69b31972f7efcd436d416572e", | |
"type": "io.cozy.calendar" | |
} | |
] | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Suppression de la relation : | |
cozy@recette:~$ curl -X DELETE http://localhost:8080/files/51e67bf69b31972f7efcd436d415f37e/relationships/referenced_by -H 'Host:test.zoe.fr' -d'{"data":[{"type":"io.cozy.calendar", "id":"51e67bf69b31972f7efcd436d41648a5"}]}' -H 'Content-Type: application/json' -H 'Accept:application/json' -H 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhY2Nlc3MiLCJpYXQiOjE0ODg0NzAwMTAsImlzcyI6InRlc3Quem9lLmZyIiwic3ViIjoiNTFlNjdiZjY5YjMxOTcyZjdlZmNkNDM2ZDQxNjM0NDUiLCJzY29wZSI6ImlvLmNvenkuZmlsZXMgaW8uY296eS5jYWxlbmRhciJ9.uWRFY2plCmxxkmivl9Ncl7UfGbNWYLbEjV4d2dLTvPLDmspEkPJNmxyhhLq3ZYs5waKNjcXeZBEV8ruyXpuxsQ' | |
Fichier : | |
{ | |
"_id": "51e67bf69b31972f7efcd436d415f37e", | |
"_rev": "6-781d7f31cf02234f64779c9c8f6fff45", | |
"type": "file", | |
"name": "bar.txt", | |
"dir_id": "51e67bf69b31972f7efcd436d415de1a", | |
"created_at": "2017-03-02T14:20:45.803404355Z", | |
"updated_at": "2017-03-02T14:20:45.803404355Z", | |
"size": "3", | |
"md5sum": "rL0Y20zC+Fzt72VPzMSk2A==", | |
"mime": "text/plain", | |
"class": "text", | |
"executable": false, | |
"tags": [] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Suppression avec un mauvais id de la relation : | |
cozy@recette:~$ curl -X DELETE http://localhost:8080/files/51e67bf69b31972f7efcd436d415f37e/relationships/referenced_by -H 'Host:test.zoe.fr' -d'{"data":[{"type":"io.cozy.calendar", "id":"1e67bf69b31972f7efcd436d41648a5"}]}' -H 'Content-Type: application/json' -H 'Accept:application/json' -H 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhY2Nlc3MiLCJpYXQiOjE0ODg0NzAwMTAsImlzcyI6InRlc3Quem9lLmZyIiwic3ViIjoiNTFlNjdiZjY5YjMxOTcyZjdlZmNkNDM2ZDQxNjM0NDUiLCJzY29wZSI6ImlvLmNvenkuZmlsZXMgaW8uY296eS5jYWxlbmRhciJ9.uWRFY2plCmxxkmivl9Ncl7UfGbNWYLbEjV4d2dLTvPLDmspEkPJNmxyhhLq3ZYs5waKNjcXeZBEV8ruyXpuxsQ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Suppression avec un mauvais id de fichier | |
cozy@recette:~$ curl -X DELETE http://localhost:8080/files/1e67bf69b31972f7efcd436d415f37e/relationships/referenced_by -H 'Host:test.zoe.fr' -d'{"data":[{"type":"io.cozy.calendar", "id":"51e67bf69b31972f7efcd436d41648a5"}]}' -H 'Content-Type: application/json' -H 'Accept:application/json' -H 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhY2Nlc3MiLCJpYXQiOjE0ODg0NzAwMTAsImlzcyI6InRlc3Quem9lLmZyIiwic3ViIjoiNTFlNjdiZjY5YjMxOTcyZjdlZmNkNDM2ZDQxNjM0NDUiLCJzY29wZSI6ImlvLmNvenkuZmlsZXMgaW8uY296eS5jYWxlbmRhciJ9.uWRFY2plCmxxkmivl9Ncl7UfGbNWYLbEjV4d2dLTvPLDmspEkPJNmxyhhLq3ZYs5waKNjcXeZBEV8ruyXpuxsQ' | |
{"errors":[{"status":"404","title":"not_found","detail":"missing","source":{}}]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Création d'un relation sur deux fichiers | |
cozy@recette:~$ curl -X POST http://localhost:8080/data/io.cozy.calendar/51e67bf69b31972f7efcd436d41648a5/relationships/references -H 'Host:test.zoe.fr' -d'{"data":[{"type":"io.cozy.files", "id":"51e67bf69b31972f7efcd436d415f37e"}, {"type":"io.cozy.files", "id":"51e67bf69b31972f7efcd436d4162816"}]}' -H 'Content-Type: application/json' -H 'Accept:application/json' -H 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhY2Nlc3MiLCJpYXQiOjE0ODg0NzAwMTAsImlzcyI6InRlc3Quem9lLmZyIiwic3ViIjoiNTFlNjdiZjY5YjMxOTcyZjdlZmNkNDM2ZDQxNjM0NDUiLCJzY29wZSI6ImlvLmNvenkuZmlsZXMgaW8uY296eS5jYWxlbmRhciJ9.uWRFY2plCmxxkmivl9Ncl7UfGbNWYLbEjV4d2dLTvPLDmspEkPJNmxyhhLq3ZYs5waKNjcXeZBEV8ruyXpuxsQ' | |
Fichier 1: | |
{ | |
"_id": "51e67bf69b31972f7efcd436d415f37e", | |
"_rev": "7-d7226c5a447fe03db4ada5d713cb1b13", | |
"type": "file", | |
"name": "bar.txt", | |
"dir_id": "51e67bf69b31972f7efcd436d415de1a", | |
"created_at": "2017-03-02T14:20:45.803404355Z", | |
"updated_at": "2017-03-02T14:20:45.803404355Z", | |
"size": "3", | |
"md5sum": "rL0Y20zC+Fzt72VPzMSk2A==", | |
"mime": "text/plain", | |
"class": "text", | |
"executable": false, | |
"tags": [], | |
"referenced_by": [ | |
{ | |
"id": "51e67bf69b31972f7efcd436d41648a5", | |
"type": "io.cozy.calendar" | |
} | |
] | |
} | |
Fichier 2 : | |
{ | |
"_id": "51e67bf69b31972f7efcd436d4162816", | |
"_rev": "2-488784efecfd1a70bffa2ccb5c3531b0", | |
"type": "file", | |
"name": "bar2.txt", | |
"dir_id": "51e67bf69b31972f7efcd436d415de1a", | |
"created_at": "2017-03-02T14:53:53.316309608Z", | |
"updated_at": "2017-03-02T14:53:53.316309608Z", | |
"size": "3", | |
"md5sum": "rL0Y20zC+Fzt72VPzMSk2A==", | |
"mime": "text/plain", | |
"class": "text", | |
"executable": false, | |
"tags": [], | |
"referenced_by": [ | |
{ | |
"id": "51e67bf69b31972f7efcd436d41648a5", | |
"type": "io.cozy.calendar" | |
} | |
] | |
} | |
## Suppression des deux relations | |
cozy@recette:~$ curl -X DELETE http://localhost:8080/data/io.cozy.calendar/51e67bf69b31972f7efcd436d41648a5/relationships/references -H 'Host:test.zoe.fr' -d'{"data":[{"type":"io.cozy.files", "id":"51e67bf69b31972f7efcd436d415f37e"}, {"type":"io.cozy.files", "id":"51e67bf69b31972f7efcd436d4162816"}]}' -H 'Content-Type: application/json' -H 'Accept:application/json' -H 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhY2Nlc3MiLCJpYXQiOjE0ODg0NzAwMTAsImlzcyI6InRlc3Quem9lLmZyIiwic3ViIjoiNTFlNjdiZjY5YjMxOTcyZjdlZmNkNDM2ZDQxNjM0NDUiLCJzY29wZSI6ImlvLmNvenkuZmlsZXMgaW8uY296eS5jYWxlbmRhciJ9.uWRFY2plCmxxkmivl9Ncl7UfGbNWYLbEjV4d2dLTvPLDmspEkPJNmxyhhLq3ZYs5waKNjcXeZBEV8ruyXpuxsQ' | |
Fichier 1: | |
{ | |
"_id": "51e67bf69b31972f7efcd436d415f37e", | |
"_rev": "8-73da41c304191a1824becee98bcc6135", | |
"type": "file", | |
"name": "bar.txt", | |
"dir_id": "51e67bf69b31972f7efcd436d415de1a", | |
"created_at": "2017-03-02T14:20:45.803404355Z", | |
"updated_at": "2017-03-02T14:20:45.803404355Z", | |
"size": "3", | |
"md5sum": "rL0Y20zC+Fzt72VPzMSk2A==", | |
"mime": "text/plain", | |
"class": "text", | |
"executable": false, | |
"tags": [] | |
} | |
Fichier 2: | |
{ | |
"_id": "51e67bf69b31972f7efcd436d4162816", | |
"_rev": "3-4f8949c75f223ea8830a8e3eb527b627", | |
"type": "file", | |
"name": "bar2.txt", | |
"dir_id": "51e67bf69b31972f7efcd436d415de1a", | |
"created_at": "2017-03-02T14:53:53.316309608Z", | |
"updated_at": "2017-03-02T14:53:53.316309608Z", | |
"size": "3", | |
"md5sum": "rL0Y20zC+Fzt72VPzMSk2A==", | |
"mime": "text/plain", | |
"class": "text", | |
"executable": false, | |
"tags": [] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Création de deux relations sur un fichier | |
cozy@recette:~$ curl -X POST http://localhost:8080/files/51e67bf69b31972f7efcd436d415f37e/relationships/referenced_by -H 'Host:test.zoe.fr' -d'{"data":[{"type":"io.cozy.calendar", "id":"51e67bf69b31972f7efcd436d41648a5"}, {"type":"io.cozy.calendar", "id":"51e67bf69b31972f7efcd436d415f37e"}]}' -H 'Content-Type: application/json' -H 'Accept:application/json' -H 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhY2Nlc3MiLCJpYXQiOjE0ODg0NzAwMTAsImlzcyI6InRlc3Quem9lLmZyIiwic3ViIjoiNTFlNjdiZjY5YjMxOTcyZjdlZmNkNDM2ZDQxNjM0NDUiLCJzY29wZSI6ImlvLmNvenkuZmlsZXMgaW8uY296eS5jYWxlbmRhciJ9.uWRFY2plCmxxkmivl9Ncl7UfGbNWYLbEjV4d2dLTvPLDmspEkPJNmxyhhLq3ZYs5waKNjcXeZBEV8ruyXpuxsQ' | |
Fichier: | |
{ | |
"_id": "51e67bf69b31972f7efcd436d415f37e", | |
"_rev": "9-f82ed5f6cad13447b9bf490c8ea0a4c8", | |
"type": "file", | |
"name": "bar.txt", | |
"dir_id": "51e67bf69b31972f7efcd436d415de1a", | |
"created_at": "2017-03-02T14:20:45.803404355Z", | |
"updated_at": "2017-03-02T14:20:45.803404355Z", | |
"size": "3", | |
"md5sum": "rL0Y20zC+Fzt72VPzMSk2A==", | |
"mime": "text/plain", | |
"class": "text", | |
"executable": false, | |
"tags": [], | |
"referenced_by": [ | |
{ | |
"id": "51e67bf69b31972f7efcd436d41648a5", | |
"type": "io.cozy.calendar" | |
}, | |
{ | |
"id": "51e67bf69b31972f7efcd436d415f37e", | |
"type": "io.cozy.calendar" | |
} | |
] | |
} | |
## Suppression d'une relation sur les deux | |
cozy@recette:~$ curl -X DELETE http://localhost:8080/files/51e67bf69b31972f7efcd436d415f37e/relationships/referenced_by -H 'Host:test.zoe.fr' -d'{"data":[{"type":"io.cozy.calendar", "id":"51e67bf69b31972f7efcd436d41648a5"}]}' -H 'Content-Type: application/json' -H 'Accept:application/json' -H 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhY2Nlc3MiLCJpYXQiOjE0ODg0NzAwMTAsImlzcyI6InRlc3Quem9lLmZyIiwic3ViIjoiNTFlNjdiZjY5YjMxOTcyZjdlZmNkNDM2ZDQxNjM0NDUiLCJzY29wZSI6ImlvLmNvenkuZmlsZXMgaW8uY296eS5jYWxlbmRhciJ9.uWRFY2plCmxxkmivl9Ncl7UfGbNWYLbEjV4d2dLTvPLDmspEkPJNmxyhhLq3ZYs5waKNjcXeZBEV8ruyXpuxsQ' | |
Fichier: | |
{ | |
"_id": "51e67bf69b31972f7efcd436d415f37e", | |
"_rev": "10-cb1e2df20228e8738059c086a069e950", | |
"type": "file", | |
"name": "bar.txt", | |
"dir_id": "51e67bf69b31972f7efcd436d415de1a", | |
"created_at": "2017-03-02T14:20:45.803404355Z", | |
"updated_at": "2017-03-02T14:20:45.803404355Z", | |
"size": "3", | |
"md5sum": "rL0Y20zC+Fzt72VPzMSk2A==", | |
"mime": "text/plain", | |
"class": "text", | |
"executable": false, | |
"tags": [], | |
"referenced_by": [ | |
{ | |
"id": "51e67bf69b31972f7efcd436d415f37e", | |
"type": "io.cozy.calendar" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment