Documentation API


Avant d'utiliser l'API, vous devez générer un token depuis votre compte qu'il vous suffira ensuite de transmettre lors des requêtes.
Obtenir la collection Postman

Récupère l'ensemble des personnages


Requête HTTP

GET api/personnages

Exemple de requête:

curl -X GET \
    -G "https://www.apistarwars.limacedric.com/api/personnages" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "Authorization: Bearer {token}"
const url = new URL(
    "https://www.apistarwars.limacedric.com/api/personnages"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer {token}",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (401):

{
    "message": "Unauthenticated."
}

Récupère l'ensemble des personnages avec pagination


Requête HTTP

GET api/personnages/paginate/{pagination}

$pagination par défault à comme valeur 15

Exemple de requête:

curl -X GET \
    -G "https://www.apistarwars.limacedric.com/api/personnages/paginate/1" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "Authorization: Bearer {token}"
const url = new URL(
    "https://www.apistarwars.limacedric.com/api/personnages/paginate/1"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer {token}",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (401):

{
    "message": "Unauthenticated."
}

Permet de récupérer les personnages via le nom


Requête HTTP

GET api/personnages/{name}

Exemple de requête:

curl -X GET \
    -G "https://www.apistarwars.limacedric.com/api/personnages/1" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "Authorization: Bearer {token}"
const url = new URL(
    "https://www.apistarwars.limacedric.com/api/personnages/1"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer {token}",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (401):

{
    "message": "Unauthenticated."
}

Retourne l'ensemble des planètes


Requête HTTP

GET api/planetes

Exemple de requête:

curl -X GET \
    -G "https://www.apistarwars.limacedric.com/api/planetes" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "Authorization: Bearer {token}"
const url = new URL(
    "https://www.apistarwars.limacedric.com/api/planetes"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer {token}",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (401):

{
    "message": "Unauthenticated."
}

Permet de récupérer les planètes via le nom


Requête HTTP

GET api/planetes/{planetes}

Exemple de requête:

curl -X GET \
    -G "https://www.apistarwars.limacedric.com/api/planetes/1" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "Authorization: Bearer {token}"
const url = new URL(
    "https://www.apistarwars.limacedric.com/api/planetes/1"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer {token}",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (401):

{
    "message": "Unauthenticated."
}