MGR’s API enables you to control your data within MGR using your programming language of choice. The MGR API is a RESTful API based on HTTP requests and JSON or XML responses. The easiest way to start using the MGR API is by using the API Explorer which helps developers run and debug API requests, and is the source of truth for this documentation. Every endpoint you see documented here is readily available by running our API Explorer collection.

How to generate an API key?

You will not be able to access the API endpoints without the API key. To generate the API key, please navigate to the shop settings > “Miscand then click on “API KEY” button, a new window will open, click on the “Generate API key” button. Please keep the generated API Key safe as the system will not be able to show it again, if you have lost the existing key then we would recommend you to generate a new key. To reset the API key please click on the “Reset API Key“.

API Requirements

To start working on the API you will need the following information from us

Base URL: https://api.mygadgetrepairs.com/v1

API Explorer: https://api.mygadgetrepairs.com/v1

Authentication: You will have to send apiKey in the request header rather than a query string.

Header:

Authorization:  apiKey

Response Format: 

Our API supports both XML and JSON response formats. You can send the “Accept” header in your request with one of the two formats “application/xml” or “application/json”. If you do not send this header, the default response will be in JSON format.

Example Header for XML Response:

Accept: application/xml

Example Header for JSON Response:

Accept: application/json

Successful Response: The API will return 200 or 201 status code for a request that completes successfully.

  • GET requests will return response content in json/xml format with a certain resource object.
    JSON Response:
    {
    "id":"xxxx-xxxx-xxxx-xxxx",
    "name":"John John",
    "email":"johnjohn@email.com"
    }

    XML Response: For XML response example, use API Explorer and choose XML as Accept header.
  • POST/PUT requests will return a reference id of the resource created/updated.
    {"id":"xxxx-xxxx-xxxx-xxxx"}
  • DELETE requests will not return anything in content.

Error Response: Any status code other than 200 or 201, means the request didn’t go through successfully. In most cases, the API will return an error message in the response content in form of json/xml.

  • JSON Response:
    {"error":"Error message. Advice message"}

    XML Response: For XML response example, use API Explorer and choose XML as Accept header.

Request Rate: Currently there is a rate limit on the API, you can ONLY send 50 requests per minute. Once it reached the limit you will get an error message.

Default Records per page: Currently there is a limit on the number of records return per page, API ONLY gives you 50 records per request.

Resources:

The API provides access to the following resources of My Gadget Repairs.

Customers

  • GET /customers
    It will return the list of all your customers.
    https://api.mygadgetrepairs.com/v1/customers
  • POST /customers
    It will create a new customer and return the id of the newly created customer. Send customer data as suggested in API Explorer
    https://api.mygadgetrepairs.com/v1/customers

    Use Content-Type: application/json in the header to send data as body
    {
    "name": "John John",
    "mobile": "446549879415",
    "email": "johnjohn@email.com"
    }

    – If the request goes through successfully, the API will return 201 status code and response content. (see above in Response Format section)
    – Any other status code means the customer was not created successfully. An error message may be provided with advice in most scenarios. (see above in Response Format section)
  • GET /customers/{customerId}
    It will return the detail of one customer.
    https://api.mygadgetrepairs.com/v1/customers/{customerId}
  • PUT /customers/{customerId}
    It will update an existing customer and return the id of the customer if successful. Send customer data as suggested in API Explorer
    https://api.mygadgetrepairs.com/v1/customers/{customerId}

    Use Content-Type: application/json in the header to send data as body
    {
    "name": "Master John",
    "telephone": "44658887954"
    }

    Note: Only add a field in the body which is needed to be updated. For instance, if only the {name} is needed to be updated, simply send the field alone.
    – If the request goes through successfully, the API will return 200 status code and response content.(see above in Response Format section)
    – Any other status code means the customer was not updated successfully. An error message may be provided with advice in most scenarios. (see above in Response Format section)
  • DELETE /customers/{customerId}
    – It will delete an existing customer and return 200 status code with no content, if successful.
    – Any other status code means the customer was not deleted successfully. An error message may be provided with advice in most scenarios. (see above in Response Format section)

