Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Aquí tienes la documentación de la API basada en el archivo JSON proporcionado, estructurada para que sea clara y fácil de seguir.

Dimo Empresa - API Documentation

Base URLs

Authentication

  • API Key: All endpoints require an API key passed in the headers.
    • Header: API-KEY
    • Example Value: BMMyeLpIomvnnGwmN8IOydFCON4AQelKTIY4C44Fljg8AjFled

Endpoints

LocalHost

1. AltaColaborador

  • Endpoint: /colaboradores/alta
  • Method: POST
  • Description: Creates a new collaborator.
  • Headers:
    • API-KEY: BMMyeLpIomvnnGwmN8IOydFCON4AQelKTIY4C44Fljg8AjFled
  • Request Body:
    json

    { "data": { "nroDocumento": 4040440, "nombres": "Arturo", "apellidos": "Sosa Bagnoli", "nroTelefono": "0971159618", "correo": "asosa@cabal.com.py" } }
  • Response: No response example provided.

2. ListarColaborador

  • Endpoint: /colaboradores/listar
  • Method: POST
  • Description: Lists a collaborator by document number.
  • Headers:
    • API-KEY: BMMyeLpIomvnnGwmN8IOydFCON4AQelKTIY4C44Fljg8AjFled
  • Request Body:
    json

    { "nroDocumento": 4040440 }
  • Response: No response example provided.

3. CrearAcreditacion

  • Endpoint: /acreditaciones/crear
  • Method: POST
  • Description: Creates a new accreditation.
  • Headers:
    • API-KEY: BMMyeLpIomvnnGwmN8IOydFCON4AQelKTIY4C44Fljg8AjFled
  • Request Body:
    json

    { "acreditacion": { "usuario": "test1", "descripcion": "prueba 1", "lista": [ { "nroDocumento": 4040440, "monto": 1500000 }, { "nroDocumento": 4040440, "monto": 1200000 }, { "nroDocumento": 404011111, "monto": 1600000 } ] } }
  • Response: No response example provided.

4. EjecutarAcreditacion

  • Endpoint: /acreditaciones/ejecutar
  • Method: POST
  • Description: Executes an accreditation.
  • Headers:
    • API-KEY: BMMyeLpIomvnnGwmN8IOydFCON4AQelKTIY4C44Fljg8AjFled
  • Request Body:
    json

    { "acreditacion": { "usuario": "test1", "idAcreditacion": 274 } }
  • Response: No response example provided.

PreProducción

1. API-KEY - Validar

  • Endpoint: /auth/realms/mdw/check
  • Method: GET
  • Description: Validates an API key.
  • Headers: None required.
  • URL Parameters:
    • apiKey: t7DQWbMzns339c9CA4rt7FBByqhYKd94AVW0MamEuSOfjV9c3A
  • Response: No response example provided.

Error Handling

  • Common HTTP Status Codes:
    • 200 OK: The request was successful.
    • 400 Bad Request: The request could not be understood or was missing required parameters.
    • 401 Unauthorized: Authentication failed or user does not have permissions for the desired action.
    • 404 Not Found: The requested resource could not be found.
    • 500 Internal Server Error: An error occurred on the server.

Example Usage

Here are some example requests using curl:

AltaColaborador

sh

curl -X POST "http://localhost:8080/ApiDimoEmpresaJavaEnvironment/rest/colaboradores/alta" \ -H "API-KEY: BMMyeLpIomvnnGwmN8IOydFCON4AQelKTIY4C44Fljg8AjFled" \ -H "Content-Type: application/json" \ -d '{ "data": { "nroDocumento": 4040440, "nombres": "Arturo", "apellidos": "Sosa Bagnoli", "nroTelefono": "0971159618", "correo": "asosa@cabal.com.py" } }'

ListarColaborador

sh

curl -X POST "http://localhost:8080/ApiDimoEmpresaJavaEnvironment/rest/colaboradores/listar" \ -H "API-KEY: BMMyeLpIomvnnGwmN8IOydFCON4AQelKTIY4C44Fljg8AjFled" \ -H "Content-Type: application/json" \ -d '{ "nroDocumento": 4040440 }'

CrearAcreditacion

sh

curl -X POST "http://localhost:8080/ApiDimoEmpresaJavaEnvironment/rest/acreditaciones/crear" \ -H "API-KEY: BMMyeLpIomvnnGwmN8IOydFCON4AQelKTIY4C44Fljg8AjFled" \ -H "Content-Type: application/json" \ -d '{ "acreditacion": { "usuario": "test1", "descripcion": "prueba 1", "lista": [ { "nroDocumento": 4040440, "monto": 1500000 }, { "nroDocumento": 4040440, "monto": 1200000 }, { "nroDocumento": 404011111, "monto": 1600000 } ] } }'

