Skip to main content
caution

This section refers to the old versions of the MonkJs SDK (version 3.X.X and below). For the v4 docs, please refer to this page.

Inspection

npm latest package

yarn add @monkvision/corejs
import monk from '@monkvision/corejs'

const { getOne, getMany, upsertOne, addAdditionalDataToOne, deleteOne } = monk.entity.inspection;

getOne​

GET /inspections/${id}

Returns an inspection with all its tasks.

await monk.entity.inspection.getOne(id, { showDeletedObjects });

Try it on api.monk.ai

nametypedefault
idstring
optionsGetOneInspectionOptions
- options.showDeletedObjectsbooleanfalse

getMany​

GET /inspections

Returns all inspections created by user/organization.

await monk.entity.inspection.getMany(options);

Try it on api.monk.ai

nametypedefault
optionsGetManyInspectionsOptions
options.ownershipFilterOwnershipFilter"own_resources"
options.inspectionStatusInspectionStatus
options.showDeletedbooleantrue
options.verbosenumber0
{
"axiosResponse": {},
"entities": {
"inspections": {
"3fa85f64-5717-4562-b3fc-2c963f66afa6": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"createdAt": "2022-02-28T11:38:53.013Z",
"deletedAt": "2022-02-28T11:38:53.013Z",
"images": [
"3fa85f64-5717-4562-b3fc-2c963f66afa6"
],
"ownerId": "string",
"creatorId": "string"
}
},
"images": {
"3fa85f64-5717-4562-b3fc-2c963f66afa6": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"path": "string",
"name": "string",
"imageHeight": 0,
"imageWidth": 0,
"binarySize": 0,
"mimetype": "string"
}
},
"damages": []
},
"result": []
}

createOne​

POST /inspections

An inspection contains data about the state of a vehicle at a given time. Returns a unique inspection id.

You must create an inspection with the list of all the tasks you will ever want to apply on this inspection. You can add images directly or add images later. You must specify on the images also what task you want to apply to the image. When a task have started it is too late to edit it or to add more image on which you want to apply task.

await monkApi.inspections.createOne(data);

Try it on api.monk.ai

nametypedefault
dataCreateInspection

CreateInspection​

nametypedefault
tasksCreateInspectionTaskOptions
vehicleCreateUpdateVehicle
images[CreateImage]
damageAreas[DamageArea]
inspectionTypeInspectionType
additionalDataInspectionAdditionalData
accidentNaturestring
relatedInspectionIdstring
usageDurationnumber
{
"axiosResponse": {},
"entities": {
"images": {
"3fa85f64-5717-4562-b3fc-2c963f66afa6": {
"name": "string",
"rotateImageBeforeUpload": "NO_ROTATION",
"tasks": []
}
},
"vehicles": {
"3fa85f64-5717-4562-b3fc-2c963f66afa6": {
"brand": "string",
"model": "string",
"plate": "string",
"vehicleType": "string",
"mileage": {
"value": 0,
"unit": "km"
},
"marketValue": {
"value": 0,
"unit": "string"
},
"series": "string",
"vehicleStyle": "string",
"vehicleAge": "string",
"vin": "string",
"color": "string",
"exteriorCleanliness": "string",
"interiorCleanliness": "string",
"dateOfCirculation": "string"
}
},
"tasks": {
"3fa85f64-5717-4562-b3fc-2c963f66afa6": {
"status": "NOT_STARTED",
"damageScoreThreshold": 0,
"scoring": {},
"images": []
}
},
"inspections": {
"3fa85f64-5717-4562-b3fc-2c963f66afa6": {
"tasks": [],
"images": [],
"inspectionType": "claim",
"accidentNature": "string",
"relatedInspectionId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"usageDuration": 0,
"damageAreas": []
}
}
}
}

addAdditionalDataToOne​

PATCH /inspections/${id}/pdf_data

await monk.entity.inspection.addAdditionalDataToOne(id, data);

Try it on api.monk.ai

nametypedefault
idstring
dataPdfInputData
- data.mileageMileage
- - data.mileage.valuenumber
- - data.mileage.unitstring
- data.marketValuenumber
- - data.marketValue.valuenumber
- - data.marketValue.unitstring
- data.agentFirstNamestring
- data.agentLastNamestring
- data.agentCompanystring
- data.agentCompanyCitystring
- data.vehicleOwnerFirstNamestring
- data.vehicleOwnerLastNamestring
- data.vehicleOwnerAddressstring
- data.vehicleOwnerPhonestring
- data.vehicleOwnerEmailstring
- data.dateOfStartstring
- data.dateOfValidationstring
- data.vinOrRegisteringstring
- data.commentstring
{
"axiosResponse": {},
"entities": {
"images": {},
"vehicles": {},
"tasks": {},
"inspections": {}
}
}

deleteOne​

DELETE /inspections/${id}

await monk.entity.inspection.deleteOne(id);

Try it on api.monk.ai

nametypedefault
idstring
{
"axiosResponse": {},
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entities": {
"inspections": {
"3fa85f64-5717-4562-b3fc-2c963f66afa6": {
"deleted": true,
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
}
},
"result": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}

Enums​

OwnershipFilter​

string

enum OwnershipFilter {
OWN_RESOURCES = 'own_resources',
ORGANIZATION_RESOURCES = 'organization_resources',
ALL_RESOURCES = 'all_resources',
}

InspectionStatus​

string

enum InspectionStatus {
NOT_STARTED = 'NOT_STARTED',
IN_PROGRESS = 'IN_PROGRESS',
DONE = 'DONE',
ERROR = 'ERROR',
VALIDATED = 'VALIDATED',
}

InspectionType​

string

enum InspectionType {
CLAIM = 'claim',
CHECK_IN_CHECK_OUT = 'check_in_check_out',
}

ProgressStatusUpdate​

string

enum ProgressStatusUpdate {
NOT_STARTED = 'NOT_STARTED',
TODO = 'TODO',
DONE = 'DONE',
VALIDATED = 'VALIDATED',
}