Examples
Example 1: Authenticate via curl
curl -X POST https://api.veraetime.net/api/auth \
-H "Content-Type: application/json" \
-d '{
"username": "user@example.com",
"password": "secret"
}'
Response:
{
"status": "success",
"message": "Authentication successful"
}
Example 2: List available APIs
curl -X GET https://api.veraetime.net/api/list
Response:
{
"status": "success",
"apis": [
{
"name": "auth-signin",
"method": "POST",
"path": "/v1/auth/signin",
"description": "Sign in to evercycle"
},
{
"name": "get-all",
"method": "GET",
"path": "/v1/asset",
"description": "Get all Assets"
}
]
}
Example 3: Get all assets (paginated)
curl -X GET "https://api.veraetime.net/api/get-all?page_num=1&per_page=10"
Response:
{
"status": "success",
"data": [
{ "id": 1, "make": "Apple", "model": "iPhone 14", ... },
{ "id": 2, "make": "Samsung", "model": "Galaxy S23", ... }
]
}
Example 4: Get asset by ID
curl -X GET "https://api.veraetime.net/api/get-asset-id?id=12345"
Response:
{
"status": "success",
"data": {
"id": 12345,
"asset_type_id": 1,
"year": 2023,
"make": "Apple",
"model": "iPhone 14 Pro",
"serial_number": "SN-ABC-123",
...
}
}
Example 5: Create a new asset
curl -X POST https://api.veraetime.net/api/create \
-H "Content-Type: application/json" \
-d '{
"asset_type_id": 1,
"year": 2023,
"make": "Apple",
"model": "iPhone 14 Pro",
"serial_number": "SN-TEST-9999",
"asset_reference": "REF-9999",
"asset_damage_type_id": 0,
"damage_description": "",
"carrier": "Unlocked",
"cpu": "A16",
"ram": "6GB",
"screen": "6.1 inch",
"purchase_date": "2023-01-15",
"asset_user_first_name": "John",
"asset_user_last_name": "Doe",
"asset_user_email": "john@example.com",
"asset_user_phone": "555-1234",
"archived": 0
}'
Response:
{
"status": "success",
"data": {
"id": 99999,
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z"
}
}
Example 6: Edit an asset
curl -X PUT https://api.veraetime.net/api/edit-asset-id \
-H "Content-Type: application/json" \
-d '{
"id": 12345,
"make": "Apple",
"model": "iPhone 14 Pro Max",
"damage_description": "Minor scratch on screen"
}'
Example 7: Update grade price
curl -X PUT https://api.veraetime.net/api/grade \
-H "Content-Type: application/json" \
-d '{
"id": 12345,
"grade": "A+",
"price": 850.00
}'
Example 8: CLI usage — generate configs
cd /opt/evercycle-api/evercycle-api
python3 ../src/api_runner.py generate
Example 9: CLI usage — authenticate and run an API
cd /opt/evercycle-api/evercycle-api
python3 ../src/api_runner.py run auth-signin
python3 ../src/api_runner.py run get-all
Example 10: Python programmatic usage
import sys
sys.path.append('/opt/evercycle-api/src')
from evercycle_api import EvercycleApiClient
client = EvercycleApiClient(api_dir='/opt/evercycle-api/evercycle-api')
# Authenticate
client.authenticate('user@example.com', 'secret')
# List APIs
client.list_apis()
# Call an API
client.call_api('get-all')
client.call_api('get-asset-id', '12345')
client.call_api('create', '{"make":"Apple","model":"iPhone 14"}')