Skip to main content

Post Add Inspection API

Support avatar
Written by Support
Updated over 8 months ago

POST [ audit/inspection-management/add-inspection-api ]

Production Endpoint: https://app.complyflow.com.au/app/public/index.php/audit/inspection-management/add-inspection-api

Test Endpoint: https://test.complyflow.com.au/app/public/index.php/audit/inspection-management/add-inspection-api


Overview

This endpoint adds an Inspection along with the categories, checklists & files.

Authentication instructions

Refer to the Authentication method for Authentication Methods (for Login and Logout).

Permissions Required

The user should possess the permissions below:

  • API User

  • User is Staff

  • Users have Access to View and Edit Inspection Permission

Please also refer to the Permissions Overview guide.

Body properties/Payload

FIELD

TYPE

DESCRIPTION

REQUIRED

inspectionData

array

Inspection Data Array

inspectionData[id_staff]

int

Inspection Uploader

inspectionData[id_project]

int

Inspection will be assigned to this project

inspectionData[id_plant]

int

required if the inspection is a plant inspection

inspectionData[title]

string

The title of the inspection

inspectionData[date_added]

date

The date where inspection is conducted

inspectionData[id_audit_template]

int

Inspection Template ID

media

array

media array (Inspection Files)

media[file1, file2, file3, ...]

file

files attached to the inspection

attendees

array

Inspection Attendees array

attendees[attendee_name, attendee_name, ...]

string

Attendees name

checklist[%index%]

array

checklist item array (can be more than 1 checklist)

checklist[%index%][code]

string

checklist item’s code

checklist[%index%][pass_Status]

int{0,1,2,3}

Status of checklist item, choose between
[0=empty, 1=passed, 2=fail, 3=N/A]

checklist[%index%][finding]

string

Checklist Item’s finding

checklist[%index%][recommendation]

string

Checklist Item’s recommendation

checklist[%index%][criteria]

string

checklist Item’s question

(Required & needs to be exactly the same as in the template, otherwise the checklist will not be displayed)

checklist[%index%][priority]

int

Checklist item priority. Default to 0

checklist[%index%][audit_category]

string

Category of this checklist item

(Required & needs to be exactly the same as in the template, otherwise the checklist will not be displayed)

checklist[%index%][files]

array

checklist item files array

checklist[%index%][files][file1, file2, ...]

file

Files attached to the checklist item

Request Example

curl --location 'http://test.complyflow.com.au/app/public/index.php/audit/inspection-management/add-inspection-api' \

--header 'Authorization: [...]' \

--header 'Cookie: [...]' \

--form 'inspectionData[id_staff]="%staff id%"' \

--form 'inspectionData[id_project]="123456"' \

--form 'inspectionData[id_plant]="123456"' \

--form 'inspectionData[title]="%dynamic title%"' \

--form 'inspectionData[date_added]="dd-mm-yy"' \

--form 'inspectionData[id_audit_template]="100"' \

--form 'media[0]=@"path/to/your/file1"' \

--form 'media[1]=@"path/to/your/file2"' \

--form 'media[2]=@"path/to/your/file3"' \

--form 'attendees[0]="%name%"' \

--form 'attendees[1]="%name%"' \

--form 'attendees[2]="%name%"' \

--form 'attendees[3]="%name%"' \

--form 'checklist[0][code]="123456"' \

--form 'checklist[0][pass_status]="1"' \

--form 'checklist[0][finding]="%finding%"' \

--form 'checklist[0][recommendation]="%recommendation%"' \

--form 'checklist[0][criteria]="%criteria%"' \

--form 'checklist[0][priority]="%priority number%"' \

--form 'checklist[0][audit_category]="category name"' \

--form 'checklist[0][files][0]=@"path/to/your/file1"' \

--form 'checklist[0][files][1]=@"path/to/your/file2"' \

--form 'checklist[0][files][2]=@"path/to/your/file3"'

Response Example

The API Request returns the status of this API action.

{

"status": "200",

"message": "Inspection Added successfully"

}

Response Information

Status

Response

success

status= 200

message= Inspection Added successfully

error

status = %error_code%

message= %error_message%

Did this answer your question?