curl --request GET \
--url https://api.example.com/api/v1/branches{
"success": true,
"data": [
{
"id": 123,
"company_id": 123,
"codigo": "<string>",
"nombre": "<string>",
"direccion": "<string>",
"ubigeo": "<string>",
"distrito": "<string>",
"provincia": "<string>",
"departamento": "<string>",
"telefono": "<string>",
"email": "<string>",
"series_factura": [
{}
],
"series_boleta": [
{}
],
"series_nota_credito": [
{}
],
"series_nota_debito": [
{}
],
"series_guia_remision": [
{}
],
"activo": true,
"company": {
"id": 123,
"ruc": "<string>",
"razon_social": "<string>"
},
"created_at": "<string>",
"updated_at": "<string>"
}
],
"meta": {
"total": 123,
"companies_count": 123
}
}curl --request GET \
--url https://api.example.com/api/v1/branches{
"success": true,
"data": [
{
"id": 123,
"company_id": 123,
"codigo": "<string>",
"nombre": "<string>",
"direccion": "<string>",
"ubigeo": "<string>",
"distrito": "<string>",
"provincia": "<string>",
"departamento": "<string>",
"telefono": "<string>",
"email": "<string>",
"series_factura": [
{}
],
"series_boleta": [
{}
],
"series_nota_credito": [
{}
],
"series_nota_debito": [
{}
],
"series_guia_remision": [
{}
],
"activo": true,
"company": {
"id": 123,
"ruc": "<string>",
"razon_social": "<string>"
},
"created_at": "<string>",
"updated_at": "<string>"
}
],
"meta": {
"total": 123,
"companies_count": 123
}
}Authorization: Bearer YOUR_API_TOKEN
Show Branch Object
curl -X GET https://api.yourdomain.com/api/v1/branches \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json"
curl -X GET "https://api.yourdomain.com/api/v1/branches?company_id=1" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json"
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://api.yourdomain.com/api/v1/branches', [
'headers' => [
'Authorization' => 'Bearer YOUR_API_TOKEN',
'Accept' => 'application/json',
],
'query' => [
'company_id' => 1,
],
]);
echo $response->getBody();
const response = await fetch(
'https://api.yourdomain.com/api/v1/branches?company_id=1',
{
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Accept': 'application/json'
}
}
);
const data = await response.json();
console.log(data);
{
"success": true,
"data": [
{
"id": 1,
"company_id": 1,
"codigo": "0001",
"nombre": "Sucursal Principal",
"direccion": "Av. Los Olivos 123",
"ubigeo": "150101",
"distrito": "San Isidro",
"provincia": "Lima",
"departamento": "Lima",
"telefono": "01-1234567",
"email": "[email protected]",
"series_factura": ["F001", "F002"],
"series_boleta": ["B001"],
"series_nota_credito": ["FC01"],
"series_nota_debito": ["FD01"],
"series_guia_remision": ["T001"],
"activo": true,
"company": {
"id": 1,
"ruc": "20123456789",
"razon_social": "EMPRESA DEMO S.A.C."
},
"created_at": "2024-01-15T10:30:00.000000Z",
"updated_at": "2024-03-01T15:45:00.000000Z"
},
{
"id": 2,
"company_id": 1,
"codigo": "0002",
"nombre": "Sucursal Norte",
"direccion": "Av. Túpac Amaru 456",
"ubigeo": "150102",
"distrito": "Independencia",
"provincia": "Lima",
"departamento": "Lima",
"telefono": "01-9876543",
"email": "[email protected]",
"series_factura": ["F003"],
"series_boleta": ["B002"],
"series_nota_credito": ["FC02"],
"series_nota_debito": ["FD02"],
"series_guia_remision": ["T002"],
"activo": true,
"company": {
"id": 1,
"ruc": "20123456789",
"razon_social": "EMPRESA DEMO S.A.C."
},
"created_at": "2024-02-10T11:20:00.000000Z",
"updated_at": "2024-02-10T11:20:00.000000Z"
}
],
"meta": {
"total": 2,
"companies_count": 1
}
}
{
"success": false,
"message": "Error al obtener sucursales: Database connection failed"
}
GET /api/v1/companies/{company_id}/branches