# Generating a Work Order to MaintainX from Ignition?

**URL:** <https://forum.inductiveautomation.com/t/generating-a-work-order-to-maintainx-from-ignition/87931>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [March 26, 2024, 10:55pm UTC](https://forum.inductiveautomation.com/t/generating-a-work-order-to-maintainx-from-ignition/87931 "2024-03-26T22:55:51Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [April 1, 2024, 5:07pm UTC](https://forum.inductiveautomation.com/t/generating-a-work-order-to-maintainx-from-ignition/87931/10 "2024-04-01T17:07:51Z")

</div>

Here's a preliminary first try at converting Postman to Ignition `httpClient`. Replace the `token` variable with your token. You can run this in the Script Console, at least to try it out.

> **The code**
>
> ```python
> # Create the JythonHttpClient 
> client = system.net.httpClient()
> 
> url = "https://api.getmaintainx.com/v1/workorders"
> body = {
> "title": "Inspection of Water Pump #1 PN:111 (Pump House), Vibration Warning",
> "assetId": 5054334,
> "assignees": [
> {
> "id": 82364,
> "type": "TEAM"
> }
> ],
> "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": [
> {
> "type": "HEADING",
> "label": "Warning: Only authorized technicians should perform this inspection."
> },
> {
> "type": "INSPECTION_CHECK",
> "label": "Check for visible signs of damage to Water Pump"
> },
> {
> "type": "TEXT",
> "label": "If visible damage, state pumps condition on arrival"
> },
> {
> "type": "NUMBER",
> "label": "Record the current pressure reading of Water Pump Keyence Flow meter (from SCADA or From digital display on meter)."
> },
> {
> "type": "INSPECTION_CHECK",
> "label": "Inspect and verify the condition of the pump filters."
> },
> {
> "type": "TEXT",
> "label": "Inspect and verify the condition of the pump exterior."
> },
> {
> "type": "FILE",
> "label": "Upload a photo of the pump's condition"
> },
> {
> "type": "SIGNATURE",
> "label": "Technician's signature upon completion of the inspection."
> }
> ]
> }
> }
> token = "<your_bearer_token_here>" # your bearerToken env variable here
> 
> headers = {
> "Content-Type": "application/json",
> "Accept": "application/json",
> "Authorization": "Bearer {}".format(token)		
> }
>  
> # Sent a POST request (blocking)
> response = client.post(url, data=body, headers=headers)
>  
> # Validate the response
> if response.good:
> # Do something with the response
> print response.getJson()
> [details="Summary"]
> This text will be hidden
> [/details]
> 
> ```

It takes a little tweaking to get the authorization working sometimes, so I wouldn't be surprised if you got an error. I would actually be shocked if you didn't get an error.

---

_[View the full topic](https://forum.inductiveautomation.com/t/generating-a-work-order-to-maintainx-from-ignition/87931)._