Tickets

  • GET /tickets
    It will return the list of tickets.
    https://api.mygadgetrepairs.com/v1/tickets
  • POST /tickets
    It will create a new ticket and return the id of the newly created ticket. Send ticket data as suggested in API Explorer
    https://api.mygadgetrepairs.com/v1/tickets

    Use Content-Type: application/json in the header to send data as body
    {
    "shortInfo": "Example Ticket Short Info",
    "status": "New",
    "customerId": "xxxx-xxxx-xxxx-xxxx"
    }

    – If the request goes through successfully, the API will return 201 status code and response content. (see above in Response Format section)
    – Any other status code means the ticket was not created successfully. An error message may be provided with advice in most scenarios. (see above in Response Format section)
  • GET /tickets/{ticketId}
    It will return detail of one ticket.
    https://api.mygadgetrepairs.com/v1/tickets/{ticketId}
  • PUT /tickets/{ticketId}
    It will update an existing ticket and return the id of the ticket if successful. Send ticket data as suggested in API Explorer
    https://api.mygadgetrepairs.com/v1/tickets/{ticketId}

    Use Content-Type: application/json in the header to send data as body
    {
    "shortInfo": "Example Ticket Short Info",
    "status": "In Progress"
    }

    Note: Only add a field in the body which is needed to be updated. For instance, if only the {shortInfo} is needed to be updated, simply send the field alone.
    – If the request goes through successfully, the API will return 200 status code and response content.(see above in Response Format section)
    – Any other status code means the ticket was not updated successfully. An error message may be provided with advice in most scenarios. (see above in Response Format section)
  • DELETE /tickets/{ticketId}
    – It will delete an existing ticket and return 200 status code with no content, if successful.
    – Any other status code means the ticket was not deleted successfully. An error message may be provided with advice in most scenarios. (see above in Response Format section)
  • POST /tickets/{ticketId}/upload
    You must use this endpoint to initiate an upload request for these allowed file types (pdf, doc, png or jpg) with only metadata of the file.
    https://api.mygadgetrepairs.com/v1/tickets/{ticketId}/upload

    Use Content-Type: application/json to post required fields to send metadata of the file as specified below.
    {
    "fileName": "example-file-name.pdf",
    "fileSize": 1024,
    "fileTitle": "Example File Title"
    }

    If accepted, the API will create and return “Location”  header in the response with 201 status code, you will use this in your subsequent request with “PUT”
    Location: /v1/tickets/{ticketId}/upload?id={uploadId}

    Complete the uploading file with the following endpoint.
  • PUT /tickets/{ticketId}/upload?id={uploadId}
    Simply send a body with binary data of the file on this endpoint. Make sure it’s the exact file’s binary that you sent metadata of, via POST request above. If the binary does not match with the metadata, the upload will fail.
    https://api.mygadgetrepairs.com/v1/tickets/{ticketId}/upload?id={uploadId}

    If successfully uploaded, the API will return 200 status code.
  • GET /issueTypes
    It will return list of issue types.
    https://api.mygadgetrepairs.com/v1/issueTypes
  • GET /statuses
    Get list of Ticket status.
    https://api.mygadgetrepairs.com/v1/statuses

Invoices

  • GET /ticketInvoices/
    It will return list of ticket invoice.
    https://api.mygadgetrepairs.com/v1/ticketsInvoices
  • GET /ticketInvoices/{invoiceId}
    It will return detail of one ticket invoice.
    https://api.mygadgetrepairs.com/v1/ticketinvoices/{invoiceid}
  • GET /posInvoices/
    It will return list of pos invocies.
    https://api.mygadgetrepairs.com/v1/posInvoices
  • GET /posInvoices/{invoiceId}
    It will return detail of one pos invoice.
    https://api.mygadgetrepairs.com/v1/posInvoices/{invoiceid}

Products

  • GET /products
    It will return list of products.
    https://api.mygadgetrepairs.com/v1/products
  • GET /products/{productId}
    It will return detail of one product.
    https://api.mygadgetrepairs.com/v1/products/{productId}
  • GET /models
    It will return list of models.
    https://api.mygadgetrepairs.com/v1/models
  • GET /brands
    It will return list of makes.
    https://api.mygadgetrepairs.com/v1/brands

Purchase Orders

  • GET /purchaseOrders
    It will return list of purchase orders.
    https://api.mygadgetrepairs.com/v1/purchaseOrders
  • GET /purchaseOrders/{purchaseOrderId}
    It will return detail of one purchase order.
    https://api.mygadgetrepairs.com/v1/purchaseOrders/{purchaseOrderId}

Shop Staff/Users

  • GET /users
    Get employee list it will used to search or for assign ticket to technician.
    https://api.mygadgetrepairs.com/v1/users
  • GET /users/{userId}
    Get detail of one employee.
    https://api.mygadgetrepairs.com/v1/users/{userId}

Suppliers

  • GET /suppliers
    To get list of supplies.
    https://api.mygadgetrepairs.com/v1/suppliers
  • GET /suppliers/{supplierId}
    It will return detail of one supplier.
    https://api.mygadgetrepairs.com/v1/suppliers/{supplierId}

Other Resources

  • GET /paymentMethods
    It will return list of payment methods.
    https://api.mygadgetrepairs.com/v1/paymentMethods
  • GET /taxRates
    Get list of Tax rates.
    https://api.mygadgetrepairs.com/v1/taxRates
  • GET /customFields/{type:tickets|customers|products}
    It will return the list of custom fields for given type.
    Example endpoints:
    https://api.mygadgetrepairs.com/v1/customFields/tickets

    https://api.mygadgetrepairs.com/v1/customFields/customers

    https://api.mygadgetrepairs.com/v1/customFields/products

Example Requests

To get a list of customers of your shop, you will need to be authenticated with your shop’s API key and send a request as follows.

curl --location --request GET "https://api.mygadgetrepairs.com/v1/customers" \
--header "Authorization: {apiKey}" \
--url "customerid=" \

Need help?

The MGR engineers are always around answering questions. The quickest way to get help is by sending us your question via an email.

Was this article helpful to you?

mm

John Smith

Leave a Reply

You must be logged in to post a comment.