EjecutarAcreditacion

sh

curl -X POST "http://localhost:8080/ApiDimoEmpresaJavaEnvironment/rest/acreditaciones/ejecutar" \ -H "API-KEY: BMMyeLpIomvnnGwmN8IOydFCON4AQelKTIY4C44Fljg8AjFled" \ -H "Content-Type: application/json" \ -d '{ "acreditacion": { "usuario": "test1", "idAcreditacion": 274 } }'

API-KEY - Validar

sh

curl -X GET "http://10.5.1.31:9087/auth/realms/mdw/check?apiKey=t7DQWbMzns339c9CA4rt7FBByqhYKd94AVW0MamEuSOfjV9c3A"

Este documento proporciona una

descripción clara y concisa de la API de "Dimo Empresa", con ejemplos prácticos para cada uno de los endpoints disponibles. Para cualquier actualización o modificación, asegúrate de mantener esta documentación sincronizada con los cambios en la API.

Si necesitas integrarlo con una plataforma de documentación interactiva como Swagger, Postman o cualquier otra, aquí tienes algunos pasos generales para hacerlo:

Integración con Swagger/OpenAPI

  1. Crear un archivo de especificación OpenAPI: Este archivo (swagger.yaml o swagger.json) contendrá todas las definiciones de tu API.
  2. Generar la documentación: Puedes usar herramientas como Swagger UI para generar una interfaz interactiva.

Ejemplo de Especificación OpenAPI (YAML)

yaml

openapi: 3.0.0 info: title: Dimo Empresa API version: 1.0.0 servers: - url: http://localhost:8080/ApiDimoEmpresaJavaEnvironment/rest paths: /colaboradores/alta: post: summary: Alta de Colaborador requestBody: required: true content: application/json: schema: type: object properties: data: type: object properties: nroDocumento: type: integer example: 4040440 nombres: type: string example: Arturo apellidos: type: string example: Sosa Bagnoli nroTelefono: type: string example: 0971159618 correo: type: string example: asosa@cabal.com.py responses: '200': description: Success /colaboradores/listar: post: summary: Listar Colaborador requestBody: required: true content: application/json: schema: type: object properties: nroDocumento: type: integer example: 4040440 responses: '200': description: Success /acreditaciones/crear: post: summary: Crear Acreditación requestBody: required: true content: application/json: schema: type: object properties: acreditacion: type: object properties: usuario: type: string example: test1 descripcion: type: string example: prueba 1 lista: type: array items: type: object properties: nroDocumento: type: integer example: 4040440 monto: type: integer example: 1500000 responses: '200': description: Success /acreditaciones/ejecutar: post: summary: Ejecutar Acreditación requestBody: required: true content: application/json: schema: type: object properties: acreditacion: type: object properties: usuario: type: string example: test1 idAcreditacion: type: integer example: 274 responses: '200': description: Success

Integración con Postman

  1. Importar el archivo JSON: En Postman, puedes importar el archivo JSON directamente para obtener una colección con todos los endpoints definidos.
  2. Generar documentación: Postman permite generar documentación interactiva y publicarla en línea.

Publicación en GitHub Pages o GitBook

  1. Markdown documentation: Puedes convertir esta documentación en formato Markdown y publicarla en plataformas como GitHub Pages o GitBook para una presentación atractiva y accesible.
markdown

# Dimo Empresa API Documentation ## Base URLs - **LocalHost:** `http://localhost:8080/ApiDimoEmpresaJavaEnvironment/rest` - **PreProducción:** `http://10.5.1.31:9087` ## Authentication - **API Key**: All endpoints require an API key passed in the headers. - **Header:** `API-KEY` - **Example Value:** `BMMyeLpIomvnnGwmN8IOydFCON4AQelKTIY4C44Fljg8AjFled` ## Endpoints ### LocalHost #### AltaColaborador - **Endpoint:** `/colaboradores/alta` - **Method:** `POST` - **Description:** Creates a new collaborator. - **Headers:** - `API-KEY: BMMyeLpIomvnnGwmN8IOydFCON4AQelKTIY4C44Fljg8AjFled` - **Request Body:** ```json { "data": { "nroDocumento": 4040440, "nombres": "Arturo", "apellidos": "Sosa Bagnoli", "nroTelefono": "0971159618", "correo": "asosa@cabal.com.py" } }
  • Response: No response example provided.

ListarColaborador

  • Endpoint: /colaboradores/listar
  • Method: POST
  • Description: Lists a collaborator by document number.
  • Headers:
    • API-KEY: BMMyeLpIomvnnGwmN8IOydFCON4AQelKTIY4C44Fljg8AjFled
  • Request Body:
    json

    { "nroDocumento": 4040440 }
  • Response: No response example provided.

