Skip to main content

Assignment

Assignments are planned work, either autogenerated based on Agreements or manually created. Assignments are kept even after work has completed and then functions as a history of the work that has been executed, by whom, when etc.

If the organization is connected to a financial system then Previsto will do bookkeeping in the financial system for the assignments.

The assignment object

Example Response

{
"id" : "asgmt-klJ23j4L23j43",
"createdDate" : "2017-05-21T20:22:28.110Z",
"meta" : { },
"contactId" : "cont-242342DgHH2lkjkj23",
"payingContactId" : "cont-242342DgHH2lkjkj23",
"accountId" : "acct-dfEfdv3342FD",
"action" : "None",
"remoteOrderId" : null,
"location" : [ 10.5286863, 56.8039035 ],
"status" : "None",
"plan": {
"executionTime" : "2017-05-31T08:05",
"indicativeDate" : "2017-05-29",
"accountIds" : [],
"indicativeDateType" : "Optimal",
},
"tasks" : [ {
"agreementId" : "agrmt-DOKwO3VLJ6Sy3YxnlWop",
"description" : "Pudsning2",
"amount" : 20000,
"duration" : 16,
"workType" : "WindowCleaning"
} ]
}
FieldTypeRequiredDescription
idstringNo-
createdDatedateNoDate of creation.
contactIdstringYesId of the contact related to this assignment.
payingContactIdstringNoId of the contact paying for this assignment.
accountIdstringYesId of the account that reflects the worker that is scheduled to execute the assignment.
actionstringNoAction taken on the assignment. None, Skippedor Completed.
remoteOrderIdstringNoId of the order created in the financial system.
locationnumber[]YesArray of 2 numbers holding longitude and latitude in specified order according to geojson syntax. (Fx. [11.543540954589844, 56.703469017862034])
statusstringNoFinancial status of this assignment. None, AppendedToOrder, Invoiced or Fulfilled.
planassignment_planNoPlanning details for the assignment.
taskstask[]NoArray of task elements in this assignments.

The assignment_plan object

FieldTypeRequiredDescription
executionTimedateYesThe planned time for executing this assignment.
indicativeDatedateNoDate for guiding planning of executionTime.
indicativeDateTypestringNoFixed for planning executionTime exact date of indicativeDate or Optimal for flexible planning that allows optimizing routes by planning executionTime some day within the same week as indicativeDate.
accountIdsstring[]NoIds of accounts reflecting the workers that should handle this assignment. Empty list allows all accounts.

The task object

FieldTypeRequiredDescription
referencestringNoReference for this task, fx the id of the agreement that is the base of this task.
descriptionstringNoDescription of the work.
unitPricenumberNoThe amount to charge in 1⁄100 of the monetary unit (fx. cents or øre) without VAT.
durationnumberNoThe duration in minutes of the work. Minimum 3 minutes.
workTypestringNoThe type of work. Currently only 'WindowCleaning'.

{% swagger baseUrl="https://api.previsto.io/assignments" path="/" method="post" summary="Create an Assignment" %} {% swagger-description %} Creates a new assignment. Takes the assignment object in the body. {% endswagger-description %}

{% swagger-parameter in="body" name="" type="object" %} Assignment object. {% endswagger-parameter %}

{% swagger-response status="200" description="" %}

{
"id" : "asgmt-klJ23j4L23j43",
"createdDate" : "2017-05-21T20:22:28.110Z",
"meta" : { },
"contactId" : "cont-242342DgHH2lkjkj23",
"payingContactId" : "cont-242342DgHH2lkjkj23",
"accountId" : "acct-dfEfdv3342FD",
"action" : "None",
"plan": {
"executionTime" : "2017-05-31T08:05",
"indicativeDate" : "2017-05-29",
"accountIds" : [],
"indicativeDateType" : "Optimal",
},
"remoteOrderId" : null,
"location" : [ 10.5286863, 56.8039035 ],
"status" : "None",
"tasks" : [ ]
}

{% endswagger-response %} {% endswagger %}

{% swagger baseUrl="https://api.previsto.io/assignments" path="/:id" method="get" summary="Read an Assignment" %} {% swagger-description %} Retrieves a specific assignment by id. {% endswagger-description %}

