Skip to main content
POST
/
task
Create task
curl --request POST \
  --url https://apiweb.mile.app/api/v3/task \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "flow": "Visit",
  "hubId": "634e98498ce07d29474a7e29",
  "field1": "Jack Ward",
  "field2": "Gambir Jakarta",
  "field3": "-6.230815251,106.75684387",
  "startTime": "2022-11-02T07:28:23+00:00",
  "endTime": "2022-11-05T07:28:23+00:00"
}
'
{
  "status": true,
  "message": "Task has been created",
  "task": {
    "_id": "6352736c628401059b37a2e2",
    "flow": "Visit",
    "hubId": "634e98498ce07d29474a7e29",
    "startTime": "2022-11-02T07:28:23+00:00",
    "organizationId": "634e98098ce07d29474a7e22",
    "status": "UNASSIGNED",
    "hub": {
      "_id": "634e98498ce07d29474a7e29",
      "name": "Jakarta",
      "lat": -6.205154152722965,
      "lng": 106.84667067970608
    },
    "orderIndex": 10,
    "field1": "Jack Ward",
    "field2": "Gambir Jakarta",
    "field3": "-6.230815251,106.75684387",
    "createdFrom": "API",
    "endTime": "2022-11-05T07:28:23+00:00",
    "createdBy": "Roger",
    "updatedTime": "2022-11-01T07:28:23+00:00",
    "createdTime": "2022-11-01T07:28:23+00:00"
  }
}

Authorizations

Authorization
string
header
required

Use a valid Bearer token to authenticate.

Body

application/json

The API payloads for creating a task may difference from other API payloads, as tasks are parts of a flow, thus their attributes dynamically adjust to the respective task's flow. There are 2 easy ways to easily create a payload task:

          ### Generate payload from API
          
          1. Send request endpoint [ GET /flow/{flowName}/task ](#tag/Flow/operation/getCreateTaskPayload) 

          2. Copy the response from section `bodyRequest` 


          ### Generate payload from UI 

          1. Visit https://web.mile.app/flow/flow 

          2. Select Flow. 

          3. Open **Configuration** tab. 

          4. Click **API Example**. 

          5. Finnaly, there will be a complete description to create a task according to chosen flow.

          6. Also its able to click **Copy Curl** for copy the generated request body based on the selected flow that can be used for create task.

          

 

          
          
          
flow
string
required

The unique name of organization's flow. Use GET /flows API to get the list of flow names. Example: Visit

hubId
string
required

Fundamental entity within an organization, serving as the central point for managing various operational components. Use GET /hubs endpoint to get the list of Hub IDs. Example: 634e98498ce07d29474a7e29

field1
string

This field's type & value is according to Flow's setting. Use GET /flow/{flowName}/task API to get example of payload. Example: Jack Ward

field2
string

This field's type & value is according to Flow's setting. Use GET /flow/{flowName}/task API to get example of payload. Example: Gambir Jakarta

field3
string

This field's type & value is according to Flow's setting. Use GET /flow/{flowName}/task API to get example of payload. Example: -6.230815251,106.75684387

startTime
string<date-time>

Start time refers to the designated time for users to begin a task. If startTime is not provided, it will default to the configured time in the flow. You can view the datetime format here. Example: 2022-11-02T07:28:23+00:00

endTime
string<date-time>

End time is the deadline for completing a task. If endTime is not specified, it will default to the configured time in the flow.The task cannot be completed if the date has passed the endtime. You can view the datetime format here Example: 2022-11-05T07:28:23+00:00

assignee
object[]

You can assign tasks using user email according to their task hub. To assign tasks to multiple users, use a comma (',') as a separator. Example: ['leandro@mile.app']

Response

Success

status
boolean

Status of response.

message
string

Message of API response.

task
object

Detail of object task.