MENU navbar-image

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"
]
 

Request      

GET api/v1/ping

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

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": "&laquo; Previous",
                "active": false
            },
            {
                "url": "/?page=1",
                "label": "1",
                "active": true
            },
            {
                "url": null,
                "label": "Next &raquo;",
                "active": false
            }
        ],
        "path": "/",
        "per_page": 10,
        "to": 2,
        "total": 2
    }
}
 

Request      

GET api/v1/products

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

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"}
 

Request      

GET api/v1/products/{id}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The ID of the product. Example: 1

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"
    }
}
 

Request      

POST api/v1/products

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

name   string   

The name of the product Example: Monkey King Wukong

category   string   

The category of the product Example: game

status   string   

An integer representing status Example: inactive

Must be one of:
  • active
  • inactive