diff --git a/REST-Tests/attachment_from_scratch.sh b/REST-Tests/attachment_from_scratch.sh deleted file mode 100755 index 08745b736d7..00000000000 --- a/REST-Tests/attachment_from_scratch.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -curl -X POST http://localhost:3456/api/v1/register -H 'Content-Type: application/json' -d '{"username":"demo","password":"demo","email":"demo@vikunja.io"}' -BEARER=`curl -X POST -H 'Content-Type: application/json' -d '{"username": "demo", "password":"demo"}' localhost:3456/api/v1/login | jq -r '.token'` - -echo "Bearer: $BEARER" - -curl -X POST localhost:3456/api/v1/tokenTest -H "Authorization: Bearer $BEARER" - -curl -X PUT localhost:3456/api/v1/namespaces/1/lists -H 'Content-Type: application/json' -H "Authorization: Bearer $BEARER" -d '{"title":"lorem"}' -curl -X PUT localhost:3456/api/v1/lists/1 -H 'Content-Type: application/json' -H "Authorization: Bearer $BEARER" -d '{"text":"lorem"}' -curl -X PUT -H "Authorization: Bearer $BEARER" localhost:3456/api/v1/tasks/1/attachments -F 'files=@/home/konrad/Pictures/Wallpaper/greg-rakozy-_Q4mepyyjMw-unsplash.jpg' diff --git a/REST-Tests/auth.http b/REST-Tests/auth.http deleted file mode 100644 index 696b19678b8..00000000000 --- a/REST-Tests/auth.http +++ /dev/null @@ -1,29 +0,0 @@ -### Authorization by token, part 1. Retrieve and save token. -POST http://localhost:8080/api/v1/login -Content-Type: application/json - -{ - "username": "user3", - "password": "1234" -} - -> {% client.global.set("auth_token", response.body.token); %} - -### Register - -POST http://localhost:8080/api/v1/register -Content-Type: application/json - -{ - "username": "user", - "password": "1234", - "email": "5@knt.li" -} - -### -# Token test -POST http://localhost:8080/api/v1/tokenTest -Authorization: Bearer {{auth_token}} -Content-Type: application/json - -### diff --git a/REST-Tests/labels.http b/REST-Tests/labels.http deleted file mode 100644 index 94b760e0c1d..00000000000 --- a/REST-Tests/labels.http +++ /dev/null @@ -1,70 +0,0 @@ -# Get all labels -GET http://localhost:8080/api/v1/labels -Authorization: Bearer {{auth_token}} - -### -# Add a new label -PUT http://localhost:8080/api/v1/labels -Authorization: Bearer {{auth_token}} -Content-Type: application/json - -{ - "title": "test5" -} - -### -# Delete a label -DELETE http://localhost:8080/api/v1/labels/6 -Authorization: Bearer {{auth_token}} - -### -# Update a label -POST http://localhost:8080/api/v1/labels/1 -Authorization: Bearer {{auth_token}} -Content-Type: application/json - -{ - "title": "testschinkenbrot", - "description": "käsebrot" -} - -### -# Get one label -GET http://localhost:8080/api/v1/labels/1 -Authorization: Bearer {{auth_token}} - -### -# Get all labels on a task -GET http://localhost:8080/api/v1/tasks/3565/labels -Authorization: Bearer {{auth_token}} - -### -# Add a new label to a task -PUT http://localhost:8080/api/v1/tasks/35236365/labels -Authorization: Bearer {{auth_token}} -Content-Type: application/json - -{ - "label_id": 1 -} - -### -# Delete a label from a task -DELETE http://localhost:8080/api/v1/tasks/3565/labels/1 -Authorization: Bearer {{auth_token}} - -### -# Add a new label to a task -POST http://localhost:8080/api/v1/tasks/3565/labels/bulk -Authorization: Bearer {{auth_token}} -Content-Type: application/json - -{ - "labels": [ - {"id": 1}, - {"id": 2}, - {"id": 3} - ] -} - -### \ No newline at end of file diff --git a/REST-Tests/lists.http b/REST-Tests/lists.http deleted file mode 100644 index a7e716be927..00000000000 --- a/REST-Tests/lists.http +++ /dev/null @@ -1,177 +0,0 @@ -# Get all lists -GET http://localhost:8080/api/v1/namespaces/35/lists -Authorization: Bearer {{auth_token}} - -### - -# Get one list -GET http://localhost:8080/api/v1/lists/3 -Authorization: Bearer {{auth_token}} - -### - -# Add a new list -PUT http://localhost:8080/api/v1/namespaces/35/lists -Authorization: Bearer {{auth_token}} -Content-Type: application/json - -{ - "title": "test" -} - -### - -# Add a new item -PUT http://localhost:8080/api/v1/lists/1 -Authorization: Bearer {{auth_token}} -Content-Type: application/json - -{ - "text": "Task", - "description": "Schinken" -} - -### - -# Delete a task from a list -DELETE http://localhost:8080/api/v1/lists/14 -Authorization: Bearer {{auth_token}} - -### - -# Get all teams who have access to that list -GET http://localhost:8080/api/v1/lists/28/teams -Authorization: Bearer {{auth_token}} - -### - -# Give a team access to that list -PUT http://localhost:8080/api/v1/lists/1/teams -Authorization: Bearer {{auth_token}} -Content-Type: application/json - -{"team_id":2, "right": 1} - -### - -# Update a teams access to that list -POST http://localhost:8080/api/v1/lists/1/teams/2 -Authorization: Bearer {{auth_token}} -Content-Type: application/json - -{"right": 0} - -### - -# Delete a team from a list -DELETE http://localhost:8080/api/v1/lists/10235/teams/1 -Authorization: Bearer {{auth_token}} - -### - -# Delete a team from a list -DELETE http://localhost:8080/api/v1/lists/10235/teams/1 -Authorization: Bearer {{auth_token}} - -### - -# Get all users who have access to that list -GET http://localhost:8080/api/v1/lists/28/users -Authorization: Bearer {{auth_token}} - -### - -# Give a user access to that list -PUT http://localhost:8080/api/v1/lists/3/users -Authorization: Bearer {{auth_token}} -Content-Type: application/json - -{"userID":"user4", "right":1} - -### - -# Update a users access to that list -POST http://localhost:8080/api/v1/lists/30/users/3 -Authorization: Bearer {{auth_token}} -Content-Type: application/json - -{"right":2} - -### - -# Delete a user from a list -DELETE http://localhost:8080/api/v1/lists/28/users/3 -Authorization: Bearer {{auth_token}} - -### - -# Get all pending tasks -GET http://localhost:8080/api/v1/tasks/all -Authorization: Bearer {{auth_token}} - -### - -# Get all pending tasks with priorities -GET http://localhost:8080/api/v1/tasks/all?sort=priorityasc -Authorization: Bearer {{auth_token}} - -### - -# Get all pending tasks in a range -GET http://localhost:8080/api/v1/tasks/all/dueadateasc/1546784000/1548784000 -Authorization: Bearer {{auth_token}} - -### - -# Get all pending tasks in caldav -GET http://localhost:8080/api/v1/tasks/caldav -#Authorization: Bearer {{auth_token}} - -### - -# Update a task -POST http://localhost:8080/api/v1/tasks/3565 -Authorization: Bearer {{auth_token}} -Content-Type: application/json - -{ - "priority": 0 -} - -### - -# Bulk update multiple tasks at once -POST http://localhost:8080/api/v1/tasks/bulk -Authorization: Bearer {{auth_token}} -Content-Type: application/json - -{ - "task_ids": [3518,3519,3521], - "text":"bulkupdated" -} - -### -# Get all assignees -GET http://localhost:8080/api/v1/tasks/3565/assignees -Authorization: Bearer {{auth_token}} - -### - -# Add a bunch of assignees -PUT http://localhost:8080/api/v1/tasks/3565/assignees/bulk -Authorization: Bearer {{auth_token}} -Content-Type: application/json - -{ - "assignees": [ - {"id": 17} - ] -} - -### - -# Get all users who have access to a list -GET http://localhost:8080/api/v1/lists/3/users -Authorization: Bearer {{auth_token}} - -### diff --git a/REST-Tests/namespaces.http b/REST-Tests/namespaces.http deleted file mode 100644 index d0eef8f116d..00000000000 --- a/REST-Tests/namespaces.http +++ /dev/null @@ -1,71 +0,0 @@ -# Get all namespaces -GET http://localhost:8080/api/v1/namespaces -Authorization: Bearer {{auth_token}} - -### - -# Get one namespaces -GET http://localhost:8080/api/v1/namespaces/-1 -Authorization: Bearer {{auth_token}} - -### - -# Get all users who have access to that namespace -GET http://localhost:8080/api/v1/namespaces/12/users -Authorization: Bearer {{auth_token}} - -### - -# Give a user access to that namespace -PUT http://localhost:8080/api/v1/namespaces/1/users -Authorization: Bearer {{auth_token}} -Content-Type: application/json - -{"user_id":3, "right": 0} - -### - -# Update a users access to that namespace -POST http://localhost:8080/api/v1/namespaces/1/users/3 -Authorization: Bearer {{auth_token}} -Content-Type: application/json - -{"right": 2} - -### - -# Delete a user from a namespace -DELETE http://localhost:8080/api/v1/namespaces/1/users/2 -Authorization: Bearer {{auth_token}} - -### - -# Get all teams who have access to that namespace -GET http://localhost:8080/api/v1/namespaces/1/teams -Authorization: Bearer {{auth_token}} - -### - -# Give a team access to that namespace -PUT http://localhost:8080/api/v1/namespaces/1/teams -Authorization: Bearer {{auth_token}} -Content-Type: application/json - -{"team_id":3, "right": 0} - -### - -# Update a teams access to that namespace -POST http://localhost:8080/api/v1/namespaces/1/teams/1 -Authorization: Bearer {{auth_token}} -Content-Type: application/json - -{"right": 0} - -### - -# Delete a team from a namespace -DELETE http://localhost:8080/api/v1/namespaces/1/teams/2 -Authorization: Bearer {{auth_token}} - -### \ No newline at end of file diff --git a/REST-Tests/teams.http b/REST-Tests/teams.http deleted file mode 100644 index bfbf5db6423..00000000000 --- a/REST-Tests/teams.http +++ /dev/null @@ -1,29 +0,0 @@ -# Get all teams -GET http://localhost:8080/api/v1/teams -Authorization: Bearer {{auth_token}} - -### - -# Get one team -GET http://localhost:8080/api/v1/teams/28 -Authorization: Bearer {{auth_token}} - -### - -# Add a new member to that team -PUT http://localhost:8080/api/v1/teams/28/members -Authorization: Bearer {{auth_token}} -Content-Type: application/json - -{ - "user_id": 2 -} - -### - -# Delete a member from a team -DELETE http://localhost:8080/api/v1/teams/28/members/2 -Authorization: Bearer {{auth_token}} - -### - diff --git a/REST-Tests/users.http b/REST-Tests/users.http deleted file mode 100644 index e33f4a04b88..00000000000 --- a/REST-Tests/users.http +++ /dev/null @@ -1,53 +0,0 @@ - -# Get all users -GET http://localhost:8080/api/v1/user -Authorization: Bearer {{auth_token}} - -###### -# Search for a user -GET http://localhost:8080/api/v1/users?s=3 -Authorization: Bearer {{auth_token}} - -### - -## Update password - -POST http://localhost:8080/api/v1/user/password -Authorization: Bearer {{auth_token}} -Content-Type: application/json - -{ - "old_password": "1234", - "new_password": "1234" -} - -### Request a password to reset a password -POST http://localhost:8080/api/v1/user/password/token -Content-Type: application/json -Accept: application/json - -{ - "email": "k@knt.li" -} - -### Request a token to reset a password -POST http://localhost:8080/api/v1/user/password/reset -Content-Type: application/json -Accept: application/json - -{ - "token": "eAsZzakgqARnjzXHqsHqZtSUKuiOhoJjHANhgTxUIDBSalhbtdpAdLeywGXzVDBuRQGNpHdMxoHXhLVSlzpJsFvuoJgMdkhRhkNhaQXfufuZCdtUlerZHSJQLgYMUryHIxIREcmZLtWoZVrYyARkCvkyFhcGtoCwQOEjAOEZMQQuxTVoGYfAqcfNggQnerUcXCiRIgRtkusXSnltomhaeyRwAbrckXFeXxUjslgplSGqSTOqJTYuhrSzAVTwNvuYyvuXLaZoNnJEyeVDWlRydnxfgUQjQZOKwCBRWVQPKpZhlslLUyUAMsRQkHITkruQCjDnOGCCRsSNplbNCEuDmMfpWYHSQAcQIDZtbQWkxzpfmHDMQvvKPPrxEnrTErlvTfKDKICFYPQxXNpNE", - "new_password": "1234" -} - -### Confirm a users email address - -POST http://localhost:8080/api/v1/user/confirm -Content-Type: application/json -Accept: application/json - -{ - "token": "" -} - -### diff --git a/rest/bruno.json b/rest/bruno.json new file mode 100644 index 00000000000..29cda64ae6b --- /dev/null +++ b/rest/bruno.json @@ -0,0 +1,5 @@ +{ + "version": "1", + "name": "API-Requests", + "type": "collection" +} \ No newline at end of file diff --git a/rest/environments/local.bru b/rest/environments/local.bru new file mode 100644 index 00000000000..4a3502db5e8 --- /dev/null +++ b/rest/environments/local.bru @@ -0,0 +1,3 @@ +vars { + host: http://localhost:3456 +} diff --git a/rest/login.bru b/rest/login.bru new file mode 100644 index 00000000000..92ce1f54894 --- /dev/null +++ b/rest/login.bru @@ -0,0 +1,26 @@ +meta { + name: login + type: http + seq: 1 +} + +post { + url: {{host}}/api/v1/login + body: json +} + +body:json { + { + "username": "{{username}}", + "password": "{{password}}" + } +} + +vars:pre-request { + username: test + password: 12345678 +} + +vars:post-response { + token: res.body.token +} diff --git a/rest/user info.bru b/rest/user info.bru new file mode 100644 index 00000000000..c9b94a84fda --- /dev/null +++ b/rest/user info.bru @@ -0,0 +1,14 @@ +meta { + name: user info + type: http + seq: 2 +} + +get { + url: {{host}}/api/v1/user + body: none +} + +headers { + Authorization: Bearer {{token}} +}