Add a file to a tool/equipment.
toolid | number | The ID of the tool to add the file to. |
filename | string | The name of the file, eg. “MyDocument.PDF” |
filedata | binary | A binary stream. |
title | string | A file title (not a file name) |
folder | string | The path of the folder, eg. "FilesFromAPI/Diagrams" |
Add a photo file to a tool/equipment.
toolid | number | The ID of the tool 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 |
document | document | A document object |
Get all tools carried by the current user
tools | collection[tool] | Collection of all carried tools, or an empty collection if no tools are carried. |
Get all tool types.
types | collection[ tooltype ] | Collection of tooltype objects |
classes | set | List of classes, the key is the class ID, the value is the class name |
Get all tool states.
types | collection [ toolstate ] | Collection of states, each state is a set with id , title , color and access |
If access
is 0 then the user is not allowed to select the state, but the state may still be displayed whenever a tool/equipment has the state.
Attach a tool to a company.
If the specified customerid is 0 then the tool will be detached.
toolid | number | The ID of a tool |
customerid | number | The ID of a customer |
Attach a tool to a todo.
If the specified todoid is 0 then the tool will be detached.
toolid | number | The ID of a tool |
todoid | number | The ID of a todo |
Creates or updates a tool in Microbizz.
If a tool with the given tool id already exists, then the tool will be overwritten.
If the tool provided has a tool id of 0, a new tool will be created and a new tool id will be provided.
tool | tool | The tool to create/update |
attachto | object | An object with objecttype and objectid |
noactivate | boolean | Set to 1 to prevent the tool from being assigned to current user and activated |
If attachto
is specified then the tool will be attached to the object; the only objecttype that is supported is 'todo'.
tool | tool | The tool object as it is in Microbizz after the update |
Get a collection of tools changed since a given date and time.
changedate | date | Return all tools on or after the provided date. |
changetime | time | If this is provided only return tools 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 sent tools that current user do not have access to |
placeofhome | number | If 1 then only get tools which have a “place of home”, if 2 then only get tools which do not have a “place of home” |
skip_deleted | bool | If 1 then don't send deleted tools |
tools | collection[ tool ] | A collection of the relevant tools, or an empty collection if no tools 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. |
customerids | collection[number] | List of Microbizz ID of customers which have tools which the app should download in order to ensure that the tools are available in case the app is offline, see GetToolsByField |
Get a collection of tools that are attached to a task.
todoid | number | Return all tools that are attached to the task with this ID. |
knowntools | collection[tooldate] | List of known tools and their change dates |
tools | collection[tool] | A collection of the relevant tools, or an empty collection if no tools were found. |
Each tooldate object should contain the following fields:
toolid | number | The Microbizz ID of a tool |
changedate | date | The changedate field from the tool |
changetime | time | The changetime field from the tool |
Microbizz may use this information to avoid sending tools that have not changed.
Get a collection of tools where a given field matches a value.
field | string | Return tools where this field has the value specified in value . |
value | string | Return tools where the field specified in field has this value. |
knowntools | collection[tooldate] | List of known tools and their change dates, see GetToolsByTodoID |
resumekey | string |
|
inclpic | boolean | 1 to include the tool picture in the reply |
tools | collection[ tool ] | A collection of the relevant tools, or an empty collection if no tools 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. |
Get a tool by their Microbizz tool id, This also includes services connected to the tools.
If no such tool exist an empty collection will be returned.
toolid | number | The microbizz tool id of the tool to fetch |
inclpic | boolean | 1 to include the tool picture in the reply |
tools | collection[tool] | A collection either empty if no tool was found, or with exactly one element being the tool. |
picture | binary | The tool picture as a base64 encoded string, only if inclpic was set when called |
Get all tools near the given coordinate
longitude | float | GPS longitude |
latitude | float | GPS latitude |
tools | collection[tool] | Collection of all nearby tools (if any). |
Pick up the tool with the given ID. This command will always succeed, but the return variable indicates if the tool was actually picked up.
toolid | number | ID of the tool, to be picked up. |
longitude | float | GPS longitude where the tool was picked up |
latitude | float | GPS latitude where the tool was picked up |
waspickedup | boolean | Indicates if the tool was picked up. |
tool | tool | If the tool was picked up, the tool object is provided in this field. |
message | string | Additional message to display regarding the pickup. |
Sets down the tool with the given ID. This command will always succeed, but the return variable indicates if the tool was actually set down.
toolid | number | ID of the tool, to be set down. |
answer | answer | If a question form is requested on set down, the answer can be provided here. |
longitude | float | GPS longitude where the tool is set down |
latitude | float | GPS latitude where the tool is set down |
wassetdown | boolean | Indicates if the tool was set down. |
Uses the tool with the given ID.
toolid | number | ID of the tool, to be used. |
longitude | float | GPS longitude where the tool was used |
latitude | float | GPS latitude where the tool was used |
date | date | Date of usage |
time | time | Time of usage |
Installs the tool with the given ID at the current location.
toolid | number | ID of the tool, to be used. |
longitude | float | GPS longitude where the tool was installed |
latitude | float | GPS latitude where the tool was installed |
date | date | Date of usage |
time | time | Time of usage |
This reports a equipment service/inspection.
toolid | number | ID of the tool which was serviced |
answers | set | The answers from each of the question forms that were filled in, the key is the ID of the question form; the answers must appear in the same order as specified by the tool service protocol |
date | date | Date of the service |
time | time | Time of the service |
protocolid | number | The ID of the service protocol that was executed; strictly speaking it is not required but you should always specify it, if not specified then MB will assume it was the first protocol in the list |
todos | set | A list of task IDs; the task ID is the value, the question form ID is the key |
iscomplete | bool | 1 if this is service is complete; 0 if this is a call to save for later; default is 1 |
The answers
set has the question form ID as name (or key) and a formanswer as value.
If the field iscomplete
is set to 0 then the service protocol is considered incomplete. This mean that the last answer in the answers
set is incomplete; the answers before that are considered complete. F.eks. if the protocol specifies that the question forms with IDs 111, 222, 333 and 444 should be filled in (in that order), then an incomplete service protocol may only include answers for 111 and 222, and the answer for 222 will be considered incomplete.
This reads details about the service protocol that is in progress / has been saved for later.
service | set | Details about the service protocol that is in progress, if any |
If no service is in progress / has been saved for later then service
is an empty set. Otherwise service
holds the following fields:
userid | number | The ID of the user who saved the service for later |
date | date | When the service was saved for later |
time | time | When the service was saved for later |
protocolid | number | The ID of the tool service protocol that is in progress, see GetToolServiceProtocols below |
answerids | set | The IDs of the question answers that have been filled in so far, the key is the ID of the question form, use GetAnswer to read the actual answers |
openqfid | number | The ID of the question form that the user was in the process of filling in when save for later was chosen; the question answers before this are considered complete |
Get the list of available tool service/inspection protocols.
multiple | bool | Indicates that the app understands having multiple service protocols, only old, outdated apps do not set this to 1 |
asarray | bool | Indicates that the result should be send as a collection, instead of as a set |
inspections | bool | Indicates that the app wants both the service protocols and the inspection protocols |
protocols | set | List of service protocols |
The list in protocols
uses the equipment type ID as key.
If multiple
isn't set then each item in the list is a collection of question form IDs.
If multiple
is set then each item in the list is a set of serviceprotocol objects. If asarray
is set then the list if a collection, an each serviceprotocol object includes a groupid
field indicating the ID of the tool type.