Skip to content

Services#

You must be authenticated to use this resource.

Create a new service#

POST /services/

Request#

1
2
3
4
5
6
7
curl -X "POST" "http://0.0.0.0:8000/services/" \
     -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...' \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d '{
           "name": "service-1",
           "description": "service description"
         }'

Response#

1
{"message": "Service created successfully."}
1
{"message": "Unauthorized."}

Get all services#

GET /services/

Request#

1
2
curl "http://0.0.0.0:8000/services/" \
     -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...'

Response#

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
[
  {
    "id": 1,
    "name": "Service-1",
    "description": "Service-1",
    "token": "_Ld_k_26y7H-Ar9og6cEz54rkNZEDkW1BIrkgSAFFg"
  },
  {
    "id": 2,
    "name": "Service-2",
    "description": "Service-2",
    "token": "_wm-zTzCP4owZAIxsvT9jQ6h0mv3JZf-E_UR-LBXgQ"
  }
]
1
{"message": "Unauthorized."}

Get service by id#

GET /service/{id}

Request#

1
2
curl "http://0.0.0.0:8000/services/1" \
     -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...'

Response#

1
2
3
4
5
{
  "id": 1,
  "name": "service-1",
  "description": "service description",
}
1
{"message": "Unauthorized."}
1
{"message": "Service not found."}

Update service#

PUT /services/{id}

Request#

1
2
3
4
5
6
7
curl -X "PUT" "http://0.0.0.0:8000/services/" \
     -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...' \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
            "name": "service-1",
            "description": "new service description"
          }'

Response#

1
{"message": "Service update successfully."}
1
{"message": "Unauthorized."}
1
{"message": "Service not found."}

Delete service#

DELETE /services/{id}

Request#

1
2
curl "http://0.0.0.0:8000/services/1" \
     -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...'

Response#

1
{"message": "Service deleted successfully."}
1
{"message": "Unauthorized."}
1
{"message": "Service not found."}

Service data#

Field Type Description
name String Service name.
description String Service description.