API Docs

API Documentation for Case Camp

Request Structure

All API calls are standard HTTP requests (GET,PUT,POST,DELETE).

We have production and staging environments, testing will go through staging and live app will go through production.

Staging URL : https://crm.moblearn.net
Production URL: http://casecamp.com/

For security purposes, we require all API calls to contain an authentication token (except login) This authentication token must be included as an additional parameters.

access_token will be provided when login api call.


Example
Consider a request to get activities

Assume the auth_token is ‘OZEGEArQoMFSpLGNlZhC’ The request we intend to send is as follows:

  • Method: GET
  • Endpoint: ENV(URL)/api/activity
  • Parameters to be sent:
    • ?: OZEGEArQoMFSpLGNlZhC

Then the request will be

https://crm.moblearn.net/api/api/activity?access_token=OZEGEArQoMFSpLGNlZhC&timestamp=1377667413

Sending this request will successfully return the activities.

RestAPI calls

  1. Login
  • Method : POST
  • Request path: ENV(URL)/api/login
  • Purpose: Login with username and password in crm
  • Parameters:
    • username – User’s email address
    • password – User’s chosen password
  • Successful Response:
    • Status code 200
    • JSON representation of a hash as follows
      {“access_token => “fjasfohjiurehfklnj”}
  • Error Response:
    • Status code 400 – Internal Error
    • JSON representation of a hash with message.

  1. Account
  • Method : GET
  • Request path: ENV(URL)/api/account
  • Purpose: Get user info
  • Parameters:
    • access_token – authentication token (get from login call)
  • Successful Response:
    • Status code 200
    • JSON representation of a hash as follows
    • {
      "data": {
      "firstName": "xxxx",
      "email": "xxx@auctionsoftware.com",
      "lastName": "xxx",
      "state": null,
      "country": null
      },
      "success": true
      }

  • Error Response:
    • Status code 400 – Internal Error
    • JSON representation of a hash with message.

  1. Info Call
  • Method : GET
  • Request path: ENV(URL)/api/info
  • Purpose: Check access token is valid or not if not valid redirect the user to login
  • Parameters:
    • access_token – authentication token (get from login call)
  • Successful Response:
    • Status code 200
    • JSON representation of a hash as follows
    • {
      "data": {
      "email": "navin@auctionsoftware.com"
      },
      "success": true
      }

  • Error Response:
    • Status code 400 – Internal Error
    • JSON representation of a hash with message.

  1. Update user account
  • Method : PATCH
  • Request path: ENV(URL)/api/account
  • Purpose: Update user first name, last name, state, country
  • Parameters:
    • access_token authentication token (get from login call)
    • Email – user email
    • firstName – user first name
    • lastName – user last name
    • Country – updated country
    • State – updated state
  • Successful Response:
    • Status code 200
    • JSON representation of a hash as success message
  • Error Response:
    • Status code 400 – Internal Error
    • JSON representation of a hash with message.

  1. Update user Password
  • Method : POST
  • Request path: ENV(URL)/api/password
  • Purpose: Update user password
  • Parameters:
    • access_token authentication token (get from login call)
    • old_value – users old password
    • new_value – user new password
  • Successful Response:
    • Status code 200
    • JSON representation of a hash as success message
  • Error Response:
    • Status code 400 – Internal Error
    • JSON representation of a hash with message.

  1. Get Activities
  • Method : GET
  • Request path: ENV(URL)/api/activity
  • Purpose: Get user report activities
  • Parameters:
    • access_token authentication token (get from login call)
  • Successful Response:
    • Status code 200
    • JSON representation of a hash
      {
      "data": [
      {
      "date": "2016-05-17",
      "cases": 1,
      "hours": 1
      },
      {
      "date": "2016-05-12",
      "cases": 2,
      "hours": 3
      },
      {
      "date": "2016-05-11",
      "cases": 2,
      "hours": 3
      },
      ],
      "success": true
      }
  • Error Response:
    • Status code 400 – Internal Error
    • JSON representation of a hash with message.

  1. Get Status Report
  • Method : GET
  • Request path: ENV(URL)/api/status_report
  • Purpose: Get the cases needs to report
  • Parameters:
    • access_token – authentication token (get from login call)
  • Successful Response:
    • Status code 200
    • JSON representation of a hash as success message
      {
      "data": {
      "date": "2016-05-18",
      "times": [
      {
      "time": "5:00PM",
      "projects": [
      {
      "code": "10050",
      "title": "India Team Status Report",
      "cases": [
      {
      "code": "10417",
      "name": "xxxx"
      }
      ]
      },
      ]
      }
      ]
      },
      "success": true
      }
  • Error Response:
    • Status code 400 – Internal Error
    • JSON representation of a hash with message.

  1. Update Status Report
  • Method : POST
  • Request path: ENV(URL)/api/status_report
  • Purpose: Update Status Report
  • Parameters:
    • access_token – authentication token (get from login call)
    • Location (lat, long)
    • Photo
    • cases
  • Successful Response:
    • Status code 200
    • JSON representation of a hash as success message
  • Error Response:
    • Status code 400 – Internal Error
    • JSON representation of a hash with message.

  1. Post IOS device token
  • Method : POST
  • Request path: ENV(URL)/ios_device_token
  • Purpose: Post the ios push notification token
  • Parameters:
    • access_token – authentication token (get from login call)
    • token
  • Successful Response:
    • Status code 200
    • JSON representation of a hash as success message
  • Error Response:
    • Status code 400 – Internal Error
    • JSON representation of a hash with message.