NAV
bash

Introduction

Welcome to the Asalta API! You can use our API to access Asalta API endpoints, which can get information on asalta products.

Asalta uses API keys to allow access to the API. You can register a new Asalta API key at our developer portal.

We have language bindings in Shell! You can view code examples in the dark area to the right.

Authentication

To authorize, use this code:

# With shell, you can just pass the correct header with each request
curl "http://api.asalta.club/<apiEndpoint>"
  -H "Authorization: Bearer xxxxxxxxxxxxxxxxxx"

Make sure to replace xxxxxxxxxxxxxxxxxx with your access token.

Asalta API uses OAuth2 Protocol for API access. It expects for the API key to be included in all API requests to the server in a header that looks like the following:

Authorization: Bearer xxxxxxxxxxxxxxxxxx;

Content-Type: application/x-www-form-urlencoded;

Accept: application/json;

Link your application

OAuth2 exposes three specific endpoints, and one for metadata.

authorize_uri - http://api.asalta.club/auth

access_token_uri - http://api.asalta.club/auth/token

base_url - http://api.asalta.club/

OAuth2 Flow

  1. To start your application's connection to Asalta API, start by sending the user to the authorize_uri.
  2. The user will input their username and password to approve your application.
  3. After the user authorizes your application, our server will redirect your user back to the redirect_uri, along with a code you can exchange for an access_token. The code is valid for 30 seconds.
  4. Your application should then make an out-of-band request to the access_token_uri using the code our server provided.
  5. Our server returns an access_token, which completes the official OAuth2 flow.

Request body parameters

Parameter Type Description
client_id String The client's unique id/username for authorization.
client_secret String The client password for authorization.
redirect_uri Url Once application is authenticated User will redirected to this URI with code parameter to fetch access token

Response body parameters

Parameter Type Description
access_token String The access token issued by the auth server

Our Product

Asalta api provide 4 type product. One API key access to one product.

HRM

HRM provide two type of API key's.

Payroll

Payroll API provide monthly report

curl "http://api.asalta.club/report/payroll"
  -H "Content-Type:  application/x-www-form-urlencoded;
      Accept:  application/json;
      Authorization: Bearer xxxxxxxxxxxxxxxxxx"

The above command returns JSON structured like this:

{
    "payslip_date": "2015-07-01",
    "basic_salary": "49520.00",
    "gross_salary": "50270.00",
    "net_pay": "48508.50",
    "employer_cpf": "4293.00",
    "employee_cpf": "4260.00"
}

This endpoint retrieves all payroll.

HTTP Request

POST http://api.asalta.club/report/payroll

Query Parameters

Parameter Type Description
month Number If set to month, Ex: 12.
year Number If set to year, Ex: 2016.

Claims

Claims API provide monthly claim details.

curl "http://api.asalta.club/report/claims"
  -H "Content-Type:  application/x-www-form-urlencoded;
      Accept:  application/json;
      Authorization: Bearer xxxxxxxxxxxxxxxxxx"

The above command returns JSON structured like this:

{
    "Phone": {
        "total_expense": "200.00"
    },
  "Travelling": {
        "total_expense": "2000.50"
    }
}

This endpoint retrieves a claims.

HTTP Request

POST http://api.asalta.club/report/claims

URL Parameters

Parameter Type Description
month Number If set to month, Ex: 3.
year Number If set to year, Ex: 2016.

Roster Schedule

Roster Schedule API provide between two dates.

curl "http://api.asalta.club/report/rosterschedule"
  -H "Content-Type:  application/x-www-form-urlencoded;
      Accept:  application/json;
      Authorization: Bearer xxxxxxxxxxxxxxxxxx"

The above command returns JSON structured like this:

{
    {
      "branch": "Branch 3",
      "employees": [
        {
          "name": "George Smith",
          "shift": "Shift 6",
          "facility": "Parking",
          "working_date": "2016-06-05",
          "start_time": "10:00",
          "end_time": "14:30",
          "totaltime": "04.30",
          "status": "Working",
          "created_at": "2016-06-06 12:25:20"
        },
      ]
    },
    {
      "branch": "Branch 2",
      "employees": [
        {
          "name": "Charlie",
          "shift": "Shift 4",
          "facility": "Lodge",
          "working_date": "2016-06-05",
          "start_time": "06:30",
          "end_time": "09:30",
          "totaltime": "03.00",
          "status": "Working",
          "created_at": "2016-06-06 13:34:20"
        },
        {
          "name": "Charlie",
          "shift": "Shift 5",
          "facility": "Parking",
          "working_date": "2016-06-05",
          "start_time": "12:00",
          "end_time": "15:00",
          "totaltime": "03.00",
          "status": "Working",
          "created_at": "2016-06-06 13:37:04"
        }
      ]
    }
}

This endpoint retrieves a roster schedule.

HTTP Request

POST http://api.asalta.club/report/rosterschedule

URL Parameters

Parameter Type Description
startdate date If set to date(yyyy-mm-dd), Ex: 2016-07-01.
enddate date If set to date(yyyy-mm-dd), Ex: 2016-07-27.

CRM

