Introduction
This is an assessment for Pay4Me.app to build a crud application using filament, with some unit tests and documentation to be done using Laravel Scribe
This documentation aims to provide all the information you need to work with our API.
<aside>As you scroll, you'll see code examples for working with the API in different programming languages in the dark area to the right (or as part of the content on mobile).
You can switch the language used with the tabs at the top right (or from the nav menu at the top left on mobile).</aside>
Authenticating requests
This API is not authenticated.
Health
Endpoints for checking health of api
Check Program Health
Example request:
curl --request GET \
--get "https://pay4me.laravel.cloud/api/v1/ping" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://pay4me.laravel.cloud/api/v1/ping"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (200):
[
"Pong"
]
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Product
Product Related Apis
List all products
This endpoint returns a paginated list of all products
Example request:
curl --request GET \
--get "https://pay4me.laravel.cloud/api/v1/products" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://pay4me.laravel.cloud/api/v1/products"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (200):
{
"data": [
{
"id": 1,
"name": "Scribe Product",
"category": "electronics",
"status": "active",
"created_at": "2025-03-26T21:52:20.000000Z",
"updated_at": "2025-03-26T21:52:20.000000Z"
},
{
"id": 1,
"name": "Scribe Product",
"category": "electronics",
"status": "active",
"created_at": "2025-03-26T21:52:20.000000Z",
"updated_at": "2025-03-26T21:52:20.000000Z"
}
],
"links": {
"first": "/?page=1",
"last": "/?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"links": [
{
"url": null,
"label": "« Previous",
"active": false
},
{
"url": "/?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "Next »",
"active": false
}
],
"path": "/",
"per_page": 10,
"to": 2,
"total": 2
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Display Single Product
This endpoint displays a specific product
Example request:
curl --request GET \
--get "https://pay4me.laravel.cloud/api/v1/products/1" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://pay4me.laravel.cloud/api/v1/products/1"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (200):
{
"data": {
"id": 1,
"name": "Scribe Product",
"category": "electronics",
"status": "active",
"created_at": "2025-03-26T21:52:20.000000Z",
"updated_at": "2025-03-26T21:52:20.000000Z"
}
}
Example response (404):
{"message": "App\Models\Product not found"}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Create New Product
This endpoint creates a new product
Example request:
curl --request POST \
"https://pay4me.laravel.cloud/api/v1/products" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"Monkey King Wukong\",
\"category\": \"game\",
\"status\": \"inactive\"
}"
const url = new URL(
"https://pay4me.laravel.cloud/api/v1/products"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "Monkey King Wukong",
"category": "game",
"status": "inactive"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
Example response (200):
{
"data": {
"id": 1,
"name": "Scribe Product",
"category": "electronics",
"status": "active",
"created_at": "2025-03-26T21:52:20.000000Z",
"updated_at": "2025-03-26T21:52:20.000000Z"
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.