Home
Generalidades Collapse menú
    Creación de órdenes

    Se describe la operación relacionada para la creación de órdenes de trabajo.

    Detalles de la petición:

    • URI: api/workorders

    • Tipo: POST

    • Encabezados requeridos:

      • Content-Type: application/json
      • X-Authorization: Bearer {Token}

    Parámetros:

    Nombre Tipo de dato Obligatorio Descripción
    addressContact string Si Dirección de contacto
    addressContactInfo string No Información dirección de contacto
    assignmentType integer No Tipo de Asignación
    clientId integer Si Id del Cliente
    companyId integer No Id de la Compañia
    contactEmail string No Email de contacto
    contactLatitude number - double Si Latitud de direccion contacto
    contactLongitude number - double Si Longitud de dirección de contacto
    contactName string Si Nombre de Contacto
    contactPhone string No Teléfono de contacto
    creatorId integer No Id de Usuario creador de la Orden de trabajo
    description string Si Descipción de la orden de trabajo
    endAddress string No Dirección final
    endAddressInfo string No Información de la dirección final
    endLatitude number - double No Latitud de dirección final
    endLongitude number - double No Longitud de dirección final
    id integer No Id de la WorkOrder
    priority integer Si Tipo de prioridad: 0 - Normal, 1 - Emergencia, 2 - Prioridad
    providerId integer No Id del Proveedor
    serviceId integer Si Servicio asociado a la orden
    specialistId integer No Id del especialista que atiende
    state integer Si Estado de la Orden - Solo Valor: 1
    subject string Si Subject o titulo de la orden
    subStateId integer No Sub estado
    ticketId string No Ticket de la orden
    attentionEndDate string - datetime No Fecha final de atención
    attentionStartDate string - datetime No Fecha de inicio de atención
    tentativeAttentionEndDate string - datetime No Fecha tentativa de finalización de atención
    tentativeAttentionStartDate string - datetime No Fecha de atención Tentativa
    tentativeTravelStartDate string - datetime No Fecha de inicio de viaje
    travelStartDate string - datetime No Fecha de inicio de viaje
    additionalFields array No Lista campos adicionales
    attachments array No Lista adjuntos
    products array No Lista productos para el servicio
    workTasks array No Lista tareas de la orden de trabajo

    Cuerpo de la petición:

    La petición consiste de un objeto JSON. Ejemplo:

    {
        "addressContact": "Calle 39B, Teusaquillo, 11311 Teusaquillo, Distrito Capital, Colombia",
        "addressContactInfo": "",
        "clientId": 24,
        "companyId": null,
        "contactEmail": "tati@pruebas.com",
        "contactLatitude": 4.629124230469785,
        "contactLongitude": -74.0730822280432,
        "contactName": "Cración de Ordenes con campos adicionales",
        "contactPhone": null,
        "description": "Cración de Ordenes con campos adicionales API WORKORDER",
        "endAddress": "",
        "endAddressInfo": "",
        "endLatitude": 0,
        "endLongitude": 0,
        "id": 0,
        "priority": 0,
        "serviceId": 36,
        "state": 1,
        "subject": "Cración de Ordenes con campos adicionales",
        "subStateId": 1,
        "attentionEndDate": "",
        "attentionStartDate": "",
        "tentativeAttentionEndDate": "",
        "tentativeAttentionStartDate": "",
        "tentativeTravelStartDate": "",
        "travelStartDate": "",
        "additionalFields": [
            {
                "id": 24,
                "value": "3"
            },
            {
                "id": 24,
                "value": "Esta son unas pruebas para campo adicional tipo parrafo"
            }
        ],
        "products": [
            {
                "cost": 0,
                "description": "",
                "id": 0,
                "isActive": true,
                "name": "",
                "productId": 4,
                "quantity": 1,
                "sku": "",
                "typeProduct": 0
            }
        ],
        "workTasks": null
    }
    

    Respuesta:

    Como respuesta se obtiene un objeto JSON, con la siguiente información:

     {
        "addressContact": "Floresta Outlet, Carrera 69, Santa Rosa, 11121 Suba, Distrito Capital, Colombia",
        "addressContactInfo": "Piso 7",
        "assignmentType": 0,
        "clientId": 213,
        "companyId": null,
        "contactEmail": "tati@pruebas.com",
        "contactLatitude": 4.6919158,
        "contactLongitude": -74.0745394,
        "contactName": "PRUEBAS CREACIÓN DE ORDENES DESDE LA API DE WORKORDERS",
        "contactPhone": "30122222222",
        "creatorId": 3,
        "description": "PRUEBAS CREACIÓN DE ORDENES DESDE LA API DE WORKORDERS",
        "endAddress": null,
        "endAddressInfo": "",
        "endLatitude": 0.0,
        "endLongitude": 0.0,
        "id": 87,
        "priority": 1,
        "providerId": 2,
        "serviceId": 1,
        "specialistId": 11,
        "state": 1,
        "subject": "Pruebas de Creación de orden de Emergencia",
        "subStateId": 10,
        "ticketId": "87",
        "attentionEndDate": null,
        "attentionStartDate": null,
        "tentativeAttentionEndDate": "2024-03-20T01:12:27.079+00:00",
        "tentativeAttentionStartDate": "2024-03-19T22:12:27.079+00:00",
        "tentativeTravelStartDate": "2024-03-19T22:12:27.079+00:00",
        "travelStartDate": null,
        "additionalFields": [
            {
                "actions": null,
                "definitionId": 1,
                "description": null,
                "formatValidator": null,
                "helpMessage": "Campo orden simple",
                "id": 4,
                "itemId": 0,
                "keepHistory": false,
                "label": "Campo orden simple",
                "name": "ca-campo orden simple-1",
                "options": null,
                "order": 1,
                "permissions": [
                    {
                        "statusId": 7,
                        "name": "General",
                        "roles": [
                            {
                                "actions": {
                                    "edit": true,
                                    "required": false,
                                    "view": true
                                },
                                "id": 276,
                                "name": "AFLS_Dispatcher"
                            },
                            {
                                "actions": {
                                    "edit": true,
                                    "required": false,
                                    "view": true
                                },
                                "id": 278,
                                "name": "AFLS_Monitor"
                            }
                        ]
                    }
                ],
                "state": null,
                "status": true,
                "typeId": 1,
                "value": null
            }
        ],
        "attachments": [
            {
                "createDate": "2024-03-19T22:24:37.607+00:00",
                "description": null,
                "fileExtension": "pdf",
                "filePath": null,
                "fileSize": "182848",
                "id": 6,
                "realFileName": "PRUEBA",
                "serveFileName": null
            }
        ],
        "products": [
            {
                "cost": 10000.00,
                "description": "Cable",
                "id": 11,
                "isActive": true,
                "name": "Cable",
                "productId": 1,
                "quantity": 2,
                "sku": "001",
                "typeProduct": 0
            }
        ],
        "workTasks": null
    }
    

    Mensajes de error:

    Código Estado HTTP Mensaje de error
    400 BadRequest ServiceId not related to clientId
    400 BadRequest ProductId x not found.
    400 BadRequest AdditionalField x not found.
    400 BadRequest ClientId is not valid.
    400 BadRequest Client x is inactive
    400 BadRequest Standard Service does not require EndAddress, EndLatitude or EndLongitude.
    400 BadRequest Service x is inactive.
    400 BadRequest AssignmentType not found.
    400 BadRequest SpecialistId not found.
    400 BadRequest WorkOrder State is not valid.
    400 BadRequest EndAddress, EndLatitude and EndLongitude are required.
    400 BadRequest AddressContact, ContactLatitude and ContactLongitude are required.
    401 Unauthorized Authorization has been denied for this request.
    500 Internal Server Error FailureLogin