Last active
January 17, 2025 15:03
-
-
Save pepeloper/47d6e7eb11b394c6536e7ee8a2b35940 to your computer and use it in GitHub Desktop.
API Postman para eventos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"info": { | |
"_postman_id": "e54c880d-ad6c-4855-94b4-ce89c519b298", | |
"name": "Events API", | |
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", | |
"_exporter_id": "3317557" | |
}, | |
"item": [ | |
{ | |
"name": "Auth", | |
"item": [ | |
{ | |
"name": "Register", | |
"event": [ | |
{ | |
"listen": "test", | |
"script": { | |
"exec": [ | |
"var jsonData = pm.response.json();", | |
"if (jsonData.token) {", | |
" pm.collectionVariables.set(\"token\", jsonData.token);", | |
"}", | |
"", | |
"if (jsonData.user && jsonData.user.company) {", | |
" pm.collectionVariables.set(\"company_id\", jsonData.user.company.id);", | |
"}" | |
], | |
"type": "text/javascript", | |
"packages": {} | |
} | |
} | |
], | |
"request": { | |
"method": "POST", | |
"header": [], | |
"body": { | |
"mode": "raw", | |
"raw": "{\n \"name\": \"Pepe Garcia\",\n \"email\": \"[email protected]\",\n \"password\": \"password123\",\n \"company\": {\n \"name\": \"Pepe 5 Company\",\n \"description\": \"Company description\",\n \"cif\": \"123456N\"\n }\n}", | |
"options": { | |
"raw": { | |
"language": "json" | |
} | |
} | |
}, | |
"url": { | |
"raw": "{{base_url}}/api/auth/register", | |
"host": [ | |
"{{base_url}}" | |
], | |
"path": [ | |
"api", | |
"auth", | |
"register" | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "Login", | |
"event": [ | |
{ | |
"listen": "test", | |
"script": { | |
"exec": [ | |
"var jsonData = pm.response.json();", | |
"if (jsonData.token) {", | |
" pm.collectionVariables.set(\"token\", jsonData.token);", | |
"}", | |
"", | |
"if (jsonData.user && jsonData.user.company) {", | |
" pm.collectionVariables.set(\"company_id\", jsonData.user.company.id);", | |
"}" | |
], | |
"type": "text/javascript", | |
"packages": {} | |
} | |
} | |
], | |
"request": { | |
"method": "POST", | |
"header": [], | |
"body": { | |
"mode": "raw", | |
"raw": "{\n \"email\": \"[email protected]\",\n \"password\": \"password123\"\n}", | |
"options": { | |
"raw": { | |
"language": "json" | |
} | |
} | |
}, | |
"url": { | |
"raw": "{{base_url}}/api/auth/login", | |
"host": [ | |
"{{base_url}}" | |
], | |
"path": [ | |
"api", | |
"auth", | |
"login" | |
] | |
} | |
}, | |
"response": [] | |
} | |
] | |
}, | |
{ | |
"name": "Events", | |
"item": [ | |
{ | |
"name": "Get All Events", | |
"request": { | |
"method": "GET", | |
"header": [ | |
{ | |
"key": "Authorization", | |
"value": "Bearer {{token}}", | |
"type": "text" | |
} | |
], | |
"url": { | |
"raw": "{{base_url}}/api/company/{{company_id}}/events", | |
"host": [ | |
"{{base_url}}" | |
], | |
"path": [ | |
"api", | |
"company", | |
"{{company_id}}", | |
"events" | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "Get Event by ID", | |
"request": { | |
"method": "GET", | |
"header": [ | |
{ | |
"key": "Authorization", | |
"value": "Bearer {{token}}", | |
"type": "text" | |
} | |
], | |
"url": { | |
"raw": "{{base_url}}/api/company/{{company_id}}/events/:id", | |
"host": [ | |
"{{base_url}}" | |
], | |
"path": [ | |
"api", | |
"company", | |
"{{company_id}}", | |
"events", | |
":id" | |
], | |
"variable": [ | |
{ | |
"key": "id", | |
"value": "6787ce7ac2eb1bf89280ada3" | |
} | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "Create Event", | |
"request": { | |
"method": "POST", | |
"header": [ | |
{ | |
"key": "Authorization", | |
"value": "Bearer {{token}}", | |
"type": "text" | |
} | |
], | |
"body": { | |
"mode": "raw", | |
"raw": "{\n \"name\": \"Pepevent Event 2.0\",\n \"description\": \"Event description\",\n \"start_at\": \"2024-03-20T10:00:00.000Z\",\n \"ends_at\": \"2024-03-20T18:00:00.000Z\",\n \"booking_available\": true,\n \"max_tickets_for_order\": 5,\n \"address\": \"Calle Pez, 4\"\n}", | |
"options": { | |
"raw": { | |
"language": "json" | |
} | |
} | |
}, | |
"url": { | |
"raw": "{{base_url}}/api/company/{{company_id}}/events", | |
"host": [ | |
"{{base_url}}" | |
], | |
"path": [ | |
"api", | |
"company", | |
"{{company_id}}", | |
"events" | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "Update Event", | |
"request": { | |
"method": "PUT", | |
"header": [ | |
{ | |
"key": "Authorization", | |
"value": "Bearer {{token}}", | |
"type": "text" | |
} | |
], | |
"body": { | |
"mode": "raw", | |
"raw": "{\n \"name\": \"Updated Event Name 2.0\",\n \"description\": \"Updated event description\",\n \"start_at\": \"2024-03-20T10:00:00.000Z\",\n \"ends_at\": \"2024-03-20T18:00:00.000Z\",\n \"booking_available\": true,\n \"max_tickets_for_order\": 10,\n \"address\": \"Updated Address, 123\"\n}", | |
"options": { | |
"raw": { | |
"language": "json" | |
} | |
} | |
}, | |
"url": { | |
"raw": "{{base_url}}/api/company/{{company_id}}/events/:id", | |
"host": [ | |
"{{base_url}}" | |
], | |
"path": [ | |
"api", | |
"company", | |
"{{company_id}}", | |
"events", | |
":id" | |
], | |
"variable": [ | |
{ | |
"key": "id", | |
"value": "6787ce7ac2eb1bf89280ada3" | |
} | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "Delete Event", | |
"request": { | |
"method": "DELETE", | |
"header": [ | |
{ | |
"key": "Authorization", | |
"value": "Bearer {{token}}", | |
"type": "text" | |
} | |
], | |
"url": { | |
"raw": "{{base_url}}/api/company/{{company_id}}/events/:id", | |
"host": [ | |
"{{base_url}}" | |
], | |
"path": [ | |
"api", | |
"company", | |
"{{company_id}}", | |
"events", | |
":id" | |
], | |
"variable": [ | |
{ | |
"key": "id", | |
"value": "6787ce7ac2eb1bf89280ada3" | |
} | |
] | |
} | |
}, | |
"response": [] | |
} | |
] | |
}, | |
{ | |
"name": "Orders", | |
"item": [ | |
{ | |
"name": "Get All Orders", | |
"request": { | |
"method": "GET", | |
"header": [ | |
{ | |
"key": "Authorization", | |
"value": "Bearer {{token}}", | |
"type": "text" | |
} | |
], | |
"url": { | |
"raw": "{{base_url}}/api/company/{{company_id}}/events/{{event_id}}/orders", | |
"host": [ | |
"{{base_url}}" | |
], | |
"path": [ | |
"api", | |
"company", | |
"{{company_id}}", | |
"events", | |
"{{event_id}}", | |
"orders" | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "Get Order by ID", | |
"request": { | |
"method": "GET", | |
"header": [ | |
{ | |
"key": "Authorization", | |
"value": "Bearer {{token}}", | |
"type": "text" | |
} | |
], | |
"url": { | |
"raw": "{{base_url}}/api/company/{{company_id}}/events/{{event_id}}/orders/:id", | |
"host": [ | |
"{{base_url}}" | |
], | |
"path": [ | |
"api", | |
"company", | |
"{{company_id}}", | |
"events", | |
"{{event_id}}", | |
"orders", | |
":id" | |
], | |
"variable": [ | |
{ | |
"key": "id", | |
"value": "" | |
} | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "Create Order", | |
"request": { | |
"method": "POST", | |
"header": [], | |
"body": { | |
"mode": "raw", | |
"raw": "{\n \"items\": [\n {\n \"name\": \"John Doe\",\n \"email\": \"[email protected]\",\n \"identification_number\": \"12345678A\",\n \"price\": 29999,\n \"product_id\": \"6787d89cc32904f73acdfaa3\"\n }\n ]\n}", | |
"options": { | |
"raw": { | |
"language": "json" | |
} | |
} | |
}, | |
"url": { | |
"raw": "{{base_url}}/api/company/{{company_id}}/events/{{event_id}}/orders", | |
"host": [ | |
"{{base_url}}" | |
], | |
"path": [ | |
"api", | |
"company", | |
"{{company_id}}", | |
"events", | |
"{{event_id}}", | |
"orders" | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "Update Order", | |
"request": { | |
"method": "PUT", | |
"header": [ | |
{ | |
"key": "Authorization", | |
"value": "Bearer {{token}}", | |
"type": "text" | |
} | |
], | |
"body": { | |
"mode": "raw", | |
"raw": "{\n \"status\": \"confirmed\"\n}", | |
"options": { | |
"raw": { | |
"language": "json" | |
} | |
} | |
}, | |
"url": { | |
"raw": "{{base_url}}/api/company/{{company_id}}/events/{{event_id}}/orders/:id", | |
"host": [ | |
"{{base_url}}" | |
], | |
"path": [ | |
"api", | |
"company", | |
"{{company_id}}", | |
"events", | |
"{{event_id}}", | |
"orders", | |
":id" | |
], | |
"variable": [ | |
{ | |
"key": "id", | |
"value": "67884b4521e1441eebedae1e" | |
} | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "Delete Order", | |
"request": { | |
"method": "DELETE", | |
"header": [ | |
{ | |
"key": "Authorization", | |
"value": "Bearer {{token}}", | |
"type": "text" | |
} | |
], | |
"url": { | |
"raw": "{{base_url}}/api/company/{{company_id}}/events/{{event_id}}/orders/:id", | |
"host": [ | |
"{{base_url}}" | |
], | |
"path": [ | |
"api", | |
"company", | |
"{{company_id}}", | |
"events", | |
"{{event_id}}", | |
"orders", | |
":id" | |
], | |
"variable": [ | |
{ | |
"key": "id", | |
"value": "67884b4521e1441eebedae1e" | |
} | |
] | |
} | |
}, | |
"response": [] | |
} | |
] | |
}, | |
{ | |
"name": "Products", | |
"item": [ | |
{ | |
"name": "Get All Products", | |
"request": { | |
"method": "GET", | |
"header": [ | |
{ | |
"key": "Authorization", | |
"value": "Bearer {{token}}", | |
"type": "text" | |
} | |
], | |
"url": { | |
"raw": "{{base_url}}/api/company/{{company_id}}/events/{{event_id}}/products", | |
"host": [ | |
"{{base_url}}" | |
], | |
"path": [ | |
"api", | |
"company", | |
"{{company_id}}", | |
"events", | |
"{{event_id}}", | |
"products" | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "Get Product by ID", | |
"request": { | |
"method": "GET", | |
"header": [ | |
{ | |
"key": "Authorization", | |
"value": "Bearer {{token}}", | |
"type": "text" | |
} | |
], | |
"url": { | |
"raw": "{{base_url}}/api/company/{{company_id}}/events/{{event_id}}/products/:id", | |
"host": [ | |
"{{base_url}}" | |
], | |
"path": [ | |
"api", | |
"company", | |
"{{company_id}}", | |
"events", | |
"{{event_id}}", | |
"products", | |
":id" | |
], | |
"variable": [ | |
{ | |
"key": "id", | |
"value": "6787d89cc32904f73acdfaa3" | |
} | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "Create Product", | |
"request": { | |
"method": "POST", | |
"header": [ | |
{ | |
"key": "Authorization", | |
"value": "Bearer {{token}}", | |
"type": "text" | |
} | |
], | |
"body": { | |
"mode": "raw", | |
"raw": "{\n \"name\": \"New Product 2\",\n \"description\": \"New product 2 description\",\n \"price\": 29999,\n \"max_sales\": 500\n}", | |
"options": { | |
"raw": { | |
"language": "json" | |
} | |
} | |
}, | |
"url": { | |
"raw": "{{base_url}}/api/company/{{company_id}}/events/{{event_id}}/products", | |
"host": [ | |
"{{base_url}}" | |
], | |
"path": [ | |
"api", | |
"company", | |
"{{company_id}}", | |
"events", | |
"{{event_id}}", | |
"products" | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "Update Product", | |
"request": { | |
"method": "PUT", | |
"header": [ | |
{ | |
"key": "Authorization", | |
"value": "Bearer {{token}}", | |
"type": "text" | |
}, | |
{ | |
"key": "Content-Type", | |
"value": "application/json", | |
"type": "text" | |
} | |
], | |
"body": { | |
"mode": "raw", | |
"raw": "{\n \"name\": \"Updated Product 2\",\n \"description\": \"Updated product 2 description\",\n \"price\": 25999\n}", | |
"options": { | |
"raw": { | |
"language": "json" | |
} | |
} | |
}, | |
"url": { | |
"raw": "{{base_url}}/api/company/{{company_id}}/events/{{event_id}}/products/:id", | |
"host": [ | |
"{{base_url}}" | |
], | |
"path": [ | |
"api", | |
"company", | |
"{{company_id}}", | |
"events", | |
"{{event_id}}", | |
"products", | |
":id" | |
], | |
"variable": [ | |
{ | |
"key": "id", | |
"value": "678843296ace31a160e380aa" | |
} | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "Delete Product", | |
"request": { | |
"method": "DELETE", | |
"header": [ | |
{ | |
"key": "Authorization", | |
"value": "Bearer {{token}}", | |
"type": "text" | |
} | |
], | |
"url": { | |
"raw": "{{base_url}}/api/company/{{company_id}}/events/{{event_id}}/products/:id", | |
"host": [ | |
"{{base_url}}" | |
], | |
"path": [ | |
"api", | |
"company", | |
"{{company_id}}", | |
"events", | |
"{{event_id}}", | |
"products", | |
":id" | |
], | |
"variable": [ | |
{ | |
"key": "id", | |
"value": "678843296ace31a160e380aa" | |
} | |
] | |
} | |
}, | |
"response": [] | |
} | |
] | |
} | |
], | |
"variable": [ | |
{ | |
"key": "base_url", | |
"value": "http://localhost:3000" | |
}, | |
{ | |
"key": "token", | |
"value": "" | |
}, | |
{ | |
"key": "company_id", | |
"value": "" | |
}, | |
{ | |
"key": "event_id", | |
"value": "6787ce7ac2eb1bf89280ada3", | |
"type": "default" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment