MEX Blog Article

Using The MEX API

Using The MEX API

What is the MEX API?

The MEX OData API is a web-based API that enables integration of other software or applications with your MEX system. The API allows for simplified access to data stored in MEX, such as work orders, assets, and purchase orders.

This makes it easy to create custom integrations that can be used to extend the functionality of your system. Additionally, the API allows for real-time access to data from the MEX system, giving users the ability to quickly and easily access the information they need.

Where can I see the API Code?

The MEX API is open-source and can be downloaded and viewed from here.

MEX API MEX API Wiki Support Disclaimer

Hitting the Endpoints

The API is built in to every MEX instance, the way you access the data is by using http request to pull & push the data.

All endpoints for you site can be seen at this web address:

  • www.{your_mex_site_url}/MEXData/odata.svc
  • Eg. www.localhost/MEXdata/odata.svc

At this stage you haven’t needed to provide any authentication, now that we are going to pull down a list of all assets in the system using Postman we will need to provide some authentication.

Open a new request in Postman and go to the authorization tab, make sure your authorization type is set to basic auth. Enter the credentials to a MEX admin account in the username/password fields, this will automatically generate an authorization header.

Postman authorization header

Add the endpoint that you want to receive the data from to the end of your URL.

  • Eg. https://localhost/MEXData/odata.svc/Assets

Making a GET request to this URL will return an XML file containing all of the data in the Asset table.

XML is not the easiest thing to read or work with when programming, adding these two headers to your GET request will return the data in a JSON format.

Postman content headers

Now when we send our web request off the data will be returned in much more convenient format, here is an example of the data returned to us.


Postman returned Asset table

Trouble Shooting the MEX API

Here are the most common issues we have seen customers face.

  • Endpoint spelt incorrect – always refer to the /odata.svc page to confirm your spelling.
  • No authorization header – When accessing any of the endpoints you need to be authorized.
  • Missing content type headers – Raw XML data is hard to read, adding the content-type & Accept headers will help format the data in a way you can make sense of it.

The MEX API is extremally powerful tool for integrating MEX with third party software, if you have any question or inquiries feel free to contact our support team at Support@mex.com.au | +61 7 3392 4777