### API Pagination Example Source: https://docs.api.pedidook.com.br/ Utilize the 'alterado_apos' parameter in GET requests for better performance and the 'href_proxima_pagina' field for efficient pagination. If 'href_proxima_pagina' is null, there are no more records. ```http https://api.pedidook.com.br/v1/clientes/?alterado_apos=2019-04-22T08:00:00&pagina=2 ``` -------------------------------- ### Request Limits Source: https://docs.api.pedidook.com.br/ Understand the daily request limits imposed by the PedidoOK API to ensure efficient integration. ```APIDOC ## Request Limits **Requests are limited to 20,000 (twenty thousand) daily requests per token_pedidook** This limit includes all requests (GET, POST, PUT, PATCH, or DELETE). An well-implemented integration should only send records that have undergone changes since its last integration with PedidoOK. ``` -------------------------------- ### Partial Record Update with PATCH Source: https://docs.api.pedidook.com.br/ The PATCH method allows for partial updates to records, meaning you can modify specific fields without affecting others. This is useful for scenarios like updating only the stock of a product. ```APIDOC ## PATCH ### Description Allows for partial updates to records by modifying only specified fields. ### Method PATCH ### Endpoint [Specify endpoint here, e.g., /resource/{id}] ### Request Body Example ```json { "estoque": 20 } ``` ### Notes - Use PATCH for partial updates (e.g., changing only `estoque`). - Use PUT for total updates (all fields). Fields omitted in PUT will be zeroed out. ``` -------------------------------- ### Partial Update with PATCH API Source: https://docs.api.pedidook.com.br/ Use this JSON structure with the PATCH method to update only specific fields of a record, such as the 'estoque' (stock) of a product. This is more flexible than the PUT method, which updates all fields. ```json {"estoque": 20} ``` -------------------------------- ### Authentication Headers Source: https://docs.api.pedidook.com.br/ All requests to the PedidoOK API must include the following headers for authentication and content type specification. ```APIDOC ## Authentication The authentication is done through 2 tokens (`token_parceiro` and `token_pedidook`) that should be sent in the header of HTTP requests. The request headers should have the fields and values below: > `token_parceiro` - {obtained in the first step} > `token_pedidook` - {obtained in the PC platform} > `Content-Type` - application/json **All requests must be made over HTTPS.** ``` -------------------------------- ### Using id_parceiro for Idempotency Source: https://docs.api.pedidook.com.br/ The `id_parceiro` field is a unique identifier for your ERP records and is crucial for handling API request failures safely, preventing duplicate entries. ```APIDOC ## id_parceiro We provide in the entities a field called `id_parceiro` of type String(36), exclusively for partner use, in which you should store a value that uniquely identifies the record within your ERP (e.g., id, code, uuid, etc). ### id_parceiro in POST Consider the following situation: Your ERP tries to insert a new ORDER into PedidoOK via the API using the POST method, but does not receive a response from the API, only a timeout. In this situation, the question arises: Did the timeout occur during the request sending to the server or during the response reception? Was the ORDER inserted or not? Can I resend the ORDER without the risk of duplication? If you have already used APIs in integrations with other systems, you have probably had to deal with this situation. **The main benefit of `id_parceiro` is the ability to handle failures safely and simply.** PedidoOK guarantees the uniqueness of the `id_parceiro` field within the same entity for each partner, meaning, in case of a POST failure, you can safely repeat the POST request (**with the same id_parceiro**) without the risk of duplication. (if the record was inserted in the first request, PedidoOK returns the error: '24-An record with the informed id_parceiro already exists'). If you want to understand the subject better, see non-idempotent HTTP methods ### id_parceiro in GET The `id_parceiro` can be used as a filter parameter in search APIs. ### id_parceiro in PUT/PATCH The `id_parceiro` can be freely changed (preserving uniqueness) through requests to APIs with PUT or PATCH methods. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.