Solved

How to create fields in procdure via API in Postman

  • 29 March 2024
  • 1 reply
  • 55 views

Good Afternoon.

 

I am trying to create a work order via an API call and I am currently trialing with Postman. This is what I have currently (excuess the comments):
 

{
"title": "Inspection of Water Pump #1 PN:111 (Pump House), Vibration Warning Test 2",
"assetId": 5054334,
"assignees": [
{
"id": 82364,
"type": "TEAM" // dont know what this means
}
],
"estimatedTime": 1800,
"categories": [
"Inspection",
"Damage"
],
"description": "Whenever irregularities in the water pump operation arise, our established procedure initiates a comprehensive inspection of the pump system in our facility. This encompasses assessing the condition of filters for timely replacement. Technicians conducting the inspection will sign off upon completion to facilitate tracking of maintenance activities.",
"locationId": 1921018,
"priority": "HIGH",
"procedure": {
"id": 1711611,
"title": "Alert Triggered Water Pump Inspection",
"fields": [
"Have a look",
"decide on plan"
]
}

/* "procedure": {
// "id": 1711611,
// "title": "Alert Triggered Water Pump Inspection"
// "fields":
// }*/
}

I am having trouble at the “procedure”, “fields” level. I do not quite how this should be entered as the API documentaion does not give an example. I am guessing this is becasue there is many different field types that can be entered.

 

I get an error of the following:
 

{
"errors": [
{
"error": "must be object",
"fieldPath": "procedure.fields.0"
},
{
"error": "must be object",
"fieldPath": "procedure.fields.1"
}
]
}

 

Any help in trying to enter these properly would be be great.

 

Thanks,

icon

Best answer by mathieumg 29 March 2024, 15:02

View original

1 reply

Hi Ryan!

 

From the developer documentation reference here https://api.getmaintainx.com/v1/docs#tag/Work-Orders/paths/~1workorders/post

 

You can use the chevrons (>) to expand the fields and see their shape. I’ve attached a screenshot of the current version:

 

On the right-hand side you can also see of an example payload for that property, you can use the + sign to toggle nested properties:

 

 

For the assignees array, the type of “TEAM” or “USER” is to specify whether the id you specified just above refers to the id of a user or of a team.

 

Let me know if that helps!

 

Very Best,

Mathieu

Reply