CrearAcreditacion

  • Endpoint: /acreditaciones/crear
  • Method: POST
  • Description: Creates a new accreditation.
  • Headers:
    • API-KEY: BMMyeLpIomvnnGwmN8IOydFCON4AQelKTIY4C44Fljg8AjFled
  • Request Body:
    json

    { "acreditacion": { "usuario": "test1", "descripcion": "prueba 1", "lista": [ { "nroDocumento": 4040440, "monto": 1500000 }, { "nroDocumento": 4040440, "monto": 1200000 }, { "nroDocumento": 404011111, "monto": 1600000 } ] } }
  • Response: No response example provided.

EjecutarAcreditacion

  • Endpoint: /acreditaciones/ejecutar
  • Method: POST
  • Description: Executes an accreditation.
  • Headers:
    • API-KEY: BMMyeLpIomvnnGwmN8IOydFCON4AQelKTIY4C44Fljg8AjFled
  • Request Body:
    json

    { "acreditacion": { "usuario": "test1", "idAcreditacion": 274 } }
  • Response: No response example provided.

PreProducción

API-KEY - Validar

  • Endpoint: /auth/realms/mdw/check
  • Method: GET
  • Description: Validates an API key.
  • Headers: None required.
  • URL Parameters:
    • `apiKey: t7DQWbMzns339c9CA4rt7FBByqhYKd94

AVW0MamEuSOfjV9c3A`

  • Response: No response example provided.

Error Handling

  • Common HTTP Status Codes:
    • 200 OK: The request was successful.
    • 400 Bad Request: The request could not be understood or was missing required parameters.
    • 401 Unauthorized: Authentication failed or user does not have permissions for the desired action.
    • 404 Not Found: The requested resource could not be found.
    • 500 Internal Server Error: An error occurred on the server.

Example Usage

Here are some example requests using curl:

AltaColaborador

sh

curl -X POST "http://localhost:8080/ApiDimoEmpresaJavaEnvironment/rest/colaboradores/alta" \ -H "API-KEY: BMMyeLpIomvnnGwmN8IOydFCON4AQelKTIY4C44Fljg8AjFled" \ -H "Content-Type: application/json" \ -d '{ "data": { "nroDocumento": 4040440, "nombres": "Arturo", "apellidos": "Sosa Bagnoli", "nroTelefono": "0971159618", "correo": "asosa@cabal.com.py" } }'

ListarColaborador

sh

curl -X POST "http://localhost:8080/ApiDimoEmpresaJavaEnvironment/rest/colaboradores/listar" \ -H "API-KEY: BMMyeLpIomvnnGwmN8IOydFCON4AQelKTIY4C44Fljg8AjFled" \ -H "Content-Type: application/json" \ -d '{ "nroDocumento": 4040440 }'

CrearAcreditacion

sh

curl -X POST "http://localhost:8080/ApiDimoEmpresaJavaEnvironment/rest/acreditaciones/crear" \ -H "API-KEY: BMMyeLpIomvnnGwmN8IOydFCON4AQelKTIY4C44Fljg8AjFled" \ -H "Content-Type: application/json" \ -d '{ "acreditacion": { "usuario": "test1", "descripcion": "prueba 1", "lista": [ { "nroDocumento": 4040440, "monto": 1500000 }, { "nroDocumento": 4040440, "monto": 1200000 }, { "nroDocumento": 404011111, "monto": 1600000 } ] } }'

EjecutarAcreditacion

sh

curl -X POST "http://localhost:8080/ApiDimoEmpresaJavaEnvironment/rest/acreditaciones/ejecutar" \ -H "API-KEY: BMMyeLpIomvnnGwmN8IOydFCON4AQelKTIY4C44Fljg8AjFled" \ -H "Content-Type: application/json" \ -d '{ "acreditacion": { "usuario": "test1", "idAcreditacion": 274 } }'

API-KEY - Validar

sh

curl -X GET "http://10.5.1.31:9087/auth/realms/mdw/check?apiKey=t7DQWbMzns339c9CA4rt7FBByqhYKd94AVW0MamEuSOfjV9c3A"



Este documento proporciona una guía completa para la integración y uso de la API de Dimo Empresa. Asegúrate de seguir las mejores prácticas de seguridad y mantener actualizada la documentación para reflejar cualquier cambio en la API.



sh
curl -X GET "http://10.5.1.31:9087/auth/realms/mdw/check?apiKey=t7DQWbMzns339c9CA4rt7FBByqhYKd94AVW0MamEuSOfjV9c3A"





  • No labels