Back to top

Fulfillment API

Bienvenido al API de Fulfillment, aquí encontrarás toda la información relacionada a los endpoints disponibles.

Authentication

Cuando la interacción con la API se la realiza Server To Server (Máquina a Máquina) se debe utilizar un oAuth2 con acceso por Credenciales de Cliente. Para obtener las credenciales en mención usted puede ponerse en contacto con el equipo de desarrollo.

El endpoint que genera el token como tal, se lo detalla en la sección OAuth2 Token.

Headers

Asegúrese de tener los siguientes encabezados en cada solicitud:

Content-Type: application/json
Authorization: Bearer TOKEN

Errors

La API utiliza códigos de respuesta HTTP convencionales para indicar el éxito o el fracaso de una petición. La tabla a continuación contiene un resumen de los códigos de respuesta típicos::

Code Description
200 Everything is ok.
400 Valid data was given but the request has failed.
401 No valid API Key was given.
404 The request resource could not be found.
405 The method is not implemented
422 The payload has missing required parameters or invalid data was given.
429 Too many attempts.
500 Request failed due to an internal error.
503 API is offline for maintenance.

OAuth2 Token

Obtener token de acceso

Obtener token de acceso
POST/oauth/token

Este endpoint permite obtener el token de acceso para clientes OAuth2

Example URI

POST https://fulfillment.v2.desarrollo-redbrand.com/oauth/token
Request
HideShow
Headers
Content-Type: x-www-form-urlencoded
Body
{
  "grant_type": "client_credentials",
  "client_id": 1,
  "client_secret": "ghVW0PVbKRRBCo8uRt..."
}
Schema
{
  "type": "object",
  "properties": {
    "grant_type": {
      "type": "string"
    },
    "client_id": {
      "type": "number"
    },
    "client_secret": {
      "type": "string"
    }
  },
  "required": [
    "grant_type",
    "client_id",
    "client_secret"
  ],
  "$schema": "http://json-schema.org/draft-04/schema#"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "token_type": "Bearer",
  "expires_in": 31536000,
  "access_token": "yJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6Ij..."
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "token_type": {
      "type": "string"
    },
    "expires_in": {
      "type": "number"
    },
    "access_token": {
      "type": "string"
    }
  },
  "required": [
    "token_type",
    "expires_in",
    "access_token"
  ]
}

API de Órdenes

Órdenes

Actualizar Estado de una Orden
PUT/api/issues/status/{client_issue_id}

Este endpoint permite actualizar el estado de las órdenes de KFC

Example URI

