Web Service API Specification: CloudMA Integration Guide

This documentation provides a comprehensive guide for developers to integrate with the CloudMA web services. The specification covers methods for sales, purchasing, and stock synchronization


Document Overview

Version: 1.0


1. General Conventions and Authentication

To ensure secure and standardized communication, the API follows specific protocols

Security Token: Every request sent to the server must include the API token '38iGm3yI86Hw' as a POST parameter.

Data Format: All responses are issued in JSON format

Communication Protocol: The API uses standard HTTP methods, primarily POST, to transmit data

Response Policy: Only one response is issued per request from the server.


2. API Methods

A. Push Sale

This endpoint allows the client to push sales records to the server

Url: https://testdev.cloudma.app/api/push-sale
token (String): '38iGm3yI86Hw
customer_name (String): Name of the customer
customer_email (String): Email of the customer 
reference_no (String): Unique sale reference 
shipping_cost (Double): Cost of shipping 
total_discount (Double): Total discount applied 
grand_total (Double): Grand total of the sale 
items (Array): A collection of objects containing code (String), qty (Integer), discount (Double), total (Double), and unit_price (Double)

Note: Developers must ensure the grand_total matches the sum of individual item totals.


B. Push Purchase (GRN)

This endpoint is used for recording purchase data/Goods Received Notes.

URL: https://testdev.cloudma.app/api/push-purchase 
token (String): '38iGm3yI86Hw' 
reference_no (String): Purchase reference identifier
items (Array): Contains code, qty, discount, total, and unit_cost (Double)

Note: The grand_total must match the sum of purchase item totals.


C. Sync Stock

Used to retrieve current stock levels for active products

URL: https://testdev.cloudma.app/api/sync-stock 31

Method: POST

Parameter: Requires only the security token.

Response: Returns an array containing the code, name, and qty of all active products.


3. Status Codes and Error Handling

The API utilizes standard HTTP status codes.

Status Code

Description

Meaning

200

OK

Success

201

Created

Resource successfully created

400

Bad Request

Error in request (e.g., Product Not Found)

401 / 403

Unauthorized / Forbidden

Authentication failure or insufficient permissions

404

Not Found

Resource not found

500

Internal Server Error

Server-side error

Support Hotlines

For urgent technical assistance, contact our CloudMA Support Hotlines:

Download Version 1.1 Document