Miss commands (part 2: Search, Stock, Files, Mail & More)
Search
SearchProvider
Search Microbizz for customers, person, todo, tool, product
Input
|
search |
string |
The search term |
|
objecttypes |
collection[string] |
Which objects to search, you may call this field "modcodes" instead, see below for a list of possible objecttypes |
|
reference |
mixed |
See below |
|
textsearch |
bool |
Set to 0 to return just the IDs of the matching objects, set to 1 to return also a string that describes the object (typically the object name) |
Output
|
objects |
set |
The keys are the object types, the values are sets of the matching results |
Object types
|
objecttype |
fields that will be matched |
meaning of the field "reference" |
|
person |
firstname, lastname, address, address2, zip, city, country, phone, email |
Either:
|
|
customers customer |
name, customernumber, vat, publicid, address, address2, zip, city, country, id, phone, email A fuzzy search is also performed, so that if the search term looks like the name then it is considered a match |
|
|
todo |
name, number, address, address2, requisition |
|
|
product |
title |
|
|
tool |
name, make, model, serialnumber If company matches the search term then any equipment that belongs to the company will also match |
|
Stock
GetStocks
Get all Microbizz stocks. All stocks are returned, and replaces earlier stocks.
Input
|
None |
- |
- |
Output
|
stocks |
collection[ stock ] |
A collection of all stocks in the Microbizz system. |
CreateStock
Create a new stock and optionally attach it to an object
Input
|
stock |
stock |
The stock to create. (Id is ignored) |
Output
|
stock |
stock |
The stock that was created |
DeleteStock
Deletes a stock and remove assignment from it, from every user that was assigned.
Input
|
stockid |
number |
ID of the stock to delete. |
Output
|
None |
- |
- |
AssignStockToUser
Assigns a stock to a user as the users default stock. If no stockid is provided any default stock is removed from the user instead.
Input
|
userid |
number |
ID of the user to assign / deassign. |
|
stockid |
number |
ID of the stock to assign or empty to deassign. |
Output
|
None |
- |
- |
Depots
AddDepotOrder
Add a depot order based on a depot inventory.
Input
|
customerid |
number |
The ID of the company for which the depot inventory was done |
|
order |
collection[doline] |
The actual depot inventory |
|
orderdate |
date |
When the depot inventory was done |
|
ordertime |
time |
When the depot inventory was done |
Output
|
None |
- |
- |
Each line in order is a set containing the fields depotitemid and ordercount.
See also CreateUpdateDepotOrderLine.
This command may cause the depot order line to be exported.
CreateUpdateDepotOrderLine
Create a new depot order line, or update an existing.
Input
|
line |
Complex types#depotorderline |
|
Output
|
line |
depotorderline |
|
See also AddDepotOrder.
GetDepotsByLastChange
Get the depots that have changed recently.
Input
|
changedate |
date |
- |
|
changetime |
time |
- |
Output
|
depots |
collection[depot] |
A list of the depots that have changed |
Files
UpdateDocument
Update the data for a file.
Input
|
documentid |
number |
The internal Microbizz ID of a file/document |
|
filedata |
string |
Base64 encoded binary data |
|
title |
string |
New title of the file |
|
filename |
string |
New name of the file, notice that the extension (eg. .jpg) must be the same as the existing file |
|
version |
int |
version 2 or above has admin features. like setting filename with no limitations |
Output
|
document |
document |
A document object |
GetFoldersByLastChange
Get a list of all folders that have been changed since a given date
Input
|
changedate |
date |
|
|
changetime |
time |
|
|
version |
number |
If set to 2 then the result will include the object names |
Output
|
folders |
collection[folder] |
|
GetDocumentsByModcodeAndID
Get all documents for a modcode+ID.
Input
|
modcode |
string |
A modcode |
|
objectid |
number |
An object ID (ie. the sysref ID when calling GetFoldersByLastChange) |
|
inclthumbs |
bool |
True to include thumbnails |
|
inclfolders |
bool |
True to include folders |
Output
|
documents |
collection [ document ] |
The documents present on the object |
|
folders |
collection [folder] |
The folders present on the object |
GetImageTags
Get all Microbizz image tags. All tags are returned and replaces earlier tags.
Input
|
None |
- |
- |
Output
|
imagetags |
collection[imagetag] |
A collection of all image tags in the Microbizz system. |
GetDocumentByID
Get a specific document providing a document ID
Input
|
documentid |
number |
The id of the document |
Output
|
document |
document |
The document object |
|
data |
binary |
The binary data of the document itself |
GetDocumentsInfoByLastChange
Get documents that have changed since a given date.
Input
|
changedate |
date |
The change date |
|
changetime |
time |
The change time |
|
version |
number |
This should be 2, version 1 most likely crashes |
|
resumekey |
string |
|
Output
|
docs |
collection[document] |
The documents |
|
resumekey |
string |
|
GetPersonalDocuments
Get all personal documents of the current user
Input
|
inclfolders |
bool |
True to include folders |
Output
|
documents |
collection [document] |
The personal documents |
|
folders |
collection [folder] |
The folders in the personal documents area |
AddFileToPersonalDocuments
Add a file to the personal documents for the user.
Input
|
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" |
|
userid |
number |
The users of id of the user who should receive the file. Default is the logged in user. |
Output
|
None |
- |
- |
AddPhotoToPersonalDocuments
Add a photo file to the personal documents for the user.
Input
|
title |
string |
A file title (not a file name) |
|
imagedata |
binary |
A binary stream containing photo data in jpeg format. base64_encode(Required) |
|
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 |
Output
|
document |
document |
A document object |
AddPhotoToCustomer
Add a photo file to a specified customer.
Input
|
title |
string |
A file title (not a file name) |
|
imagedata |
binary |
A binary stream containing photo data in jpeg format. |
|
customerid |
number |
reference to the customer. |
|
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 |
number |
Optional ID of a folder, the image should be placed in. |
|
onxnet |
boolean |
if image is public for extranet. |
|
longitude |
float |
Optional geolocation longitude of the phone at upload. |
|
latitude |
float |
Optional geolocation latitude of the phone at upload. |
|
comment |
string |
Optional comment on the image. |
|
category |
number |
Optional Reference to existing image's file category. |
|
subcategory |
number |
Optional Reference to existing image's file subcategory. |
Output
|
document |
document |
A document object |
AddPhotoToTodo
Add a photo file to a specified Task.
Input
|
title |
string |
A file title (not a file name) |
|
imagedata |
binary |
A binary stream containing photo data in jpeg format. |
|
todoid |
number |
reference to the task. |
|
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 |
number |
Optional ID of a folder, the image should be placed in. |
|
onxnet |
boolean |
if image is public for extranet. |
|
longitude |
float |
Optional geolocation longitude of the phone at upload. |
|
latitude |
float |
Optional geolocation latitude of the phone at upload. |
|
comment |
string |
Optional comment on the image. |
|
category |
number |
Optional Reference to existing image's file category. |
|
subcategory |
number |
Optional Reference to existing image's file subcategory. |
Output
|
document |
document |
A document object |
AddPhotoToTool
Add a photo file to a specified tool.
Input
|
title |
string |
A file title (not a file name) |
|
imagedata |
binary |
A binary stream containing photo data in jpeg format. |
|
toolid |
number |
reference to the tool. |
|
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 |
number |
Optional ID of a folder, the image should be placed in. |
|
onxnet |
boolean |
if image is public for extranet. |
|
longitude |
float |
Optional geolocation longitude of the phone at upload. |
|
latitude |
float |
Optional geolocation latitude of the phone at upload. |
|
comment |
string |
Optional comment on the image. |
|
category |
number |
Optional Reference to existing image's file category. |
|
subcategory |
number |
Optional Reference to existing image's file subcategory. |
Output
|
document |
document |
A document object |
AddPhotoToSalesContract
Add a photo file to a specified SalesContract (quotation).
Input
|
title |
string |
A file title (not a file name) |
|
imagedata |
binary |
A binary stream containing photo data in jpeg format. |
|
contractid |
number |
reference to the tool. |
|
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 |
number |
Optional ID of a folder, the image should be placed in. |
|
onxnet |
boolean |
if image is public for extranet. |
|
longitude |
float |
Optional geolocation longitude of the phone at upload. |
|
latitude |
float |
Optional geolocation latitude of the phone at upload. |
|
comment |
string |
Optional comment on the image. |
|
category |
number |
Optional Reference to existing image's file category. |
|
subcategory |
number |
Optional Reference to existing image's file subcategory. |
Output
|
document |
document |
A document object |
CreateUpdateFolder
Rename, move a folder, or add a subfolder to an existing folder.
You cannot change the root folder for an object.
Creating
Either parentid or modcode+objectid is required. Title is required. Readaccess and writeaccess permissions are taken from the parent folder.
Renaming
To rename an existing folder you need to specify id and title.
Moving
To move an existing folder you need to specify the ID of the new parent folder. This is done in the field parentid.
Input
|
title |
string |
A name for the folder |
|
parentid |
number |
The Microbizz ID of the parent folder |
|
id |
number |
The Microbizz ID of an existing folder to update, if any |
|
ispublic |
boolean |
If folder is public for extranet |
|
modcode |
string |
The type of object this folder should be long to, eg. "todo" or "customers" etc. |
|
objectid |
number |
The Microbizz ID of the OD the object this folder shoukld be long |
Output
|
folders |
collection [folder] |
The folders present on the object |
DeleteFolderByID
Delete an existing folder. You cannot delete root folders.
Input
|
folderid |
number |
The ID of an existing folder. |
|
withcontent |
bool |
If this is set to 0 the folder will only be deleted if is doesn't contain any files or subfolders; if set to 1 then the contents will also be deleted |
Output
|
folders |
collection [folder] |
The folders present on the object |
GetImageCategories
Get the image categories and their id's.
Input
|
None |
- |
- |
Output
|
None |
- |
- |
DeleteDocumentByID
Delete a document/file.
Input
|
documentid |
number |
The Microbizz ID of a document/file |
Output
|
None |
- |
- |
MoveDocumentByModcodeAndID
This will move a given document/file to another object. Notice that the file will be given a new ID.
Input
|
documentid |
number |
The ID of a document/file |
|
modcode |
string |
A string specifying where to the file should be moved, either "todo" or "customers" or "tools" |
|
objectid |
number |
The ID of the task/customer/equipment to where the file should be moved |
|
filename |
string |
Optional new name of the file |
|
folder |
string |
Optional name of folder to store the file in, the folder will be created if it doesn't exist; eg. "Pictures/Cats/" |
Output
|
document |
document |
The new document object |
SendMailOnObject
Send a mail to a user or person (or both). Fields from the object will be inserted into the subject+body, refer to the HTML template documentation.
There is a limit to the number of times you may use this call in a given 24h period.
Input
|
objecttype |
string |
The type of object this relates to, either "Customer" or "Todo" |
|
objectid |
number |
The Microbizz ID of the object |
|
mailtemplateid |
number |
The Microbizz ID of an HTML template |
|
userid |
number |
The Microbizz ID of a user, either this or personid must be set |
|
personid |
number |
The MIcrobizz ID of a person, either this or userid must be set |
|
subject |
string |
If not set then the mail subject will be taken from the HTML template |
|
body |
string |
If not set then the mail body will be taken from the HTML template |
Output
|
None |
- |
- |
Anonymization
AnonymizeDataByModcodeAndID
Delete notes, forms mails or activities on a customer, todo or project.
project deletion will additionally delete notes forms and mails which are visible for the project. which also includes connected tasks.
Input
|
search |
string |
The search term |
|
modcode |
string |
should be customers, todo or project. |
|
objectid |
number |
Id of object defined using modcode |
|
data |
string |
should be forms, notes, mails or activities. |
Output
|
None or error message |
|
|
DeleteByModcodeAndID
Delete a project todo or customer
Input
|
search |
string |
The search term |
|
modcode |
string |
should be customers, todo or project. |
|
objectid |
number |
Id of object defined using modcode |
Output
|
None or error message |
|
|
CreatePDF
Create a pdf for download.
Either object_id and object_type has to be in use or a file has to be sent. the file needs to be outside the scope of the json, base64 encoded and it needs to be the file of a valid pdf.
Input
|
object_id |
number |
The ID of an object, see object_type below |
|
object_type |
string |
One of “quotation”, “company” or “task” |
|
custom_document |
number |
The ID of a document in the Data+ module. If this is set the uploaded file will be ignored. |
|
custom_fields |
array |
There are two parts in the custom_fields. an overwrite of contentarea which this format. { //propably always text and { //used to overwrite the font. |
|
custom_areas |
array |
Describes the height and location of the content area on the page. Only allows one content area so far. Example where the area takes up all of a A4 page: [1 => ["y" => 0, "h" => 297]] |
Output
|
None or error message |
|
|
One-time Salary
CreateSalaryOnetime
Create a new one-time salary and optionally attach it to an object
Input
|
salary_onetime |
salary_onetime |
The one-time salary to create. (Id is ignored) |
Output
|
salary_onetime |
salary_onetime |
The one-time salary that was created. |
RemoveSalaryOnetimeByID
Remove a one-time salary by its id.
Input
|
salaryonetimeid |
number |
Id of the one-time salary to remove. |
Output
|
None or error message |
|
|
GetSalaryOnetimesByTodoID
Remove a one-time salary by its id.
Input
|
todoid |
number |
Id of task the one-time salary is attached to. |
Output
|
salary_onetimes |
collection[ salary_onetime ] |
A collection of all one-time salaries or an empty collection if no one-time salary. |