Document toolboxDocument toolbox

Todo commands

CreateUpdateTodo

Creates or updates a todo in Microbizz.

If a todo with the given todo id already exists, then the todo will be overwritten.

If the todo provided has a todo id of 0, a new todo will be created and a new todo id will be provided.

If a toolid is provided then the tool will be attached to the todo.

Input

todo

todo

The todo to create/update

toolid

number

The ID of a tool to attach to the todo

changenote

bool

If a change note should be posted and a mail be sent etc; default is 1

Output

todo

todo

The todo object as it is in Microbizz after the update

CreateUpdateTodoByTodoNumber

Creates or updates a todo in Microbizz. The todo is identified by the number field in the todo.

If a todo with the given todo number already exists, then the todo will be overwritten, otherwise a new todo will be created and assigned the supplied todo number. Currently no test is made as to the validity of the todo number.

If a toolid is provided then the tool will be attached to the todo.

Input

todo

todo

The todo to create/update

toolid

number

The ID of a tool to attach to the todo

changenote

bool

If a change note should be posted and a mail be sent etc; default is 1

Output

todo

todo

The todo object as it is in Microbizz after the update

CloseTodoByID

Closes a todo by todo ID

The todo is only closed if close conditions are fullfilled. The command will not fail, if the todo isn't closed, but the returned object will reflect that the todo is still open

Input

todoid

number

The ID of the todo which should be closed

stateid

number

The state to which this todo should be closed to. (Obtained by GetTodoStates). Only close states is allowed here.

answer

answer

If a question form is requested on todo close, then the answers can be provided here.

note

note

A note, only the text field will be used, will be tagged with 'Solution'

Output

todo

todo

The todo object as it is in Microbizz after the update

GetTodosByLastChange

Get a collection of todos changed since a given date and time.

Input

changedate

date

Return all todo's changed on or after the provided date.

changetime

time

If this is provided only return todo's changed after the provided date and time.

resumekey

string

If a partial result is returned, provide the resumekey received along with the partial result, to get the rest of the entries

ignoreclosed

bool

If 1 then don't send todo's that current user do not have access to

onlyprojects

number

If 0 then projects are excluded if the "Hide projects in app and API" setting in MIcrobizz is enabled (this is default)

If 1 then only read projects, ignore the "Hide projects in app and API" setting

If 2 then projects are included even if the "Hide projects in app and API" setting is enabled

If 3 then projects are excluded

limitnumobjects

bool

If 1 then Microbizz will only send todo's that it thinks are particularly relevant for the user

skip_deleted

bool

If 1 then don't send deleted tasks

Output

todos

collection[todo]

A collection of the relevant todos, or an empty collection if no todosNiko was found.

resumekey

string

Sometimes the entire result cannot be returned because it's to large. In that case a resumekey is returned along with the results. Execute the command again with this resumekey to get the remaining results.

Notice that the result may be affected by the setting "Send closed tasks to the app this many days after closing". Also, if the remote agent is the Microbizz App 3 then the setting may be in a different way.

GetTodosByCustomerID

Get a collection of todos changed since a given date and time.

Input

customerid

int

finds all using this customerid

customerid

int

finds all using this customerid

ignoreclosed

bool

If 1 then don't send todo's that current user do not have access to

Output

todos

collection[todo]

A collection of the relevant todos, or an empty collection if no todos was found.

GetTodosByEAN

Get a collection of todos changed since a given date and time.

Input

EAN

int

finds all using this EAN

EAN

int

finds all using this EAN

ignoreclosed

bool

If 1 then don't send todo's that current user do not have access to

Output

todos

collection[todo]

A collection of the relevant todos, or an empty collection if no todosNiko was found.

GetTodosByRequisition

Get a collection of todos changed since a given date and time.

Input

requisition

string

finds all using this requisition

requisition

string

finds all using this requisition

ignoreclosed

bool

If 1 then don't send todo's that current user do not have access to

Output

todos

collection[todo]

A collection of the relevant todos, or an empty collection if no todosNiko was found.

GetTodoByID

Get a todo by their Microbizz todo id

If no such todo exist an empty collection will be returned.

Input

todoid

number

The microbizz todo id of the todo to fetch

Output

todos

collection[todo]

A collection either empty if no todo was found, or with exactly one element being the todo.

GetTodosByIDs

Get several todos at the same time by a set of Microbizz todo ids

