title | language_tabs | language_clients | toc_footers | includes | search | highlight_theme | headingLevel | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
User service v0.0.1 |
|
|
true |
darkula |
2 |
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
Because we need users
Base URLs:
License: Apache 2.0
users informations and manipulations
Code samples
# You can also use wget
curl -X GET http://127.0.0.1:3333/users \
-H 'Accept: application/json'
const headers = {
'Accept':'application/json'
};
fetch('http://127.0.0.1:3333/users',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
GET /users
List of all users
Example responses
200 Response
[
{
"id": 0,
"username": "string",
"statut": "string",
"score": 0,
"password": "string"
}
]
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | Inline |
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [User] | false | none | [a user] |
» user | User | false | none | a user |
»» id | integer(int64) | false | none | id of the user |
»» username | string(text) | false | none | name of the user |
»» statut | string | false | none | status of the user |
»» score | integer(number) | false | none | score of the player |
»» password | string(text) | false | none | password of the user |
Code samples
# You can also use wget
curl -X POST http://127.0.0.1:3333/users \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
const inputBody = '{
"id": 0,
"username": "string",
"statut": "string",
"score": 0,
"password": "string"
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json'
};
fetch('http://127.0.0.1:3333/users',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /users
Add a new user
Body parameter
{
"id": 0,
"username": "string",
"statut": "string",
"score": 0,
"password": "string"
}
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | User | true | none |
Example responses
201 Response
{
"id": 0,
"username": "string",
"statut": "string",
"score": 0,
"password": "string"
}
Status | Meaning | Description | Schema |
---|---|---|---|
201 | Created | Created | User |
409 | Conflict | unsuccessful operation | None |
Code samples
# You can also use wget
curl -X POST http://127.0.0.1:3333/auth/connect?username=string&password=string \
-H 'Accept: application/json'
const headers = {
'Accept':'application/json'
};
fetch('http://127.0.0.1:3333/auth/connect?username=string&password=string',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /auth/connect
Connect the user
Name | In | Type | Required | Description |
---|---|---|---|---|
username | query | string | true | none |
password | query | string | true | none |
Example responses
200 Response
"string"
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Authentificated, return the token | string |
401 | Unauthorized | wrong credentials | None |
Code samples
# You can also use wget
curl -X GET http://127.0.0.1:3333/users/{id} \
-H 'Accept: application/json'
const headers = {
'Accept':'application/json'
};
fetch('http://127.0.0.1:3333/users/{id}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
GET /users/{id}
Retrieves a specific user
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | integer | true | The user ID |
Example responses
200 Response
{
"id": 0,
"username": "string",
"statut": "string",
"score": 0,
"password": "string"
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | User |
401 | Unauthorized | invalid credentials | None |
Code samples
# You can also use wget
curl -X PUT http://127.0.0.1:3333/internal/users/{id}/increment-score \
-H 'Accept: application/json'
const headers = {
'Accept':'application/json'
};
fetch('http://127.0.0.1:3333/internal/users/{id}/increment-score',
{
method: 'PUT',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
PUT /internal/users/{id}/increment-score
Increment the score of a user by 1
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | integer | true | The user ID |
Example responses
200 Response
{
"id": 0,
"username": "string",
"statut": "string",
"score": 0,
"password": "string"
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | successful operation | User |
404 | Not Found | user not found | None |
{
"id": 0,
"username": "string",
"statut": "string",
"score": 0,
"password": "string"
}
user
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | integer(int64) | false | none | id of the user |
username | string(text) | false | none | name of the user |
statut | string | false | none | status of the user |
score | integer(number) | false | none | score of the player |
password | string(text) | false | none | password of the user |