CRM api provide report for invoices

curl "http://api.asalta.club/report/invoices"
  -H "Content-Type:  application/x-www-form-urlencoded;
      Accept:  application/json;
      Authorization: Bearer xxxxxxxxxxxxxxxxxx"

The above command returns JSON structured like this:

[
    {
        "invoice_no": "ASALTA2016001TECHNOLOGY",
        "organization": "Asalta",
        "name": "Jackson",
        "invoice_date": "2016-04-11",
        "due_date": "2016-04-11",
        "email": "example@gmail.com",
        "gst_amount": "0.00",
        "total_amount": "23232.00",
        "outstanding_amount": "0.00",
        "terms": "24",
        "payment_details": [
            {
                "payment_type": "Cheque",
                "paid_amount": "10.00",
                "paymentdue": "Partial Amount Paid",
                "paid_date": "2016-04-05"
            },
            {
                "payment_type": "Cheque",
                "paid_amount": "19536.00",
                "paymentdue": "Full Amount Paid",
                "paid_date": "2016-05-18"
            }
        ]
    },
    {
        "invoice_no": "ASALTA2016002TECHNOLOGY",
        "organization": "Asalta",
        "name": "Sam",
        "invoice_date": "2016-04-15",
        "due_date": "2016-04-15",
        "email": "example@example.com",
        "gst_amount": "0.00",
        "total_amount": "845452.00",
        "outstanding_amount": "845352.00",
        "terms": "7",
        "payment_details": [
            {
                "payment_type": "Cheque",
                "paid_amount": "100.00",
                "paymentdue": "Partial Amount Paid",
                "paid_date": "2016-05-18"
            }
        ]
    }
]

This endpoint retrieves all invoices.

HTTP Request

POST http://api.asalta.club/report/invoices

Query Parameters

Parameter Type Description
startdate date If set to date(yyyy-mm-dd), Ex: 2016-07-01.
enddate date If set to date(yyyy-mm-dd), Ex: 2016-07-27.

POS

POS api provide report for sales.

curl "http://api.asalta.club/report/sales"
  -H "Content-Type:  application/x-www-form-urlencoded;
      Accept:  application/json;
      Authorization: Bearer xxxxxxxxxxxxxxxxxx"

The above command returns JSON structured like this:

[
    {
        "sale_date": "2016-03-24 09:30:00",
        "customer_type": "Mail Customer",
        "customer_name": "Sam",
        "reference_no": "5555",
        "biller_id": "3",
        "discount": "0.00",
        "tax": "446.93",
        "shipping_charge": "0.00",
        "biller": "First Biller",
        "total": "3084.07",
        "grand_total": "3531.00",
        "status": "pending",
        "payment_status": "due",
        "terms": "0",
        "due_date": null,
        "total_items": "11",
        "paid": "0.00",
        "return_id": null,
        "surcharge": "0.00"
    },
    {
        "sale_date": "2016-04-02 18:36:34",
        "customer_type": "Walk-in Customer",
        "customer_name": "John",
        "reference_no": "SALE/POS/2016/04/0076",
        "biller_id": "3",
        "discount": "0.00",
        "tax": "85.06",
        "shipping_charge": "0.00",
        "biller": "First Biller",
        "total": "1314.94,
        "grand_total": "1400.00",
        "status": "completed",
        "payment_status": "paid",
        "terms": "0",
        "due_date": null,
        "total_items": "5",
        "paid": "1400.00",
        "return_id": null,
        "surcharge": "0.00",
        "payment_details": [
            {
                "payment_type": "cash",
                "payment_ref_no": "IPAY/2016/04/0160",
                "paid_amonut": "1400.00",
                "paid_date": "2016-04-02 18:36:34"
            }
        ]
    }
]

This endpoint retrieves a sales.

HTTP Request

POST http://api.asalta.club/report/sales

URL Parameters

Parameter Type Description
startdate date If set to date(yyyy-mm-dd), Ex: 2016-07-01.
enddate date If set to date(yyyy-mm-dd), Ex: 2016-07-27.

Procurement

Procurement api provide report for Invoice and Item master.

Invoices

Invoice API provide report of invoice between two date's.

curl "http://api.asalta.club/procurement/invoices"
  -H "Content-Type:  application/x-www-form-urlencoded;
      Accept:  application/json;
      Authorization: Bearer xxxxxxxxxxxxxxxxxx"

The above command returns JSON structured like this:

[
    {
        "invoice_no": "INV00000001",
        "contact_name": "Sam",
        "company_name": "Asalta Technologies",
        "email": "sam@asalta.com",
        "invoice_date": "2015-07-30",
        "discount_amount": "0.00",
        "billing_address": "Address 2",
        "gst_amount": "0.00",
        "terms": "12",
        "total_amount": "1452.00",
        "sales_status": "Draft",
        "purchase_status": null
    },
    {
        "invoice_no": "INV00000002",
        "contact_name": "John Doe",
        "company_name": "Asalta Technologies",
        "email": "johndoe@asalta.com",
        "invoice_date": "2015-07-30",
        "discount_amount": "0.00",
        "billing_address": "Address1",
        "gst_amount": "0.00",
        "terms": "24",
        "total_amount": "1452.00",
        "sales_status": "Waiting Customer Approval (sent)",
        "purchase_status": "New Request"
    }
]