{% swagger-parameter in="path" name="id" type="string" %} The id of the assignment to retrieve. {% endswagger-parameter %}

{% swagger-response status="200" description="" %}


{
"id" : "asgmt-klJ23j4L23j43",
"createdDate" : "2017-05-21T20:22:28.110Z",
"meta" : { },
"contactId" : "cont-242342DgHH2lkjkj23",
"payingContactId" : "cont-242342DgHH2lkjkj23",
"accountId" : "acct-dfEfdv3342FD",
"action" : "None",
"plan": {
"executionTime" : "2017-05-31T08:05",
"indicativeDate" : "2017-05-29",
"accountIds" : [],
"indicativeDateType" : "Optimal",
},
"remoteOrderId" : null,
"location" : [ 10.5286863, 56.8039035 ],
"status" : "None",
"tasks" : [ ]
}

{% endswagger-response %} {% endswagger %}

{% swagger baseUrl="https://api.previsto.io/assignments" path="/:id" method="put" summary="Update an Assignment" %} {% swagger-description %} Updates a specific assignment. Any parameters not provided will be left unchanged. {% endswagger-description %}

{% swagger-parameter in="path" name="id" type="string" %} The id of the assignment to update. {% endswagger-parameter %}

{% swagger-parameter in="body" name="." type="object" %} Assignment object. {% endswagger-parameter %}

{% swagger-response status="200" description="" %}

{
"id" : "asgmt-klJ23j4L23j43",
"createdDate" : "2017-05-21T20:22:28.110Z",
"meta" : { },
"contactId" : "cont-242342DgHH2lkjkj23",
"payingContactId" : "cont-242342DgHH2lkjkj23",
"accountId" : "acct-dfEfdv3342FD",
"action" : "None",
"plan": {
"executionTime" : "2017-05-31T08:05",
"indicativeDate" : "2017-05-29",
"accountIds" : [],
"indicativeDateType" : "Optimal",
},
"remoteOrderId" : null,
"location" : [ 10.5286863, 56.8039035 ],
"status" : "None",
"tasks" : [ {
"agreementId" : "agrmt-DOKwO3VLJ6Sy3YxnlWop",
"description" : "Pudsning2",
"amount" : 20000,
"duration" : 16,
"workType" : "WindowCleaning"
} ]
}

{% endswagger-response %} {% endswagger %}

{% swagger baseUrl="https://api.previsto.io/assignments" path="/:id" method="delete" summary="Delete an Assignment" %} {% swagger-description %} Deletes a specific assignment specified by id. {% endswagger-description %}

{% swagger-parameter in="path" name="id" type="string" %} Id of assignment to delete. {% endswagger-parameter %}

{% swagger-response status="200" description="" %}


{% endswagger-response %} {% endswagger %}

{% swagger baseUrl="https://api.previsto.io/assignments" path="/" method="get" summary="List all assignments" %} {% swagger-description %} Retrieves an array of assignment objects. {% endswagger-description %}

{% swagger-parameter in="path" name="page" type="number" %} A zero-based cursor for use in pagination.Page is a number that defines your place in the list. {% endswagger-parameter %}

{% swagger-parameter in="path" name="size" type="number" %} A limit on the number of objects to return. Size can range between 1 and 100. Default is 20. {% endswagger-parameter %}

{% swagger-response status="200" description="" %}

[
{
"id" : "asgmt-klJ23j4L23j43",
"createdDate" : "2017-05-21T20:22:28.110Z",
"meta" : { },
"contactId" : "cont-242342DgHH2lkjkj23",
"payingContactId" : "cont-242342DgHH2lkjkj23",
"accountId" : "acct-dfEfdv3342FD",
"action" : "None",
"remoteOrderId" : null,
"timestamp" : "2017-05-31T08:05",
"location" : [ 10.5286863, 56.8039035 ],
"status" : "None",
"planningDate" : "2017-05-29",
"planningAccountIds" : [],
"planningDateType" : "Optimal",
"tasks" : [ {
"agreementId" : "agrmt-DOKwO3VLJ6Sy3YxnlWop",
"description" : "Pudsning2",
"amount" : 20000,
"duration" : 16,
"workType" : "WindowCleaning"
} ]
},
{ },
{ },
"... And then as many results as available or requested"

]

{% endswagger-response %} {% endswagger %}