Input

todoids

collection[number]

A collection of microbizz todo ids of the todos to fetch

Output

todos

collection[todo]

A collection either empty if no todos was found, or with all the found todos (in no particular order)

GetTodoByTodoNumber

Get a todo by their todo number.

If no such todo exist an empty collection will be returned.

If several todos exists with the provided todo number, only one of these (unpredicted) is returned.

Input

todonumber

string

The todo number of the customer to fetch

Output

todos

collection[ todo ]

A collection either empty if no todo was found, or with exactly one element being the todo.

GetTodosByFilterID

Get all todos which have a specific filter.

Input

filterid

number

The Microbizz ID of the filter

Output

todos

collection[ todo ]

 

GetTodoLogByID

Get the log for a todo by the ID and date.

If no such todo exist an empty collection will be returned.

If some todo exist in the log with the provided ID and date, will be returned log data.

Input

todoid

integer

The todo number of the customer to fetch

date

string

The date

logtype

string

Which log to read, either db (default) or activity

Output

result

collection[set]

A list of log lines, the contents of each set depends on the logtype parameter

Logtype = db

head

string

Log head information. Contains date, time, log level and user ID

text

string

Log text information

logname

string

Used log name

date

string

Log date

time

string

Log time

level

string

The level of the log

uid

integer

User ID

object

string

Log object data

 

Logtype = activity

userid

number

The Microbizz ID of the user who genereated this log line

customerid

number

The MB ID of a customer which may be relevant

unitid

number

The MB ID of a unit which may be relevant

projectid

number

The MB ID of a project which may be relevant

modcode

string

A code for which module generated this log line

date

date

When the log line was generated

time

time

 

text

string

The log line, may be HTML

link

string

An optional link to some page in MB which is relevant

 

GetTodosByPersonID

Get all todos which have a specific contact person.

Input

personid

number

The Microbizz ID of the contact person

Output

todos

collection[ todo ]

 

AddPhotoToTodo

Add a photo file to a todo.

Input

todoid

number

The ID of the todo to add the photo to.

title

string

A file title (not a file name)

imagedata

binary

A binary stream containing photo data in jpeg format.

onxnet

boolean

1 if the file should be visible on the extranet

createdate

date

When the photo was taken

createtime

time

When the photo was taken

tags

collection [number]

An optional collection of tags to attach to this image (tag IDs)

documentid

number

Optional ID of an existing file, to update the file instead of creating a new file

folder

string

The path of the folder, eg. "FilesFromAPI/Diagrams"

Output

document

document

A document object

 

AddFileToTodo

Add a file to a task.

Input

todoid

number

The ID of the task to add the file to.

filename

string

The name of the file, eg. “MyDocument.PDF”

filedata

binary

A binary stream. base64_encode(Required)

title

string

A file title (not a file name)

folder

string

The path of the folder, eg. "FilesFromAPI/Diagrams"

Output

None

-

-

AddAudioToTodo

Add an audio file to a todo.

Input

todoid

number

The ID of the todo to add the audio to.

title

string

A file title (not a file name)

format

string

One of: mp3 wav aac

audiodata

binary

A binary stream containing audio data in the specified format.

Output

None.

-

-

GetTodoTemplates

Get a list of all todo templates.

Input

None.

-

-

Output

templates

collection [ todotemplate ]

The available templates

GetTodoStates

Get a list of all todo states.

Input

None.

-

-

Output

states

collection [ todostate ]

The available states

CreateTodoFromTemplate

Create a todo based on a given template.

If a toolid is provided then the tool will be attached to the todo.

If tdesc or tdeschtml is set. it will overwrite the template. If none. the template description will be the description.

Input

templateid

number

The id of the template (which can be obtained by GetTodoTemplates)

title

string

A base title for the created todo

customerid

number

An id of a customer on which to attach the todo. (In some configurations this is required)

toolid

number

The ID of a tool to attach to the todo

tdesc

string

description overwritten.

tdeschtml

html

description in html format.

subtemplates

set

IDs of the subtemplates that should be used, default is all

Output

todo

todo

The primary todo created from the template. (A template can contain more than one todo)

GetDocumentsByTodoID

Get all documents on a todo by todo id

Input

todoid

number

The Microbizz todo ID

inclthumbs

bool

True to include thumbnails

inclfolders

bool

True to include folders

