Skip to content

Instantly share code, notes, and snippets.

@vijendra
Forked from iros/API.md
Last active April 11, 2022 06:11
Show Gist options
  • Save vijendra/f10e9a75044e7a9f67f9723aeaf49dab to your computer and use it in GitHub Desktop.
Save vijendra/f10e9a75044e7a9f67f9723aeaf49dab to your computer and use it in GitHub Desktop.
AYUSLAB REST APIs

1. Ayuslab Order Create API

Rest API excpects JSON data as payload.

Packages array should contain name and code of test packages/special packages, if any.

Tests array should contain name and code of each prescribed test.

BillItems array can include billable items other than lab tests and packages, if any. For example, home collection charge, doctor consultation charges etc.

  • URL

    https://ayuslab.com/integration/orders

  • Method:

    POST

  • Data Params

    Example Json payload.

    {"bill_no":"", "bill_date":"2021-11-11T10:23:53.027Z", "created_at":"2021-11-11T10:23:53.027Z","mrn":"", "patient_name":"Ervik C", "gender":"male", "date_of_birth":"1982-05-10T00:00:00Z", "age":"39", "address":"JP NAGAR", "mobile_no":"8880016018", "email":"xyz@gmail.com", "doctor_name":"", "patient_type":"OP", "ip_no":"", "ward_no":"", "room_no":"", "is_active":true, "created_by":"", "Tests":[{"Name":"ESR", "Code":"995" }], "Packages": [{"Name":"Package 1", "Code":"1000" }], "BillItems":[{"Name":"COLLECTION CHARGES", "Code":"2001" }], "payment_type": "card", "amount_paid": "740.0", "card_no": "12345"}

    Required:

    patient_name=[string] bill_date=[string] patient_name=[string] gender=[string] date_of_birth=[string] mobile_no=[string] Tests=[array]

    Optional:

    bill_no=[alphanumeric] email=[string] address=[string] doctor_name=[string] Packages=[array] BillItems=[array]

  • Header

    X-Token=[token provided] Content-Type=[application/json]

  • Success Response:

    • Code: 200
      Content: { prescription_id : 3320402028096598 }
  • Error Response:

    • Code: 401 UNAUTHORIZED
      Content: { error : "Log in" }

    OR

    • Code: 422 UNPROCESSABLE ENTRY
      Content: { error : "Email Invalid" }

2. Get Report Dispatch Ids API

Returns the report dispatch Ids related to a prescription

  • URL

    https://ayuslab.com/integration/reports/report_dispatches.json

  • Method:

    GET

  • Data Params

    Example query parameter.

    prescription_id=3320402028096598

  • Header

    X-Token=[token provided] Content-Type=[application/json]

  • Success Response:

    • Code: 200
      Content: { "report_dispatch_ids": [4572463440280654] }
  • Error Response:

    • Code: 401 UNAUTHORIZED
      Content: { error : "Log in" }

3. Download Report API

Downloads the report

  • URL

    https://ayuslab.com/integration/reports/download.pdf

  • Method:

    GET

  • Data Params

    Example query parameters.

    prescription_id=3320402028096598 report_dispatch_id=4572463440280654

  • Header

    X-Token=[token provided] Content-Type=[application/json]

  • Success Response:

    • Code: 200
      PDF file is downloaded
  • Error Response:

    • Code: 401 UNAUTHORIZED
      Content: { error : "Log in" }

4. Cancel prescription/bill

Soft deletes prescription and bill

  • URL

    https://ayuslab.com//integration/orders/:id.json

  • Method:

    DELETE

  • Data Params

    Example id.

    id=3320402028096598

  • Header

    X-Token=[token provided] Content-Type=[application/json]

  • Success Response:

    • Code: 200
  • Error Response:

    • Code: 401 UNAUTHORIZED
      Content: { error : "Log in" }

5. Edit prescription/bill

updates prescription and bill

  • URL

    https://ayuslab.com//integration/orders/:id.json

  • Method:

    PUT

  • Data Params

    Example Json payload.

    { "bill_no":"", "bill_date":"2021-11-11T10:23:53.027Z", "created_at":"2021-11-11T10:23:53.027Z","mrn":"", "patient_name":"Ervik C", "gender":"male", "date_of_birth":"1982-05-10T00:00:00Z", "age":"39", "address":"JP NAGAR", "mobile_no":"8880016018", "email":"xyz@gmail.com", "doctor_name":"", "patient_type":"OP", "ip_no":"", "ward_no":"", "room_no":"", "is_active":true, "created_by":"", "Tests":[{"Name":"ESR", "Code":"995" }], "Packages": [{"Name":"Package 1", "Code":"1000" }], "BillItems":[{"Name":"COLLECTION CHARGES", "Code":"2001" }], "payment_type": "card", "amount_paid": "740.0", "card_no": "12345"}

    Required:

    patient_name=[string] bill_date=[string] patient_name=[string] gender=[string] date_of_birth=[string] mobile_no=[string] Tests=[array]

    Optional:

    bill_no=[alphanumeric] email=[string] address=[string] doctor_name=[string] Packages=[array] BillItems=[array]

  • Header

    X-Token=[token provided] Content-Type=[application/json]

  • Success Response:

    • Code: 200
  • Error Response:

    • Code: 401 UNAUTHORIZED
      Content: { error : "Log in" }

    OR

    • Code: 422 UNPROCESSABLE ENTRY
      Content: { error : "Email Invalid" }

6. Get Report Dispatches of a Date API

Returns the report dispatch Ids created in a date and relevant reference center

  • URL

    https://ayuslab.com/integration/reports/report_dispatches.json

  • Method:

    GET

  • Data Params

    Example query parameter.

    date = 30/03/2022 reference_center_id = 801

  • Header

    X-Token=[token provided] Content-Type=[application/json]

  • Success Response:

    • Code: 200
      Content: {"status":true,"report_dispatch_ids":[8482464797237005,7684246479723456]}
  • Error Response:

    • Code: 400
      Content: {"error":"Bad security token","status":400}

7. Get Report Details API

Returns the report parameters

  • URL

    https://ayuslab.com/integration/reports/:id.json

  • Method:

    GET

  • Data Params

    Example query parameters.

    report_id=2447742987942641

  • Header

    X-Token=[token provided] Content-Type=[application/json]

  • Success Response:

    • Code: 200
      {"report_dispatch_id":61917,"reports":[{"report_values":[],"test_name":" PROTEIN / CREATININE RATIO - URINE (RANDOM) ","report_format_type":"table_format","test_id":"144898"}]}
  • Error Response:

    • Code: 400
      Content: {"error":"Bad security token","status":400}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment