API

API

API
MPservices API is organized around REST. Our API accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes.

Authentication
The API uses API keys to authenticate requests. You can view and manage your API keys in Integrations Settings 

Your API key needs to be added to the header of every request with the label 'token'.

token:MPSER110_eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnRJZCI6IjY4MDVmOGM1LTQ3NjctNGJhOS1iZGRjLTYxZjAxNTY3MWUzNSIsImFwaUtleUlkIjoiOGUyZTQyZmYtMDAxOS00YTA4LWFlZDUtZjY2NWZlZDFlOTFiIiwiaWF0IjoxNjk0Nzg2NzY3fQ.psrR

We use conventional HTTP response codes to indicate the success or failure of an API request. 


API Documentation

Get work orders
Description: Fetch created work orders of the last two days ordered by last created.

Response: 
{
  "id": "4fbd13b5-4cdd-4b8e-b67c-2bdfd2ec71234e",
  "folio": 198,
  "title": "Preventive Monthly Activity",
  "scheduleDate": "2023-09-15T06:00:00.000Z",
  "start": "2023-09-15T09:00:00.000Z",
  "end": "2023-09-15T12:00:00.000Z",
  "open": true,
  "closed": false,
  "createdAt": "2023-09-15T16:11:28.090Z",
  "users": [
    {
      "username": "John",
      "email": "john@mail.com"
    }
  ],
  "client": {
    "name": "Client 1"
  },
  "asset": {
    "name": "Mini Split",
    "code": "MS-230"
  },
  "notes": []
}




Get Inventory movements
Description: Fetch created inventory movements in the last two days ordered by last created .
URL: 'https://integrations.mpservices.app/FetchTenantsInventoryMovements'
Type: GET 


Response: 
{
  "id": "612f8bdb-b42e-42ea-be45-5a7156dacdf5",
  "reference": "Folio-198",
  "type": "Outbound",
  "createdAt": "2023-09-19T13:54:37.187Z",
  "movements": [
    {
      "cost": "25",
      "quantity": 2,
      "item": "Item name",
      "unit": "item unit (Pieces, Liters, inches)",
      "item_id": "0000000000002",
      "item_external_id": "1231232"
    }
  ]
}




Create a new product 
Description: Creates a new product in Mpservices.
Type: POST 
Body object keys: 
  1. bar_code: *required String
  2. product_name:*required String 
  1. product_unit: *required string 
  1. external_id: *required string 
  2. product_stock: string 
  3. product_location: string
  1. weighted_average: number
  2. category:  string
  3. min_stock: integer
  4. max_stock: integer 

Update product stock and cost
Description: Updates the cost and stock of a product and creates a movement.
URL: 'https://integrations.mpservices.app/UpdateProductStockCost''
Type: PATCH 
Body object keys: 
  1. external_id: *required string 
  1. new_stock: *required string 
  2. new_cost: *required string