NAV Navbar
shell 2392528823 828-962-0200 javascript
  • Introduction
  • mesothorium
  • (641) 363-8305
  • (586) 427-9289
  • 620-921-6825
  • Health Record
  • Errors
  • Introduction

    Welcome to the Medbook Payment API! You can use our API to access MPM API endpoints, which can be used to perfom MPM transaction in your system.

    We have language bindings in Shell, Ruby, and Python! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.

    Authentication

    Registration

    To Register a service provider, use this code:

    require 'uri'
    require 'net/http'
    
    url = URI("/medbookafrica.com:8080/payment/serviceprovider")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Post.new(url)
    request["content-type"] = 'application/x-www-form-urlencoded'
    request["cache-control"] = 'no-cache'
    request.body = "address=1234%20-%2000100&comments=Xray%20department&contact=Upper%20hill&email=user%40medbookafrica.com&facility_id=null&facility_name=THE%20NAIROBI%20HOSPITAL&incorporation=2018-03-04T21%3A00%3A00.000Z&name=New%20User&phone=%2B254722123123&type=2"
    
    response = http.request(request)
    puts response.read_body
    
    import requests
    
    url = "/medbookafrica.com:8080/payment/serviceprovider"
    
    payload = "address=1234%20-%2000100&comments=Xray%20department&contact=Upper%20hill&email=user%40medbookafrica.com&facility_id=null&facility_name=THE%20NAIROBI%20HOSPITAL&incorporation=2018-03-04T21%3A00%3A00.000Z&name=New%20User&phone=%2B254722123123&type=2"
    headers = {
        'content-type': "application/x-www-form-urlencoded",
        'cache-control': "no-cache"
        }
    
    response = requests.request("POST", url, data=payload, headers=headers)
    
    print(response.text)
    
    # With shell, you can just pass the correct header with each request
    curl -X POST \
      /medbookafrica.com:8080/payment/serviceprovider \
      -H 'cache-control: no-cache' \
      -H 'content-type: application/x-www-form-urlencoded' \
      -d 'address=1234%20-%2000100&comments=Xray%20department&contact=Upper%20hill&email=user%40medbookafrica.com&facility_id=null&facility_name=THE%20NAIROBI%20HOSPITAL&incorporation=2018-03-04T21%3A00%3A00.000Z&name=New%20User&phone=%2B254722123123&type=2'
    
    var settings = {
      "async": true,
      "crossDomain": true,
      "url": "/medbookafrica.com:8080/payment/serviceprovider",
      "method": "POST",
      "headers": {
        "content-type": "application/x-www-form-urlencoded",
        "cache-control": "no-cache"
      },
      "data": {
        "address": "1234 - 00100",
        "comments": "Xray department",
        "contact": "Upper hill",
        "email": "user@medbookafrica.com",
        "facility_id": "null",
        "facility_name": "THE NAIROBI HOSPITAL",
        "incorporation": "2018-03-04T21:00:00.000Z",
        "name": "New User",
        "phone": "+254722123123",
        "type": "2"
      }
    }
    
    $.ajax(settings).done(function (response) {
      console.log(response);
    });
    

    Register A service provider using this endpoint. If the service provider is a receptionist json 'type':'1' else if the service provider is a cashier json 'type':'2'

    Sign in

    To authorize, use this code:

    require 'uri'
    require 'net/http'
    
    url = URI("/medbookafrica.com:8080/user/signin")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Post.new(url)
    request["content-type"] = 'application/x-www-form-urlencoded'
    request["cache-control"] = 'no-cache'
    request.body = "email=your_email&password=your_password"
    
    response = http.request(request)
    puts response.read_body
    
    import requests
    
    url = "/medbookafrica.com:8080/user/signin"
    
    payload = "email=your_email&password=your_password"
    headers = {
        'content-type': "application/x-www-form-urlencoded",
        'cache-control': "no-cache"
        }
    
    response = requests.request("POST", url, data=payload, headers=headers)
    
    print(response.text)
    
    # With shell, you can just pass the correct header with each request
    curl -X POST \
      /medbookafrica.com:8080/user/signin \
      -H 'cache-control: no-cache' \
      -H 'content-type: application/x-www-form-urlencoded' \
      -d 'email=your_email&password=your_password'
    
    var settings = {
      "async": true,
      "crossDomain": true,
      "url": "/medbookafrica.com:8080/user/signin",
      "method": "POST",
      "headers": {
        "content-type": "application/x-www-form-urlencoded",
        "cache-control": "no-cache"
      },
      "data": {
        "email": "your_email",
        "password": "your_password"
      }
    }
    
    $.ajax(settings).done(function (response) {
      console.log(response);
    });
    

    The above command returns JSON structured like this:

    {
        "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjkyLCJpc3MiOiJodHRwOi8vbWVkYm9va2FmcmljYS5jb206ODA4MC91c2VyL3NpZ25pbiIsImlhdCI6MTUyMDE5NjkwNiwiZXhwIjoxNTIwMjAwNTA2LCJuYmYiOjE1MjAxOTY5MDYsImp0aSI6IkdDMEV2eDFtWUhDTEdTVlAifQ.x-JPc4c_02UXEzAU4f_YXEleVMCb333u-rRaj3zCLk8"
    }
    

    MPM uses tokens to allow access to the API. Token can be gotten once registered. You can register a new user on our (717) 519-3827.

    MPM expects for the token to be included in all API requests to the server in a header that looks like the following:

    Authorization: bearer -token-

    Transactions

    Get member information

    To get member information, use this code:

    require 'uri'
    require 'net/http'
    
    url = URI("/medbookafrica.com/payment/serviceprovider/test001/54/member")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["authorization"] = 'Bearer -token-'
    request["cache-control"] = 'no-cache'
    
    response = http.request(request)
    puts response.read_body
    
    import requests
    
    url = "/medbookafrica.com/payment/serviceprovider/test001/54/member"
    
    headers = {
        'authorization': "Bearer -token-",
        'cache-control': "no-cache",
        }
    
    response = requests.request("GET", url, headers=headers)
    
    print(response.text)
    
    curl -X GET \
      /medbookafrica.com/payment/serviceprovider/{member_no}/{payer}/member \
      -H 'authorization: Bearer -token-' \
      -H 'cache-control: no-cache' \
    
    var settings = {
      "async": true,
      "crossDomain": true,
      "url": "/medbookafrica.com/payment/serviceprovider/test001/54/member",
      "method": "GET",
      "headers": {
        "authorization": "Bearer -token-",
        "cache-control": "no-cache"
      }
    }
    
    $.ajax(settings).done(function (response) {
      console.log(response);
    });
    

    The above command returns JSON structured like this:

    [{"user_id":92,"id":91,"first_name":"Name","last_name":"Last Name","residential_address":"None","member_no":"test001","mobile_phone_number":"+254 706943466","gender":1,"date_of_birth":"1990-07-09","name":"Test Inusurance","payer_id":54,"email":"reinhardodhiambo@gmail.com","photo":"\/i\/users\/user-92.jpg","verified":0}]
    

    This endpoint retrieves a member information.

    HTTP Request

    GET /medbookafrica:8080/payment/serviceprovider/<MEMBER_NO>/<PAYER_ID>/member

    URL Parameters

    Parameter Description
    MEMBER_NO The policy number of the patient
    PAYER_ID The ID of the insurance company provided by medbook

    Generate verification for a transaction

    In the 1st process of payment, an OTP is generated for that transaction and sent to the patient. The patient the gives out the code to confirm the transaction. To achieve these, use the code below:

    require 'uri'
    require 'net/http'
    
    url = URI("/medbookafrica.com/payment/serviceprovider/test001/54/member")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["authorization"] = 'Bearer -token-'
    request["cache-control"] = 'no-cache'
    
    response = http.request(request)
    puts response.read_body
    
    import requests
    
    url = "/medbookafrica.com/payment/serviceprovider/test001/54/member"
    
    headers = {
        'authorization': "Bearer -token-",
        'cache-control': "no-cache",
        }
    
    response = requests.request("GET", url, headers=headers)
    
    print(response.text)
    
    curl -X GET \
      /medbookafrica.com/payment/serviceprovider/{member_no}/{payer}/member \
      -H 'authorization: Bearer -token-' \
      -H 'cache-control: no-cache' \
    
    var settings = {
      "async": true,
      "crossDomain": true,
      "url": "/medbookafrica.com/payment/serviceprovider/test001/54/member",
      "method": "GET",
      "headers": {
        "authorization": "Bearer -token-",
        "cache-control": "no-cache"
      }
    }
    
    $.ajax(settings).done(function (response) {
      console.log(response);
    });
    

    The above command returns no response

    This endpoint generates an OTP for a transaction.

    HTTP Request

    GET /medbookafrica:8080/payment/password/<MOBILE_NO>/<AMOUNT>

    URL Parameters

    Parameter Description
    MOBILE_NO The mobile number of the patient
    AMOUNT Total amount during transaction

    Verify a Transaction

    Once the patient has given out the OTP, it can be verified using the code below:

    require 'uri'
    require 'net/http'
    
    url = URI("/medbookafrica.com/payment/serviceprovider/test001/54/member")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["authorization"] = 'Bearer -token-'
    request["cache-control"] = 'no-cache'
    
    response = http.request(request)
    puts response.read_body
    
    import requests
    
    url = "/medbookafrica.com/payment/serviceprovider/test001/54/member"
    
    headers = {
        'authorization': "Bearer -token-",
        'cache-control': "no-cache",
        }
    
    response = requests.request("GET", url, headers=headers)
    
    print(response.text)
    
    curl -X GET \
      /medbookafrica.com/payment/serviceprovider/{member_no}/{payer}/member \
      -H 'authorization: Bearer -token-' \
      -H 'cache-control: no-cache' \
    
    var settings = {
      "async": true,
      "crossDomain": true,
      "url": "/medbookafrica.com/payment/serviceprovider/test001/54/member",
      "method": "GET",
      "headers": {
        "authorization": "Bearer -token-",
        "cache-control": "no-cache"
      }
    }
    
    $.ajax(settings).done(function (response) {
      console.log(response);
    });
    

    The above command returns true if the OTP is correct else it returns false

    This endpoint confirms a transaction through OTP.

    HTTP Request

    POST /medbookafrica.com:8080/payment/serviceprovider/transaction

    Get Transactions

    To get transactions, use this code:

    require 'uri'
    require 'net/http'
    
    url = URI("/medbookafrica.com:8080/payment/agent/invitation")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["cache-control"] = 'no-cache'
    
    response = http.request(request)
    puts response.read_body
    
    import requests
    
    url = "/lmedbookafrica.com:8080/payment/agent/invitation"
    
    headers = {
        'cache-control': "no-cache"
        }
    
    response = requests.request("GET", url, headers=headers)
    
    print(response.text)
    
    curl -X GET \
      /lmedbookafrica.com:8080/payment/agent/invitation \
      -H 'cache-control: no-cache' \
    
    var settings = {
      "async": true,
      "crossDomain": true,
      "url": "/lmedbookafrica.com:8080/payment/agent/invitation",
      "method": "GET",
      "headers": {
        "cache-control": "no-cache"
      }
    }
    
    $.ajax(settings).done(function (response) {
      console.log(response);
    });
    

    The above command returns JSON structured like this:

    [
      {
        "id": 42
        "serviceprovider_id": 3
        "patient_id": 91
        "type": 1
        "consultation_fee": 1
        "consultation_comment": "one"
        "pharmacy_fee": 5
        "pharmacy_comment": "five"
        "mri_fee": 4
        "mri_comment": "four"
        "other_fee": 6
        "other_comment": "Six",
        "total_fee": 21
        "total_comment": null
        "payer": "Test Inusurance"
        "created_at": "2017-12-12 22:12:45"
        "updated_at": "2017-12-12 22:12:45"
        "member_no": "test001"
        "method": 1
        "synced": 0
        "laboratory_fee":  2
        "laboratory_comment": "two"
        "xray_fee": 3
        "xray_comment": "three"
        "serviceprovider": null
        "patient": null
      },
      {
        "id": 43
        "serviceprovider_id": 3
        "patient_id": 91
        "type": 1
        "consultation_fee": 1
        "consultation_comment": "one"
        "pharmacy_fee": 5
        "pharmacy_comment": "five"
        "mri_fee": 4
        "mri_comment": "four"
        "other_fee": 6
        "other_comment": "Six",
        "total_fee": 21
        "total_comment": null
        "payer": "Test Inusurance"
        "created_at": "2017-12-12 22:12:45"
        "updated_at": "2017-12-12 22:12:45"
        "member_no": "test001"
        "method": 1
        "synced": 0
        "laboratory_fee":  2
        "laboratory_comment": "two"
        "xray_fee": 3
        "xray_comment": "three"
        "serviceprovider": null
        "patient": null
      }
    ]
    

    This endpoint retrieves all Transactions.

    HTTP Request

    GET /medbookafrica.com:8080/payment/agent/invitation

    Get a Specific Transaction

    require 'uri'
    require 'net/http'
    
    url = URI("/medbookafrica:8080/payment/serviceprovider/transaction/1/details")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["authorization"] = 'Bearer -token-'
    request["cache-control"] = 'no-cache'
    
    response = http.request(request)
    puts response.read_body
    
    import requests
    
    url = "/medbookafrica:8080/payment/serviceprovider/transaction/1/details"
    
    headers = {
        'authorization': "Bearer -token-",
        'cache-control': "no-cache"
        }
    
    response = requests.request("GET", url, headers=headers)
    
    print(response.text)
    
    curl -X GET \
      /medbookafrica:8080/payment/serviceprovider/transaction/1/details \
      -H 'authorization: Bearer -token-' \
      -H 'cache-control: no-cache' \
    
    ```javascript
    var settings = {
      "async": true,
      "crossDomain": true,
      "url": "/medbookafrica:8080/payment/serviceprovider/transaction/1/details",
      "method": "GET",
      "headers": {
        "authorization": "Bearer -token-",
        "cache-control": "no-cache",
      }
    }
    
    $.ajax(settings).done(function (response) {
      console.log(response);
    });
    

    The above command returns JSON structured like this:

    [{"user_id":92,"id":1,"first_name":"Name 1","last_name":"Name 2","residential_address":"None","mobile_phone_number":"+254 706943466","gender":1,"date_of_birth":"1990-07-09","email":"email@gmail.com","photo":"\/i\/users\/user-92.jpg","serviceprovider_id":3,"patient_id":91,"type":"1","consultation_fee":100,"consultation_comment":null,"pharmacy_fee":100,"pharmacy_comment":null,"mri_fee":100,"mri_comment":null,"other_fee":100,"other_comment":null,"total_fee":400,"total_comment":null,"payer":"Madison Insurance Company Kenya","created_at":"2016-09-26 11:49:54","updated_at":"2016-09-26 11:49:54","member_no":"PIS\/00001\/00","method":0,"synced":0,"laboratory_fee":"","laboratory_comment":"","xray_fee":"","xray_comment":""}]
    

    This endpoint retrieves a specific Transaction.

    HTTP Request

    GET /medbookafrica:8080/payment/serviceprovider/transaction/<ID>/details

    URL Parameters

    Parameter Description
    ID The ID of the transaction to View

    Patient

    Register a patient

    To add a new patient, use this code:

    require 'uri'
    require 'net/http'
    
    url = URI("/medbookafrica.com:8080/user/register/walkin")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Post.new(url)
    request["authorization"] = 'Bearer -token-'
    request["content-type"] = 'application/x-www-form-urlencoded'
    request["cache-control"] = 'no-cache'
    request.body = "date_of_birth=2018-03-06&first_name=Name%201&gender=1&last_name=Name%202&mobile_phone_number=%2B254722727272&user_type_id=1"
    
    response = http.request(request)
    puts response.read_body
    
    import requests
    
    url = "/medbookafrica.com:8080/user/register/walkin"
    
    payload = "date_of_birth=2018-03-06&first_name=Name%201&gender=1&last_name=Name%202&mobile_phone_number=%2B254722727272&user_type_id=1"
    headers = {
        'authorization': "Bearer -token-",
        'content-type': "application/x-www-form-urlencoded",
        'cache-control': "no-cache"
        }
    
    response = requests.request("POST", url, data=payload, headers=headers)
    
    print(response.text)
    
    curl -X POST \
      /medbookafrica.com:8080/user/register/walkin \
      -H 'authorization: Bearer -token-' \
      -H 'cache-control: no-cache' \
      -H 'content-type: application/x-www-form-urlencoded' \
      -d 'date_of_birth=2018-03-06&first_name=Name%201&gender=1&last_name=Name%202&mobile_phone_number=%2B254722727272&user_type_id=1'
    
    var settings = {
      "async": true,
      "crossDomain": true,
      "url": "/medbookafrica.com:8080/user/register/walkin",
      "method": "POST",
      "headers": {
        "authorization": "Bearer -token-",
        "content-type": "application/x-www-form-urlencoded",
        "cache-control": "no-cache"
      },
      "data": {
        "date_of_birth": "2018-03-06",
        "first_name": "Name 1",
        "gender": "1",
        "last_name": "Name 2",
        "mobile_phone_number": "+254722727272",
        "user_type_id": "1"
      }
    }
    
    $.ajax(settings).done(function (response) {
      console.log(response);
    });
    

    The above command returns JSON structured like this:

    [{"id":225,"user_type_id":1,"first_name":"Name 1","last_name":"Name 2","gender":1,"date_of_birth":"2018-03-06","photo":null,"nationality":"Kenya","national_id":null,"passport_no":null,"mobile_phone_number":"+254722727272","home_phone_number":null,"residential_county":null,"residential_address":"","postal_address":"","email":null,"marital_status":null,"occupation":null,"dialing_code":"+254","created_at":"2018-03-05 13:14:47","updated_at":"2018-03-05 13:14:47","verified":1,"education_level":null,"can_post":0,"patient":{"id":222,"user_id":225,"birth_certificate_no":null,"blood_group":null,"nhif_no":"","created_at":"2018-03-05 13:14:47","updated_at":"2018-03-05 13:14:47"}}]
    

    This endpoint creates a new patient in the Medbook database.

    HTTP Request

    POST /medbookafrica:8080/user/register/walkin

    Appointment

    Book appointment for a patient

    To book appointment for a patient, use this code:

    require 'uri'
    require 'net/http'
    
    url = URI("/medbookafrica.com:8080/practice/walkin")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Post.new(url)
    request["authorization"] = 'Bearer -token-'
    request["content-type"] = 'application/x-www-form-urlencoded'
    request["cache-control"] = 'no-cache'
    request.body = "practice_id=1&patient_id=91&appointment_time=2018-03-06%2009%3A35&practitioner_id=15"
    
    response = http.request(request)
    puts response.read_body
    
    import requests
    
    url = "/medbookafrica.com:8080/practice/walkin"
    
    payload = "practice_id=1&patient_id=91&appointment_time=2018-03-06%2009%3A35&practitioner_id=15"
    headers = {
        'authorization': "Bearer -token-",
        'content-type': "application/x-www-form-urlencoded",
        'cache-control': "no-cache"
        }
    
    response = requests.request("POST", url, data=payload, headers=headers)
    
    print(response.text)
    
    curl -X POST \
      /medbookafrica.com:8080/practice/walkin \
      -H 'authorization: Bearer -token-' \
      -H 'cache-control: no-cache' \
      -H 'content-type: application/x-www-form-urlencoded' \
      -d 'practice_id=1&patient_id=91&appointment_time=2018-03-06%2009%3A35&practitioner_id=15'
    
    var settings = {
      "async": true,
      "crossDomain": true,
      "url": "/medbookafrica.com:8080/practice/walkin",
      "method": "POST",
      "headers": {
        "authorization": "Bearer -token-",
        "content-type": "application/x-www-form-urlencoded",
        "cache-control": "no-cache"
      },
      "data": {
        "practice_id": "1",
        "patient_id": "91",
        "appointment_time": "2018-03-06 09:35",
        "practitioner_id": "15"
      }
    }
    
    $.ajax(settings).done(function (response) {
      console.log(response);
    });
    

    The above command returns JSON structured like this:

    {"patient_id":91,"practitioner_id":15,"practice_id":"1","appointment_time":"2018-03-06 09:35","status":1,"started_at":"2018-03-06 09:35","accepted_at":"2018-03-06 09:36:01","updated_at":"2018-03-06 09:36:01","created_at":"2018-03-06 09:36:01","id":574,"patient":{"id":91,"user_id":92,"birth_certificate_no":null,"blood_group":"A+","nhif_no":"","created_at":"2016-04-11 23:34:15","updated_at":"2017-01-16 11:45:26","user":{"id":92,"user_type_id":2,"first_name":"VARSHANI","last_name":"NARAN SHIVJ","gender":1,"date_of_birth":"1990-07-09","photo":"\/i\/users\/user-92.png","nationality":"Kenyan","national_id":"69855754","passport_no":"123a4","mobile_phone_number":"+254 706943466","home_phone_number":"+254 780 943466","residential_county":"Baringo","residential_address":"Nsdsdne","postal_address":"None","email":"reinhardodhiambo@gmail.com","marital_status":0,"occupation":"Doctor","dialing_code":"+254","created_at":"2016-04-11 23:34:15","updated_at":"2018-01-30 12:28:44","verified":1,"education_level":null,"can_post":0}}}
    

    This endpoint books appointment for patient in the Medbook database.

    HTTP Request

    POST /medbookafrica.com:8080/practice/walkin

    Close Appointment

    Store Close an Appointment, use the code below:

    require 'uri'
    require 'net/http'
    
    url = URI("/medbookafrica.com:8080/visit/428/close")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["authorization"] = 'Bearer -token-'
    request["cache-control"] = 'no-cache'
    
    response = http.request(request)
    puts response.read_body
    
    import requests
    
    url = "/medbookafrica.com:8080/visit/428/close"
    
    headers = {
        'authorization': "Bearer -token-",
        'cache-control': "no-cache"
        }
    
    response = requests.request("GET", url, headers=headers)
    
    print(response.text)
    
    ccurl -X GET \
      /medbookafrica.com:8080/visit/428/close \
      -H 'authorization: Bearer -token-' \
      -H 'cache-control: no-cache' \
    
    var settings = {
      "async": true,
      "crossDomain": true,
      "url": "/medbookafrica.com:8080/visit/428/close",
      "method": "GET",
      "headers": {
        "authorization": "Bearer -token-",
        "cache-control": "no-cache"
      }
    }
    
    $.ajax(settings).done(function (response) {
      console.log(response);
    });
    

    The above command returns a response like this:

    {"id":428,"patient_id":187,"practitioner_id":15,"practice_id":1,"appointment_time":"2017-10-06 10:15:19","appointment_reason":null,"prerequisites":null,"status":3,"cancel_reason":null,"reject_reason":null,"practitioner_reminder":null,"patient_reminder":null,"started_at":"2017-10-06 10:15:19","closed_at":{"date":"2018-03-06 23:24:16.000000","timezone_type":3,"timezone":"Africa\/Nairobi"},"next_appointment":null,"accepted_at":"2017-10-06 10:15:19","cancelled_at":null,"rejected_at":null,"dispense_status":0,"created_at":"2017-10-06 10:15:19","updated_at":"2018-03-06 23:24:16"}
    

    This endpoint ends a session for a visit.

    HTTP Request

    <GET> /medbookafrica.com:8080/visit/<APPOINTMENT_ID>/close

    URL Parameters

    Parameter Description
    APPOINTMENT_ID The ID of the visit

    Health Record

    Vital Sign

    To store vital-sign of particular patient in a specific visit, use the code below:

    require 'uri'
    require 'net/http'
    
    url = URI("/medbookafrica.com:8080/vitalsign/382/update")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Put.new(url)
    request["content-type"] = 'application/x-www-form-urlencoded'
    request["authorization"] = 'Bearer -token-'
    request["cache-control"] = 'no-cache'
    request.body = "alcohol_frequency=null&appointment_id=574&blood_group=A%2B&cigarette_frequency=null&created_at=2018-03-06%2009%3A36%3A01&diastolic_bp=99&heart_rate=66&height=800&history_of_presenting_illness=null&id=382&other_personal_history=null&physical_examination_findings=null&presenting_complaints=null&private_notes=null&respiratory_rate=44&se_other=null&systolic_bp=88&temperature=21&updated_at=2018-03-06%2009%3A36%3A01&weight=64"
    
    response = http.request(request)
    puts response.read_body
    
    import requests
    
    url = "/medbookafrica.com:8080/vitalsign/382/update"
    
    payload = "alcohol_frequency=null&appointment_id=574&blood_group=A%2B&cigarette_frequency=null&created_at=2018-03-06%2009%3A36%3A01&diastolic_bp=99&heart_rate=66&height=800&history_of_presenting_illness=null&id=382&other_personal_history=null&physical_examination_findings=null&presenting_complaints=null&private_notes=null&respiratory_rate=44&se_other=null&systolic_bp=88&temperature=21&updated_at=2018-03-06%2009%3A36%3A01&weight=64"
    headers = {
        'content-type': "application/x-www-form-urlencoded",
        'authorization': "Bearer -token-",
        'cache-control': "no-cache"
        }
    response = requests.request("PUT", url, data=payload, headers=headers)
    
    print(response.text)
    
    curl -X PUT \
      /medbookafrica.com:8080/vitalsign/382/update \
      -H 'authorization: Bearer -token-' \
      -H 'cache-control: no-cache' \
      -H 'content-type: application/x-www-form-urlencoded' \
      -d 'alcohol_frequency=null&appointment_id=574&blood_group=A%2B&cigarette_frequency=null&created_at=2018-03-06%2009%3A36%3A01&diastolic_bp=99&heart_rate=66&height=800&history_of_presenting_illness=null&id=382&other_personal_history=null&physical_examination_findings=null&presenting_complaints=null&private_notes=null&respiratory_rate=44&se_other=null&systolic_bp=88&temperature=21&updated_at=2018-03-06%2009%3A36%3A01&weight=64'
    
    var settings = {
      "async": true,
      "crossDomain": true,
      "url": "/medbookafrica.com:8080/vitalsign/382/update",
      "method": "PUT",
      "headers": {
        "content-type": "application/x-www-form-urlencoded",
        "authorization": "Bearer -token-",
        "cache-control": "no-cache",
      },
      "data": {
        "alcohol_frequency": "null",
        "appointment_id": "574",
        "blood_group": "A+",
        "cigarette_frequency": "null",
        "created_at": "2018-03-06 09:36:01",
        "diastolic_bp": "99",
        "heart_rate": "66",
        "height": "800",
        "history_of_presenting_illness": "null",
        "id": "382",
        "other_personal_history": "null",
        "physical_examination_findings": "null",
        "presenting_complaints": "null",
        "private_notes": "null",
        "respiratory_rate": "44",
        "se_other": "null",
        "systolic_bp": "88",
        "temperature": "21",
        "updated_at": "2018-03-06 09:36:01",
        "weight": "64"
      }
    }
    
    $.ajax(settings).done(function (response) {
      console.log(response);
    });
    

    The above command returns a response like this:

    {
      "alcohol_frequency":null
      "appointment":{"id": 574, "patient_id": 91, "practitioner_id": 15, "practice_id": 1, "appointment_time": "2018-03-06 09:35:00",…}
      "appointment_id":574
      "cigarette_frequency":null
      "created_at":"2018-03-06 09:36:01"
      "diastolic_bp":"99"
      "heart_rate":"66"
      "height":"800"
      "history_of_presenting_illness":null
      "id":382
      "other_personal_history":null
      "physical_examination_findings":null
      "presenting_complaints":null
      "private_notes":""
      "respiratory_rate":"44"
      "se_other":null
      "systolic_bp":"88"
      "temperature":"21"
      "updated_at":"2018-03-06 09:59:56"
      "weight":"64"
    }
    

    This endpoint saves vital sign of a particular visit.

    HTTP Request

    <PUT> /medbookafrica.com:8080/vitalsign/<VITAL_SIGN_ID>/update

    URL Parameters

    Parameter Description
    VITAL_SIGN_ID The ID of the vital sign

    Prescription

    Store prescription of particular patient in a specific visit, use the code below:

    require 'uri'
    require 'net/http'
    
    url = URI("/medbookafrica.com:8080/prescription/574/store")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Post.new(url)
    request["authorization"] = 'Bearer -token-'
    request["content-type"] = 'application/x-www-form-urlencoded'
    request["cache-control"] = 'no-cache'
    request.body = "administration_route=Oral%20(PO)&dosage=%22Twice%20daily%20(BD)%22&dosage_form=null&drug=panadol&duration=1&ingredients=null"
    
    response = http.request(request)
    puts response.read_body
    
    import requests
    
    url = "/medbookafrica.com:8080/prescription/574/store"
    
    payload = "administration_route=Oral%20(PO)&dosage=%22Twice%20daily%20(BD)%22&dosage_form=null&drug=panadol&duration=1&ingredients=null"
    headers = {
        'authorization': "Bearer -token-",
        'content-type': "application/x-www-form-urlencoded",
        'cache-control': "no-cache"
        }
    
    response = requests.request("POST", url, data=payload, headers=headers)
    
    print(response.text)
    
    curl -X POST \
      /medbookafrica.com:8080/prescription/574/store \
      -H 'authorization: Bearer -token-' \
      -H 'cache-control: no-cache' \
      -H 'content-type: application/x-www-form-urlencoded' \
      -d 'administration_route=Oral%20(PO)&dosage=%22Twice%20daily%20(BD)%22&dosage_form=null&drug=panadol&duration=1&ingredients=null'
    
    var settings = {
      "async": true,
      "crossDomain": true,
      "url": "/medbookafrica.com:8080/prescription/574/store",
      "method": "POST",
      "headers": {
        "authorization": "Bearer -token-",
        "content-type": "application/x-www-form-urlencoded",
        "cache-control": "no-cache"
      },
      "data": {
        "administration_route": "Oral (PO)",
        "dosage": "\"Twice daily (BD)\"",
        "dosage_form": "null",
        "drug": "panadol",
        "duration": "1",
        "ingredients": "null"
      }
    }
    
    $.ajax(settings).done(function (response) {
      console.log(response);
    });
    

    The above command returns a response like this:

    [
      {
        "id":104,
        "appointment_id":574,
        "drug":"panadol",
        "dosage":"Twice daily (BD)",
        "duration":"1",
        "cancelled":0,
        "date_made":"2018-03-06"
      }
    ]
    

    This endpoint saves prescription of a particular visit.

    HTTP Request

    <POST> /medbookafrica.com:8080/prescription/<APPOINTMENT_ID>/store

    URL Parameters

    Parameter Description
    APPOINTMENT_ID The ID of the visit

    Clinical Summary

    Store Clinical Summary of particular patient in a specific visit, use the code below:

    require 'uri'
    require 'net/http'
    
    url = URI("/medbookafrica.com:8080/appointment/428/clinicalsummary")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Post.new(url)
    request["authorization"] = 'Bearer -token-'
    request["content-type"] = 'application/x-www-form-urlencoded'
    request["cache-control"] = 'no-cache'
    request.body = "clinical_summary=Patient%20is%20recovering%20well"
    
    response = http.request(request)
    puts response.read_body
    
    import requests
    
    url = "/medbookafrica.com:8080/appointment/428/clinicalsummary"
    
    payload = "clinical_summary=Patient%20is%20recovering%20well"
    headers = {
        'authorization': "Bearer -token-",
        'content-type': "application/x-www-form-urlencoded",
        'cache-control': "no-cache"
        }
    
    response = requests.request("POST", url, data=payload, headers=headers)
    
    print(response.text)
    
    curl -X POST \
      /medbookafrica.com:8080/appointment/428/clinicalsummary \
      -H 'authorization: Bearer -token-' \
      -H 'cache-control: no-cache' \
      -H 'content-type: application/x-www-form-urlencoded' \
      -d clinical_summary=Patient%20is%20recovering%20well
    
    var settings = {
      "async": true,
      "crossDomain": true,
      "url": "/medbookafrica.com:8080/appointment/428/clinicalsummary",
      "method": "POST",
      "headers": {
        "authorization": "Bearer -token-",
        "content-type": "application/x-www-form-urlencoded",
        "cache-control": "no-cache"
      },
      "data": {
        "clinical_summary": "Patient is recovering well"
      }
    }
    
    $.ajax(settings).done(function (response) {
      console.log(response);
    });
    

    The above command returns a response like this:

    [
      {
        "id":104,
        "appointment_id":574,
        "drug":"panadol",
        "dosage":"Twice daily (BD)",
        "duration":"1",
        "cancelled":0,
        "date_made":"2018-03-06"
      }
    ]
    

    This endpoint saves Clinical Summary of a particular visit.

    HTTP Request

    <POST> /medbookafrica.com:8080/appointment/<APPOINTMENT_ID>/clinicalsummary

    URL Parameters

    Parameter Description
    APPOINTMENT_ID The ID of the visit

    Investigation

    To store Investigation in a specific visit, use the code below:

    require 'uri'
    require 'net/http'
    
    url = URI("/medbookafrica.com:8080/investigation/574/store")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Post.new(url)
    request["authorization"] = '-token-'
    request["content-type"] = 'application/x-www-form-urlencoded'
    request["cache-control"] = 'no-cache'
    request.body = "investigation_id=1703&results=Negative"
    
    response = http.request(request)
    puts response.read_body
    
    import requests
    
    url = "/medbookafrica.com:8080/investigation/574/store"
    
    payload = "investigation_id=1703&results=Negative"
    headers = {
        'authorization': "-token-",
        'content-type': "application/x-www-form-urlencoded",
        'cache-control': "no-cache"
        }
    
    response = requests.request("POST", url, data=payload, headers=headers)
    
    print(response.text)
    
    curl -X POST \
      /medbookafrica.com:8080/investigation/574/store \
      -H 'authorization: -token-' \
      -H 'cache-control: no-cache' \
      -H 'content-type: application/x-www-form-urlencoded' \
      -d 'investigation_id=1703&results=Negative'
    
    var settings = {
      "async": true,
      "crossDomain": true,
      "url": "/medbookafrica.com:8080/investigation/574/store",
      "method": "POST",
      "headers": {
        "authorization": "-token-",
        "content-type": "application/x-www-form-urlencoded",
        "cache-control": "no-cache"
      },
      "data": {
        "investigation_id": "1703",
        "results": "Negative"
      }
    }
    
    $.ajax(settings).done(function (response) {
      console.log(response);
    });
    

    The above command returns a response like this:

    [
      {
        "id":51,
        "appointment_id":574,
        "investigation_id":1703,
        "results":"Negative",
        "created_at":"2018-03-07 11:12:22",
        "updated_at":"2018-03-07 11:12:22",
        "investigation":{"id":1703,"name":"Malaria"}
      }
    ]
    

    This endpoint saves Investigation of a particular visit.

    HTTP Request

    <POST> /medbookafrica.com:8080/investigation/<APPOINTMENT_ID>/store

    URL Parameters

    Parameter Description
    APPOINTMENT_ID The ID of the visit

    Diagnosis

    Store Diagnosis of particular patient in a specific visit, use the code below:

    require 'uri'
    require 'net/http'
    
    url = URI("/medbookafrica.com:8080/appointment/574/healthcondition")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Post.new(url)
    request["authorization"] = 'Bearer -token-'
    request["content-type"] = 'application/x-www-form-urlencoded'
    request["cache-control"] = 'no-cache'
    request.body = "health_condition_id=838"
    
    response = http.request(request)
    puts response.read_body
    
    import requests
    
    url = "/medbookafrica.com:8080/appointment/574/healthcondition"
    
    payload = "health_condition_id=838"
    headers = {
        'authorization': "Bearer -token-",
        'content-type': "application/x-www-form-urlencoded",
        'cache-control': "no-cache"
        }
    
    response = requests.request("POST", url, data=payload, headers=headers)
    
    print(response.text)
    
    curl -X POST \
      /medbookafrica.com:8080/appointment/574/healthcondition \
      -H 'authorization: Bearer -token-' \
      -H 'cache-control: no-cache' \
      -H 'content-type: application/x-www-form-urlencoded' \
      -d health_condition_id=838
    
    var settings = {
      "async": true,
      "crossDomain": true,
      "url": "/medbookafrica.com:8080/appointment/574/healthcondition",
      "method": "POST",
      "headers": {
        "authorization": "Bearer -token-",
        "content-type": "application/x-www-form-urlencoded",
        "cache-control": "no-cache"
      "data": {
        "health_condition_id": "838"
      }
    }
    
    $.ajax(settings).done(function (response) {
      console.log(response);
    });
    

    The above command returns a response like this:

    [
      {
        "id":65,
        "appointment_id":574,
        "health_condition_id":838,
        "created_at":"2018-03-07 11:29:25",
        "updated_at":"2018-03-07 11:29:25",
        "health_condition":{"id":838,"dcode":"B500","name":"Plasmodium falciparum malaria with cerebral complications","icd10_block_id":1}
      }
    ]
    

    This endpoint saves Diagnosis of a particular visit.

    HTTP Request

    <POST> /medbookafrica.com:8080/appointment/<APPOINTMENT_ID>/healthcondition

    URL Parameters

    Parameter Description
    APPOINTMENT_ID The ID of the visit

    Errors

    The MPM API uses the following error codes:

    Error Code Meaning
    400 Bad Request -- Your request is invalid.
    401 Unauthorized -- Your API key is wrong.
    403 Forbidden -- The information requested is hidden for specific users only.
    404 Not Found -- The specified information could not be found.
    405 Method Not Allowed -- You tried to access an endpoint with an invalid method.
    406 Not Acceptable -- You requested a format that isn't json.
    410 Gone -- The information requested has been removed from our servers.
    418 I'm a teapot.
    429 Too Many Requests -- You're requesting too many information.
    500 Internal Server Error -- We had a problem with our server. Try again later.
    503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.