PUT https://fulfillment.v2.desarrollo-redbrand.com/api/issues/status/1404
URI Parameters
HideShow
client_issue_id
string (required) Example: 1404
Request
HideShow
Headers
Content-Type: application/json
Authorization: Bearer Oauth2Token
Body
{
  "status": "Por asignar"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "status": {
      "type": "string"
    }
  },
  "required": [
    "status"
  ]
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "code": 200,
  "status": "success",
  "message": "OK",
  "data": {
    "id": 1,
    "client_issue_id": "1040",
    "workflow_id": 1,
    "parent_issue_id": "null",
    "step_id": 5,
    "step": {
      "id": 5,
      "name": "Por Asignar",
      "value": "TO_BE_ASSIGNED",
      "description": "description",
      "category": "IN_PROGRESS",
      "name_frontend": "Por asignar",
      "description_frontend": "Estamos buscando un repartidor para ti.",
      "color": "#EBA859",
      "transitions": [
        {
          "id": 5,
          "name": "Asignar pedido",
          "description": "La orden ha sido asignada y se encuentra en ruta",
          "from_step_id": 5,
          "to_step_id": 6
        },
        {
          "id": 10,
          "name": "Cancelar por asignar",
          "description": "La orden ha sido cancelada cuando pedido estaba por asignar",
          "from_step_id": 5,
          "to_step_id": 8
        }
      ]
    },
    "webhook_url": "http://status.ecommerce.test/api",
    "children": [
      {
        "id": 2,
        "client_issue_id": "1040",
        "workflow_id": 1,
        "parent_issue_id": 1,
        "step_id": 5,
        "step": {
          "id": 5,
          "name": "Por Asignar",
          "value": "TO_BE_ASSIGNED",
          "description": "description",
          "category": "IN_PROGRESS",
          "name_frontend": "Por asignar",
          "description_frontend": "Estamos buscando un repartidor para ti.",
          "color": "#EBA859",
          "transitions": [
            {
              "id": 5,
              "name": "Asignar pedido",
              "description": "La orden ha sido asignada y se encuentra en ruta",
              "from_step_id": 5,
              "to_step_id": 6
            },
            {
              "id": 10,
              "name": "Cancelar por asignar",
              "description": "La orden ha sido cancelada cuando pedido estaba por asignar",
              "from_step_id": 5,
              "to_step_id": 8
            }
          ]
        },
        "webhook_url": "http://status.ecommerce.test/api",
        "children": []
      }
    ]
  },
  "warning": "null",
  "error": "null"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "code": {
      "type": "number"
    },
    "status": {
      "type": "string"
    },
    "message": {
      "type": "string"
    },
    "data": {
      "type": "object",
      "properties": {
        "id": {
          "type": "number"
        },
        "client_issue_id": {
          "type": "string"
        },
        "workflow_id": {
          "type": "number"
        },
        "parent_issue_id": {
          "type": "string"
        },
        "step_id": {
          "type": "number"
        },
        "step": {
          "type": "object",
          "properties": {
            "id": {
              "type": "number"
            },
            "name": {
              "type": "string"
            },
            "value": {
              "type": "string"
            },
            "description": {
              "type": "string"
            },
            "category": {
              "type": "string"
            },
            "name_frontend": {
              "type": "string"
            },
            "description_frontend": {
              "type": "string"
            },
            "color": {
              "type": "string"
            },
            "transitions": {
              "type": "array"
            }
          }
        },
        "webhook_url": {
          "type": "string"
        },
        "children": {
          "type": "array"
        }
      }
    },
    "warning": {
      "type": "string"
    },
    "error": {
      "type": "string"
    }
  }
}
Response  422
HideShow
Headers
Content-Type: application/json
Body
{
  "code": 422,
  "status": "error",
  "message": "Error de Validacion",
  "warning": {
    "code": "null",
    "field": "field_name",
    "value": "Error Description"
  },
  "error": []
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "code": {
      "type": "number"
    },
    "status": {
      "type": "string"
    },
    "message": {
      "type": "string"
    },
    "warning": {
      "type": "object",
      "properties": {
        "code": {
          "type": [
            "string",
            "null"
          ]
        },
        "field": {
          "type": "string"
        },
        "value": {
          "type": "string"
        }
      }
    },
    "error": {}
  }
}
Response  401
HideShow
Headers
Content-Type: application/json
Body
{
  "code": 401,
  "status": "error",
  "message": "Unauthenticated",
  "warning": [],
  "error": []
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "code": {
      "type": "number"
    },
    "status": {
      "type": "string"
    },
    "message": {
      "type": "string"
    },
    "warning": {},
    "error": {}
  }
}
Response  403
HideShow
Headers
Content-Type: application/json
Body
{
  "code": 403,
  "status": "error",
  "message": "Forbidden",
  "warning": [],
  "error": []
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "code": {
      "type": "number"
    },
    "status": {
      "type": "string"
    },
    "message": {
      "type": "string"
    },
    "warning": {},
    "error": {}
  }
}
Response  404
HideShow
Headers
Content-Type: application/json
Body
{
  "code": 404,
  "status": "error",
  "message": "404 Not Found",
  "warning": [],
  "error": []
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "code": {
      "type": "number"
    },
    "status": {
      "type": "string"
    },
    "message": {
      "type": "string"
    },
    "warning": {},
    "error": {}
  }
}

Generated by aglio on 06 Jul 2018