{"activeVersionTag":"latest","latestAvailableVersionTag":"latest","collection":{"info":{"_postman_id":"eaf56457-3b5c-4914-8cfb-355b0ce314bd","name":"PEDIDOS","description":"Descripción\n\nReglas de negocio explicadas:\n\n### (POST)\n\n- Todo pedido nuevo siempre inicia en estado `\"pendiente\"`. El backend ignora cualquier estado enviado por el cliente para garantizar la integridad del flujo de trabajo.\n    \n- No se puede crear un pedido con una cantidad menor o igual a 0. El sistema valida que el valor sea un entero positivo antes de procesar la solicitud.\n    \n\n---\n\n### (PUT)\n\n- Un pedido en estado `\"pendiente\"` solo puede transicionar a `\"confirmado\"` o `\"cancelado\"`. Cualquier otro estado será rechazado por el controlador.\n    \n- Un pedido con estado `\"confirmado\"` o `\"cancelado\"` se considera un registro histórico y **NO** puede ser modificado bajo ninguna circunstancia.\n    \n\n---\n\n### (DELETE)\n\n- Solo se permite la eliminación de pedidos que se encuentren en estado \"pendiente\". Si el pedido ya fue \"confirmado\" o \"cancelado\", el sistema bloquea la acción para proteger la trazabilidad de los datos.\n    \n\n- Uso de campos privados \"#pedidos\" en la clase repositorio.\n    \n- Se usa \"Number\" para asegurar que todas las comparaciones de ID y cálculos de cantidad se realicen con tipo entero o número vaya.\n    \n- Al consultar la lista, el repositorio devuelve una copia del arreglo en lugar de la referencia original, el spread operator.\n    \n\nLa colección **PEDIDOS** agrupa un conjunto sencillo de endpoints tipo CRUD para gestionar **pedidos** en un servidor de desarrollo local.\n\n- **URL base (local)**: `http://localhost:3000`\n    \n- **Recurso principal**: `/pedidos`\n    \n- **Casos de uso**:\n    \n    - Listar todos los pedidos\n        \n    - Consultar un pedido por su ID\n        \n    - Crear un nuevo pedido\n        \n    - Actualizar un pedido existente\n        \n    - Eliminar un pedido\n        \n\nActualmente no hay carpetas; todos los requests están en la raíz de la colección.\n\n1. [<b>Leer pedidos</b>](https://request/51906899-c6dc53cd-9ad6-47b5-888f-65b736001846)\n    \n    - **Método**: `GET`\n        \n    - **URL**: `http://localhost:3000/pedidos`\n        \n    - **Descripción**: Obtiene el listado completo de pedidos.\n        \n2. **Leer pedidos por ID**\n    \n    - **Método**: `GET`\n        \n    - **Patrón de URL**: `http://localhost:3000/pedidos/:id`\n        \n    - **Descripción**: Obtiene un pedido específico por su ID numérico.\n        \n3. [<b>Agregar Pedidos</b>](https://request/51906899-2e6fa12a-b612-48a0-ac4c-76a032c94660)\n    \n    - **Método**: `POST`\n        \n    - **URL**: `http://localhost:3000/pedidos`\n        \n    - **Descripción**: Crea un nuevo pedido con los datos enviados en el cuerpo de la petición.\n        \n4. Actualizar pedido– Actualizar pedido (PUT)\n    \n    - **Método**: `PUT`\n        \n    - **URL**: `http://localhost:3000/pedidos/1`\n        \n    - **Descripción**: Actualiza el pedido con ID `1`. Se recomienda parametrizar el ID con una variable.\n        \n5. Eliminar pedido – Eliminar pedido (DELETE)\n    \n    - **Método**: `DELETE`\n        \n    - **URL**: `http://localhost:3000/pedidos/1`\n        \n    - **Descripción**: Elimina el pedido con ID `1`. También se recomienda parametrizar el ID.\n        \n\n---\n\nEjecución con Collection Runner\n\nPuedes ejecutar la colección **PEDIDOS** como un flujo básico usando **Collection Runner**.\n\nPasos básicos:\n\n1. En la barra lateral, selecciona la colección **PEDIDOS**.\n    \n2. Haz clic en **Run** para abrir el Collection Runner.\n    \n3. Selecciona el entorno (por ejemplo, _Pedidos – Local_).\n    \n4. Configura:\n    \n    - **Iterations**: `1` (para una pasada completa)\n        \n    - **Delay**: `0–100 ms` entre requests (opcional)\n        \n5. Haz clic en **Start Run**.\n    \n\nOrden de ejecución por defecto:\n\n1. Leer pedidos\n    \n2. Agregar Pedidos\n    \n3. Actualizar pedido (PUT /pedidos/1)\n    \n4. Eliminar pedido (DELETE /pedidos/1)\n    \n\n---\n\nResolución de problemas\n\n**Conexión rechazada /** **`ECONNREFUSED`** **hacia** **`localhost:3000`**\n\n- Verifica que el servidor backend esté levantado en el puerto `3000`.\n    \n- Prueba abrir `http://localhost:3000/pedidos` en el navegador.\n    \n\n**`404 Not Found`**\n\n- Revisa que la ruta sea correcta (`/pedidos` o `/pedidos/:id`).\n    \n- Asegúrate de que el ID exista en el backend.\n    \n\n**`400 Bad Request`** **o errores de validación en POST/PUT**\n\n- Confirma que el cuerpo de la petición sea JSON válido.\n    \n- Asegúrate de incluir el header `Content-Type: application/json`.","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","isPublicCollection":false,"owner":"51906899","team":13142060,"collectionId":"eaf56457-3b5c-4914-8cfb-355b0ce314bd","publishedId":"2sBXc8pj1d","public":true,"publicUrl":"https://documenter-api.postman.tech/view/51906899/2sBXc8pj1d","privateUrl":"https://go.postman.co/documentation/51906899-eaf56457-3b5c-4914-8cfb-355b0ce314bd","customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"},"documentationLayout":"classic-double-column","customisation":{"metaTags":[{"name":"description","value":""},{"name":"title","value":""}],"appearance":{"default":"light","themes":[{"name":"dark","logo":null,"colors":{"top-bar":"212121","right-sidebar":"303030","highlight":"FF6C37"}},{"name":"light","logo":null,"colors":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"}}]}},"version":"8.10.0","publishDate":"2026-02-07T06:11:44.000Z","activeVersionTag":"latest","documentationTheme":"light","metaTags":{"title":"","description":""},"logos":{"logoLight":null,"logoDark":null}},"statusCode":200},"environments":[],"user":{"authenticated":false,"permissions":{"publish":false}},"run":{"button":{"js":"https://run.pstmn.io/button.js","css":"https://run.pstmn.io/button.css"}},"web":"https://www.getpostman.com/","team":{"logo":"https://res.cloudinary.com/postman/image/upload/t_team_logo_pubdoc/v1/team/be55ba1877c4281c6318b59aefe84e87e817fa6c5870a309416a044a7b63fbd7","favicon":""},"isEnvFetchError":false,"languages":"[{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"HttpClient\"},{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"RestSharp\"},{\"key\":\"curl\",\"label\":\"cURL\",\"variant\":\"cURL\"},{\"key\":\"dart\",\"label\":\"Dart\",\"variant\":\"http\"},{\"key\":\"go\",\"label\":\"Go\",\"variant\":\"Native\"},{\"key\":\"http\",\"label\":\"HTTP\",\"variant\":\"HTTP\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"OkHttp\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"Unirest\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"Fetch\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"jQuery\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"XHR\"},{\"key\":\"c\",\"label\":\"C\",\"variant\":\"libcurl\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Axios\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Native\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Request\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Unirest\"},{\"key\":\"objective-c\",\"label\":\"Objective-C\",\"variant\":\"NSURLSession\"},{\"key\":\"ocaml\",\"label\":\"OCaml\",\"variant\":\"Cohttp\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"cURL\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"Guzzle\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"HTTP_Request2\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"pecl_http\"},{\"key\":\"powershell\",\"label\":\"PowerShell\",\"variant\":\"RestMethod\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"http.client\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"Requests\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"httr\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"RCurl\"},{\"key\":\"ruby\",\"label\":\"Ruby\",\"variant\":\"Net::HTTP\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"Httpie\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"wget\"},{\"key\":\"swift\",\"label\":\"Swift\",\"variant\":\"URLSession\"}]","languageSettings":[{"key":"csharp","label":"C#","variant":"HttpClient"},{"key":"csharp","label":"C#","variant":"RestSharp"},{"key":"curl","label":"cURL","variant":"cURL"},{"key":"dart","label":"Dart","variant":"http"},{"key":"go","label":"Go","variant":"Native"},{"key":"http","label":"HTTP","variant":"HTTP"},{"key":"java","label":"Java","variant":"OkHttp"},{"key":"java","label":"Java","variant":"Unirest"},{"key":"javascript","label":"JavaScript","variant":"Fetch"},{"key":"javascript","label":"JavaScript","variant":"jQuery"},{"key":"javascript","label":"JavaScript","variant":"XHR"},{"key":"c","label":"C","variant":"libcurl"},{"key":"nodejs","label":"NodeJs","variant":"Axios"},{"key":"nodejs","label":"NodeJs","variant":"Native"},{"key":"nodejs","label":"NodeJs","variant":"Request"},{"key":"nodejs","label":"NodeJs","variant":"Unirest"},{"key":"objective-c","label":"Objective-C","variant":"NSURLSession"},{"key":"ocaml","label":"OCaml","variant":"Cohttp"},{"key":"php","label":"PHP","variant":"cURL"},{"key":"php","label":"PHP","variant":"Guzzle"},{"key":"php","label":"PHP","variant":"HTTP_Request2"},{"key":"php","label":"PHP","variant":"pecl_http"},{"key":"powershell","label":"PowerShell","variant":"RestMethod"},{"key":"python","label":"Python","variant":"http.client"},{"key":"python","label":"Python","variant":"Requests"},{"key":"r","label":"R","variant":"httr"},{"key":"r","label":"R","variant":"RCurl"},{"key":"ruby","label":"Ruby","variant":"Net::HTTP"},{"key":"shell","label":"Shell","variant":"Httpie"},{"key":"shell","label":"Shell","variant":"wget"},{"key":"swift","label":"Swift","variant":"URLSession"}],"languageOptions":[{"label":"C# - HttpClient","value":"csharp - HttpClient - C#"},{"label":"C# - RestSharp","value":"csharp - RestSharp - C#"},{"label":"cURL - cURL","value":"curl - cURL - cURL"},{"label":"Dart - http","value":"dart - http - Dart"},{"label":"Go - Native","value":"go - Native - Go"},{"label":"HTTP - HTTP","value":"http - HTTP - HTTP"},{"label":"Java - OkHttp","value":"java - OkHttp - Java"},{"label":"Java - Unirest","value":"java - Unirest - Java"},{"label":"JavaScript - Fetch","value":"javascript - Fetch - JavaScript"},{"label":"JavaScript - jQuery","value":"javascript - jQuery - JavaScript"},{"label":"JavaScript - XHR","value":"javascript - XHR - JavaScript"},{"label":"C - libcurl","value":"c - libcurl - C"},{"label":"NodeJs - Axios","value":"nodejs - Axios - NodeJs"},{"label":"NodeJs - Native","value":"nodejs - Native - NodeJs"},{"label":"NodeJs - Request","value":"nodejs - Request - NodeJs"},{"label":"NodeJs - Unirest","value":"nodejs - Unirest - NodeJs"},{"label":"Objective-C - NSURLSession","value":"objective-c - NSURLSession - Objective-C"},{"label":"OCaml - Cohttp","value":"ocaml - Cohttp - OCaml"},{"label":"PHP - cURL","value":"php - cURL - PHP"},{"label":"PHP - Guzzle","value":"php - Guzzle - PHP"},{"label":"PHP - HTTP_Request2","value":"php - HTTP_Request2 - PHP"},{"label":"PHP - pecl_http","value":"php - pecl_http - PHP"},{"label":"PowerShell - RestMethod","value":"powershell - RestMethod - PowerShell"},{"label":"Python - http.client","value":"python - http.client - Python"},{"label":"Python - Requests","value":"python - Requests - Python"},{"label":"R - httr","value":"r - httr - R"},{"label":"R - RCurl","value":"r - RCurl - R"},{"label":"Ruby - Net::HTTP","value":"ruby - Net::HTTP - Ruby"},{"label":"Shell - Httpie","value":"shell - Httpie - Shell"},{"label":"Shell - wget","value":"shell - wget - Shell"},{"label":"Swift - URLSession","value":"swift - URLSession - Swift"}],"layoutOptions":[{"value":"classic-single-column","label":"Single Column"},{"value":"classic-double-column","label":"Double Column"}],"versionOptions":[],"environmentOptions":[{"value":"0","label":"No Environment"}],"canonicalUrl":"https://documenter.gw.postman.com/view/metadata/2sBXc8pj1d"}