Skip to main content
Skip table of contents

Tools commands

AddFileToTool

Add a file to a tool/equipment.

Input

toolidnumberThe ID of the tool to add the file to.
filenamestringThe name of the file, eg. “MyDocument.PDF”
filedatabinaryA binary stream. base64_encode(Required)
titlestringA file title (not a file name)
folderstringThe path of the folder, eg. "FilesFromAPI/Diagrams"

Output

None--

AddPhotoToTool

Add a photo file to a tool/equipment.

Input

toolidnumberThe ID of the tool to add the photo to.
titlestringA file title (not a file name)
imagedatabinaryA binary stream containing photo data in jpeg format.
onxnetboolean1 if the file should be visible on the extranet
createdatedateWhen the photo was taken
createtimetimeWhen the photo was taken
tagscollection [number]An optional collection of tags to attach to this image (tag IDs)
documentidnumberOptional ID of an existing file, to update the file instead of creating a new file

Output

documentdocumentA document object

GetMyTools

Get all tools carried by the current user

Input

none--

Output

toolscollection[tool]Collection of all carried tools, or an empty collection if no tools are carried.


GetToolTypes

Get all tool types.

Input

none--

Output

typescollection[ tooltype ]Collection of tooltype objects
classessetList of classes, the key is the class ID, the value is the class name


GetToolStates

Get all tool states.

Input

none--

Output

typescollection [ 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.


ToolAttachToCustomer

Attach a tool to a company.

If the specified customerid is 0 then the tool will be detached.

Input

toolidnumberThe ID of a tool
customeridnumberThe ID of a customer

Output

none


ToolAttachToTodo

Attach a tool to a todo.

If the specified todoid is 0 then the tool will be detached.

Input

toolidnumberThe ID of a tool
todoidnumberThe ID of a todo

Output

none


CreateUpdateTool

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.

Input

tooltoolThe tool to create/update
attachtoobjectAn object with objecttype and objectid
noactivatebooleanSet 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'.

Output

tooltoolThe tool object as it is in Microbizz after the update


GetToolsByLastChange

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

Input

changedatedateReturn all tools on or after the provided date.
changetimetimeIf this is provided only return tools changed after the provided date and time.
resumekeystringIf a partial result is returned, provide the resumekey received along with the partial result, to get the rest of the entries
ignoreclosedboolIf 1 then don't sent tools that current user do not have access to
placeofhomenumberIf 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_deletedboolIf 1 then don't send deleted tools

Output

toolscollection[ tool ]A collection of the relevant tools, or an empty collection if no tools were found.
resumekeystringSometimes 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.
customeridscollection[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


GetToolsByTodoID

Get a collection of tools that are attached to a task.

Input

todoidnumberReturn all tools that are attached to the task with this ID.
knowntoolscollection[tooldate]List of known tools and their change dates

Output

toolscollection[tool]A collection of the relevant tools, or an empty collection if no tools were found.

Each tooldate object should contain the following fields:

toolidnumberThe Microbizz ID of a tool
changedatedateThe changedate field from the tool
changetimetimeThe changetime field from the tool

Microbizz may use this information to avoid sending tools that have not changed.

GetToolsByField

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

Input

fieldstringReturn tools where this field has the value specified in value.
valuestringReturn tools where the field specified in field has this value.
knowntoolscollection[tooldate]List of known tools and their change dates, see GetToolsByTodoID
resumekeystring
inclpicboolean1 to include the tool picture in the reply

Output

toolscollection[ tool ]A collection of the relevant tools, or an empty collection if no tools were found.
resumekeystringSometimes 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.

GetToolByID

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.

Input

toolidnumberThe microbizz tool id of the tool to fetch
inclpicboolean1 to include the tool picture in the reply

Output

toolscollection[tool]A collection either empty if no tool was found, or with exactly one element being the tool.
picturebinaryThe tool picture as a base64 encoded string, only if inclpic was set when called

GetNearbyTools

Get all tools near the given coordinate

Input

longitudefloatGPS longitude
latitudefloatGPS latitude

Output

toolscollection[tool]Collection of all nearby tools (if any).

PickupTool

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.

Input

toolidnumberID of the tool, to be picked up.
longitudefloatGPS longitude where the tool was picked up
latitudefloatGPS latitude where the tool was picked up

Output

waspickedupbooleanIndicates if the tool was picked up.
tooltoolIf the tool was picked up, the tool object is provided in this field.
messagestringAdditional message to display regarding the pickup.

SetDownTool

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.

Input

toolidnumberID of the tool, to be set down.
answeranswerIf a question form is requested on set down, the answer can be provided here.
longitudefloatGPS longitude where the tool is set down
latitudefloatGPS latitude where the tool is set down

Output

wassetdownbooleanIndicates if the tool was set down.

UseTool

Uses the tool with the given ID.

Input

toolidnumberID of the tool, to be used.
longitudefloatGPS longitude where the tool was used
latitudefloatGPS latitude where the tool was used
datedateDate of usage
timetimeTime of usage

Output

None--


InstallTool

Installs the tool with the given ID at the current location.

Input

toolidnumberID of the tool, to be used.
longitudefloatGPS longitude where the tool was installed
latitudefloatGPS latitude where the tool was installed
datedateDate of usage
timetimeTime of usage

Output

None--

ToolServiceProtocol

This reports a equipment service/inspection.

Input

toolidnumberID of the tool which was serviced
answerssetThe 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
datedateDate of the service
timetimeTime of the service
protocolidnumberThe 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
todossetA list of task IDs; the task ID is the value, the question form ID is the key
iscompletebool1 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.

Output

None--

Incomplete service

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.

GetToolService

This reads details about the service protocol that is in progress / has been saved for later.

Input

toolidnumberID of a tool

Output

servicesetDetails 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:

useridnumberThe ID of the user who saved the service for later
datedateWhen the service was saved for later
timetimeWhen the service was saved for later
protocolidnumberThe ID of the tool service protocol that is in progress, see GetToolServiceProtocols below
answeridssetThe 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
openqfidnumberThe 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


GetToolServiceProtocols

Get the list of available tool service/inspection protocols.

Input

multipleboolIndicates that the app understands having multiple service protocols, only old, outdated apps do not set this to 1
asarrayboolIndicates that the result should be send as a collection, instead of as a set
inspectionsboolIndicates that the app wants both the service protocols and the inspection protocols

Output

protocolssetList 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.


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.