Output

documents

collection [ document ]

The documents present on the todo

folders

collection [ folder ]

The folders present on the todo

Product use

GetProductUseByLastChange

Get a collection of all product use since the given date.

Input

changedate

date

Return all product use on or after the provided date.

changetime

time

If this is provided only return product use changed after the provided date and time.

resumekey

string

If a partial result is returned, provide the resumekey received along with the partial result, to get the rest of the entries

include_price

bool

1 if prices should be included anyway even it set not to.

Output

productuse

collection[ todoitem ]

A collection of the relevant product use, or an empty collection if no products were used.

resumekey

string

Sometimes the entire result cannot be returned because it's to large. In that case a resumekey is returned along with the results. Execute the command again with this resumekey to get the remaining results.

GetProductUseByTodoID

Get a collection of all product use on the given todo.

Input

todoid

number

ID of todo to receive product use

include_price

bool

1 if prices should be included anyway even it set not to.

Output

productuse

collection[ todoitem ]

A collection of the relevant product use, or an empty collection if no products were used on this todo.

GetProductUseByToolID

Get a collection of all product use on the given tool.

Input

toolid

number

ID of tool to receive product use

spareparts

boolean

1 to get spareparts only, 0 to get non-spareparts only

include_price

bool

1 if prices should be included anyway even it set not to.

Output

productuse

collection[ todoitem ]

A collection of the relevant product use, or an empty collection if no products were used with this tool.

DeleteProductUseByID

Delete some product use by product use ID. The command will succeed even if the product use doesn't exist.

Notice that product use may either be deleted or offset. If the user is allowed to delete, then it is deleted, otherwise if the user is allowed to offset then the product use is  offset, otherwise you get an error.

Input

productuseid

number

ID of the product use to remove

Output

None

-

-

AddProductUse

Deprecated: Consider using CreateUpdateProductUse

Add product use to the todo specified by the given todo ID.

Input

productuse

todoitem

The product use. Even though the id field must be provided, it is ignored.

todoid

number

ID of todo to receive product use

nopricecalc

boolean

Set to 1 to disable price calculation (eg. when copying product use)

copyid

number

Optional ID of the prod.use that was copied, used for copying some details

Output

None

-

-

AddProductUseFromEDI

Add product use to a task. Discounts and profit calculations will be made on the product use and therefore override this information on the provided object.

Input

productuse

todoitem

The product use. Even though the id field must be provided, it is ignored.

Output

None

-

-

AddPartsList

Add product use to the todo specified by the given todo ID. Most of the details will be taken from the parts list setup.

Input

productuse

collection[ partuse ]

Details about the product used for each part in the parts list.

todoid

number

ID of todo to receive product use

useddate

date

The date of use

usedtime

time

The time of use

Output

None

-

-

CreateUpdateProductUse

Creates or updates some product use in Microbizz.

If some product use with the given productuse id already exists, then the product use will be overwritten.

If the product use provided have a productuse id of 0, new product use will be created and a new productuse id will be provided.

Input

productuse

todoitem

The product use to create/update

nopricecalc

boolean

Set to 1 to disable price calculation (eg. when copying product use). If this is set and a costprice is provided on the product use; that costprice will always be used.

copyid

number

Optional ID of the prod.use that was copied, used for copying some details

Output

productuse

todoitem

The product use object as it is in Microbizz after the update

GetProductUsePendingInvoicing

Get all product use pending invoicing.

Input

include_price

bool

1 if prices should be included anyway even it set not to.

Output

productuse

collection[ todoitem ]

A collection of all product use pending invoicing.

MarkProductUseAsInvoiced

Mark the selected product use as invoiced.

Input

productuseids

collection[number]

A collection of all product use ids to mark as invoiced.

Output

None

-

-

Planning

GetPlanDestinations

Get all destinations for use when planning a todo

Input

None

-

-

Output

destinations

collection[ plandestination ]

A collection of all destinations which can be used.

myself

number

The destination that is the user himself

GetPlannedTodos

Get list of tasks that are planned for the current user.

Input

None

-

-

Output

todos

collection[number]

List of IDs of the tasks that are planned for the user.

PlanTodo

Plan a todo to a specific destination.

Input

todoid

number

ID of the todo to plan.

date

date

Date to plan to.

time

time

Time to plan to.

destination

string

