Mobile Apps API

From Ecoachmanager
Jump to: navigation, search

Overview

The Mobile Apps API is similar to the Client API, with simpler authentication and less functionality.

If you want to be able to view all jobs or edit jobs you must use the Client API, which requires the clients login details.

The Mobile Apps API allows simple access to view a single job with the mobile phone number for authentication.

Authentication

You may send requests in either XML or JSON format and all responses will be sent in the matching format.

If you use JSON send requests to http://www.ecoachmanager.com/lib/api?app

If you use XML send requests to http://www.ecoachmanager.com/lib/api?app&xml

Make sure to replace ecoachmanager.com with the URL for your system.

Authentication should be carried out in the normal method explained in API#Access. The only exception is the auth uses the word "app" instead of the md5 of the password.

Responses

Upon receipt of your request the server will return a response formatted in JSON/XML according to your request.

The array apiResponse contains 2 fields - status and details.

JSON Example
{"apiResponse":{"status":"1","details": "...response data here"}}
XML Example
<?xml version=\"1.0\"?>
<apiResponse>
  <status>1</status>
  <details>...response data here</details>
</api-response>

A successful response will return HTTP header 200 OK and a status 1.

A badly formatted request will return HTTP header 400 Bad Request and a status 0.

If authorization fails a HTTP header 401 Unauthorized and status -1 are sent.

The requested data or further info regarding the error are returned in the details.

Available Actions

Below is a list of each of the available actions available in the Mobile Apps API.

getJobInfo

Retrieve basic info for a job by providing the job number and the mobile number.

Request

This action requires 2 details to be sent within the details of a request, with authorization as above.

  • id (The Reference ID of the booking)
  • mobile {The mobile number linked to the booking)

JSON Example
{"apiResponse":{"status":"1","details":{"id":"12345","mobile":"0771234567"}}}
XML Example
<?xml version=\"1.0\"?>
<apiResponse>
  <status>1</status>
  <details>
    <id>12345</id>
    <mobile>0771234567</mobile>
  </details>
</api-response>

Response