This endpoint retrieves all invoices.

HTTP Request

GET http://api.asalta.club/procurement/invoices

Query Parameters

Parameter Type Description
startdate date If set to date(yyyy-mm-dd), Ex: 2016-07-01.
enddate date If set to date(yyyy-mm-dd), Ex: 2016-07-27.

Item Master

Item master provide 4 types of API.

Get All Item

This API provide find all item details

curl "http://api.asalta.club/procurement/items"
  -H "Content-Type:  application/x-www-form-urlencoded;
      Accept:  application/json;
      Authorization: Bearer xxxxxxxxxxxxxxxxxx"

The above command returns JSON structured like this:

[
    {
        "id": "25",
        "part_no": "AX166523",
        "itemname": "Item 1",
        "description": "This item is example 1",
        "warehouse": "Warehouse 3",
        "supplierpartnumber": "133",
        "partnumberurl": "http://example.com",
        "units": "Pieces",
        "price": "100",
        "model": "Model 1",
        "color": "Yellow",
        "contact_name": "Sam",
        "category_name": "Vegies"
    },
    {
        "id": "26",
        "part_no": "BX26532",
        "itemname": "Item 2",
        "description": "This item is example 2",
        "warehouse": "Warehouse 2",
        "supplierpartnumber": "123",
        "partnumberurl": "http://example.com",
        "units": "Pieces",
        "price": "100",
        "model": "Model 2",
        "color": "Green",
        "contact_name": "John Doe",
        "category_name": "Vegies"
    }
]

This endpoint retrieves all items.

HTTP Request

GET http://api.asalta.club/procurement/items

Get One Item

This API provide find one item details

curl "http://api.asalta.club/procurement/items?id=<id>"
  -H "Content-Type:  application/x-www-form-urlencoded;
      Accept:  application/json;
      Authorization: Bearer xxxxxxxxxxxxxxxxxx"

The above command returns JSON structured like this:

[
    {
        "id": "25",
        "part_no": "AX14375",
        "itemname": "Item 3",
        "description": "This item is example 3",
        "warehouse": "Warhouse 1",
        "supplierpartnumber": "153",
        "partnumberurl": "http://example.com",
        "units": "Pieces",
        "price": "100",
        "model": "Model 3",
        "color": "Red",
        "contact_name": "John Deo",
        "category_name": "BMW"
    }
]

This endpoint retrieves all items.

HTTP Request

GET http://api.asalta.club/procurement/items?id=<id>

Get Category

We are provide item category API. This list used in item create and update.

curl "http://api.asalta.club/procurement/category"
  -H "Content-Type:  application/x-www-form-urlencoded;
      Accept:  application/json;
      Authorization: Bearer xxxxxxxxxxxxxxxxxx"

The above command returns JSON structured like this:

[
    {
        "id": "2",
        "name": "Car"
    },
    {
        "id": "4",
        "name": "Bike"
    },
    {
        "id": "7",
        "name": "Bus"
    }
]

This endpoint retrieves all category.

HTTP Request

GET http://api.asalta.club/procurement/category

Item Create

This API used for item creation.

curl "http://api.asalta.club/procurement/item"
  -H "Content-Type:  application/x-www-form-urlencoded;
      Accept:  application/json;
      Authorization: Bearer xxxxxxxxxxxxxxxxxx"

The above command returns JSON structured like this:

{
    "message": "Item Submitted Successfully!"
}

This endpoint retrieves item created message.

HTTP Request

POST http://api.asalta.club/procurement/item

Parameter Type Description
part_no String If set to string value.
category Number If set to integer value.
item_name String If set to string value.
price Number If set to float value.

Item Update

This API used for item updation.

curl "http://api.asalta.club/procurement/item?id=<id>"
  -H "Content-Type:  application/x-www-form-urlencoded;
      Accept:  application/json;
      Authorization: Bearer xxxxxxxxxxxxxxxxxx"

The above command returns JSON structured like this:

{
    "message": "Item Submitted Successfully!"
}

This endpoint retrieves item updated message.

HTTP Request

POST http://api.asalta.club/procurement/item?id=<id>

Parameter Type Description
part_no String If set to string value.
category Number If set to integer value.
item_name String If set to string value.
price Number If set to float value.

Item Delete

This API used for item deletion.

curl "http://api.asalta.club/procurement/delete?id=<id>"
  -H "Content-Type:  application/x-www-form-urlencoded;
      Accept:  application/json;
      Authorization: Bearer xxxxxxxxxxxxxxxxxx"

The above command returns JSON structured like this:

{
    "message": "Item has been deleted Successfully!"
}

This endpoint retrieves item updated message.

HTTP Request

DELETE http://api.asalta.club/procurement/delete?id=<id>

Parameter Type Description
part_no String If set to string value.
category Number If set to integer value.
item_name String If set to string value.
price Number If set to float value.

Errors

The Asalta API uses the following error codes:

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