The destination to plan to, see Todo commands#GetPlanDestinations ; may be an array of string, to plan to multiple users/teams.

duration

number

Number of minutes to plan; must be 0 if enddate is set.

enddate

date

If set then there will be planned for all the dates between 'date' and 'enddate'.

endtime

time

Only used if enddate is set, in which case it is required.

nonworkingdays

bool

If true then also plan on non-working days.

fullday

boolean

1 to create full day planning or 0 to create normal planning; duration+enddate+endtime+time are ignored for full day plannings

Output

prodplanids

collection[number]

The Microbizz IDs of all the plannings that were created

destination consist of a letter (either u for user or t for team) followed by a number (the ID of the user/team). Eg. u29 or t3. When planning to a team, the team of the todo will be changed to the specified team, and the planning will be made anonymous.

GetWorkpoolsByLastChange

Get info about the workpools.

Input

changedate

date

 

changetime

time

 

skip_deleted

bool

If 1 then don't send deleted workpools

Output

disabled

bool

If workpools are disabled, default is false

workpools

collection[ workpool ]

A collection of workpools

Each set in workpools contains information about a workpool. The API call will always return all the workpools, but the content (list of tasks) of a workpool will only be included in if the workpool or its contents has changed since changedate.

AddRemoveWorkpoolEntry

Add a Todo to a workpool, or remove a Todo from a workpool.

Input

workpoolentryid

number

ID of a workpool entry in Microbizz

todoid

number

ID of a Todo in Microbizz

workpoolid

number

ID of a workpool in Microbizz

Output

wastaken

bool

True if the Todo was removed from the workpool

workpoolentry

workpoolentry

Only if the Todo was added to a workpool

If workpoolentryid is specified, then the Todo will be removed from the pool, and the responsible user will be set to the current user.

If workpoolentryid isn't specified, but workpoolid and todoid both are, then the Todo will be added to the workpool.

Budget

GetBudgetByTodoID

Read the current budget for a todo.

Input

todoid

number

ID of a Todo in Microbizz

include_historical

bool

If 1 then include historical data in the historical field

Output

budget

set

Current budget posts, indexed by the ID of the budget posts

budgetpostnames

set

The names of the budget posts, indexed by the ID of the budget posts

anchorbudget

set

The current anchor budget posts, indexed by the ID of the budget posts

Only if anchor budgets are enabled

historical

collection[budgetpost]

Only included if include_historical is set to 1; the historical data includes all budgets, including the current

historical_anchorbudget

collection[budgetpost]

Only included if include_historical is set to 1; the historical data includes all anchor budgets, including the current

GetBudgetByLastChange

Read the recent changes to the budgets for all todos.

Input

changedate

date

Return all budgets changed on or after the provided date.

changetime

time

If this is provided only return budgets changed after the provided date and time.

resumekey

string

If a partial result is returned, provide the resumekey received along with the partial result, to get the rest of the entries

Output

budgets

collection[budgetpost]

Budget posts

budgetpostnames

set

The names of the budget posts, indexed by the ID of the budget areas

UpdateBudgetByTodoID

Lets the user update the budget for a task.

Input

todoid

number

ID of a Todo in Microbizz

values

set

The new budget values; indexed by the budget area IDs

Output

budgetpostnames

set

Budget posts names indexed by budget area IDs.

newbudget

set

Current budget of the task, indexed by budget area IDs.

GetAnchorBudgetByLastChange

Read the recent changes to the anchor budgets for all todos. Requires that anchor budgets are enabled.

Input

changedate

date

Return all budgets changed on or after the provided date.

changetime

time

If this is provided only return budgets changed after the provided date and time.

resumekey

string

If a partial result is returned, provide the resumekey received along with the partial result, to get the rest of the entries

Output

anchorbudgets

collection[anchorbudget]

Anchor budget posts

budgetpostnames

set

The names of the budget posts, indexed by the ID of the budget posts

 

UpdateAnchorBudgetByTodoID

Lets the user update the anchor budget for a specific task. Requires that anchor budgets are enabled.

Input

todoid

number

ID of a Todo in Microbizz

values

set

The new anchor budget values, indexed by the ID of the budget area

Output

budgetpostnames

set

Budget posts names indexed by budget area ID.

newanchorbudget

set

Current anchor budget of the task, indexed by the budget area ID.

GetStageInvoicingByLastChange

Read the recent changes to the invoice stages for all todos.

Input

changedate

date

Return all budgets changed on or after the provided date.

changetime

time

If this is provided only return budgets changed after the provided date and time.

resumekey

string

If a partial result is returned, provide the resumekey received along with the partial result, to get the rest of the entries

Output

stages

collection[invoicestage]

Invoice stages

 

State history

GetTodoStateHistoryByID

Get the history of task state changes for a task

Input

todoid

number

Microbizz ID of a task, return all state changes for that task.

Output

statehistory

collection[todostatehist]

State changes

GetTodoStateHistoryByLastChange

Get the recent task state changes.

Input

changedate

date

Return all state changes on or after the provided date.

changetime

time

If this is provided only return state changes after the provided date and time.

resumekey

string

If a partial result is returned, provide the resumekey received along with the partial result, to get the rest of the entries

Output

statehistory

collection[todostatehist]

State changes

Repeat

GetRepeatsByLastChange

Get recent changes to repetitions, for todos of the type "repeat, exact".

Input

changedate

date

Return all repeat changes on or after the provided date.

changetime

time

If this is provided only return repeat changes after the provided date and time.

resumekey

string

If a partial result is returned, provide the resumekey received along with the partial result, to get the rest of the entries

Output

repeats

collection[repeat]

Repeat changes

GetRepeatsByTodoID

Get all repetitions for a todo, for todos of the type "repeat, exact".

Input

todoid

number

Return all repeats for this todo

Output

repeats

collection[repeat]

All repeats for the todo

 

 

GetWGRepeatsByLastChange

Get recent changes to repetitions, for todos of the type "repeat, loose".

Input

changedate

date

Return all repeat changes on or after the provided date.

changetime

time

If this is provided only return repeat changes after the provided date and time.

resumekey

string

If a partial result is returned, provide the resumekey received along with the partial result, to get the rest of the entries

 

Output

repeats

collection[wgrepeat]

Repeat changes

GetWGRepeatsByTodoID

Get all repetitions for a todo, for todos of the type "repeat, loose".

Input

todoid

number

Return all repeats for this todo

Output

repeats

collection[wgrepeat]

All repeats for the todo

GetRepeatExceptionsByTodoID

Get periods where the todo should not be planned by repetitions.

Input

todoid

number

Return all repeat exception periods for this todo

Output

repeatexceptionss

collection[repeatexception]

All repeat exceptions periods for the todo

Each repeatexception holds the following fields: id, startdate, enddate.

GetTodosByField

Get a collection of todos where a given field matches a value.

Input

field

string

Return todos where this field has the value specified in value.

Following output is possible by examples:

 

custom150

This will return a custom field with the ID 150

 

qref200

This will return a Microbizz field with the ID 200

value

string

Return todos where the field specified in field has this value.

resumekey

string

 

include_closed

boolean

1 if closed tasks should be included.

Output

todos

collection[ todo ]

A collection of the relevant todos, or an empty collection if no todos were found.

resumekey

string

Sometimes the entire result cannot be returned because it's to large. In that case a resumekey is returned along with the results. Execute the command again with this resumekey to get the remaining results.

 

AddTodoToProject

Move a task to a project; this requires the new Project module. Only works if the task isn't already attached to a project.

Input

todoid

number

The Microbizz ID of a task

projectid

number

The Microbizz ID of a project

Output

-

-

-

RemoveTodoFromProject

Remove a task from a project; this requires the new Project module. Only works if the task is already attached to the project.

Input

todoid

number

The Microbizz ID of a task

projectid

number

The Microbizz ID of a project

Output

-

-

-

 

GetProductUseStatusHistoryByLastChange

Create a line for a quotation, or update an existing line.

Input

changedate

date

Return all productusestatushistories's changed on or after the provided date.

changetime

time

If this is provided only return productusestatushistories's changed after the provided date and time.

resumekey

string

If a partial result is returned, provide the resumekey received along with the partial result, to get the rest of the entries

Output

state_history

array

The array of the product use's state history.

 

GetProductUseStatusHistoryByTodoID

Create a line for a quotation, or update an existing line.

Input

todoid

number

 

Output

state_history

array

The array of the product uses state histories.

GetProductUseStatusHistoryByProductUse

Create a line for a quotation, or update an existing line.

Input

product_use_id

number

 

Output

state_history

array

The array of the product use's state history.