API Overview
All Public APIs are available as Common APIs. This section describes standards and formats used in these APIs for Integration with Warehouses and CCRL (Repository). All common APIs will be RESTFul services.
API Format
CDSL/CCRL System APIs will be published as stateless REST web service over HTTPS.
Below table depicts the URI pattern to be used while defining API end points:
API URI : /HTTP Method / POST / To submit data to Physical Deposit
Content Type / Content-Type- application/json, Accept- application/jsonetc. specific to API and depending on type of data exchanged
URL Description
https / All API will be published through HTTPS channel only.
HTTP protocol will be used in non-production environments
domain-name / Domain name of API gateway
version / Version of the API published by CCRL System. Version. E.g. 1.0
API Versioning
API published by CCRL System will be versioned to accommodate for future change
Below table depicts guideline of version number usage:
Version / Definition1.0 / First major version published to production
API Request Header and Payload
Below section defines possible types of request payload. Applicability of the request payload will depend on individual use case.
REQ1: Request with POST Method
HTTP Method / POSTContent-Type / application/json
Accept / application/json
Request Payload with encryption and without signature
{"requestHeader": {
"requestno": "0102201801",
"executiondate": "1516790750876",
"messagetype": "501",
"request_source": "WEBAPI",
"request_initiated": "504",
},
"details": {
"internaL_REFERENCE_NO": "214",
"auth_code": "584954",
"wsP_ID": "2000022",
"wH_ID": "1010508",
"request_Date": "1511940830267",
"neg_Receipt": true,
"assaying_required": true,
"comM_CODE": "5757",
"no_Of_Bags": 2000,
"baG_UOM": "KG",
"baG_SIZE": "60",
"qtY_UOM": "MT",
"baG_TYPE": "Cotton Bag 1",
"quality_Stand": "A",
"assaying_type": "S",
"tare_Weight": "1",
"est_value_deposit": "1",
"wBridge_Receipt_No": "1",
"wBridge_Name": "jj",
"wBridge_Net_Weight": "120",
"moisture_Deposit": "1",
"storage_charges": "1",
"handling_charges": "1",
"other_charges": "1",
"adv_amt_paid": "1",
"remaining_Charge": "1",
"storage_date_from": "1",
"storage_date_To": "1",
"shelf_life": "1",
"taC_flag": true,
"fire_Ins": true,
"flood_Ins": true,
"theft_Ins": true,
"burglary_Ins": true,
"misapp_Ins": true,
"rs_Ins": true,
"terro_Ins": true
},
"depositWhLot": {
"godown": "1",
"stack_no": "1",
"lot_no": "1",
"no_of_bag": "2000",
"sample_Id": "W0102",
"private_mark": "1"
},
"insuranceDetails": {
"insurance_company_code": "234143123",
"insurance_product_uin": "LIFEI",
"insurance_policy_no": "1",
"insurance_amt": "1",
"insurance_Val_from": "1",
"insurance_Val_To": "1"
}
}
Request Header
REST uses HTTP standard and hence metadata for a transaction can be embedded in HTTP headers. HTTP header should be limited to 8kB per field, and 100 fields per message.
The following are the list of attribute that will be passed in the HTTP Header to invoke API post authentication.
Attribute / Description / UsageRequestno / "0102201801" / Nos.
executiondate / "1516790750876" / Date
messagetype / 501 / Request Subbmit
request_source / "WEBAPI", / Source
request_initiated / "503", / WSP/WH/ASSAYER
API Response Payload
Below section defines format of response payload. All the JSON data part of response will be Base64 encoded. Format of response payload is as follows
{"result": {
"errorCode": "0000",
"errorDescription": "SUCCESS"
},
"targetUrl": null,
"success": true,
"error": null,
"unAuthorizedRequest": false,
"__abp": true
}
Error Codes
Error Code / Error Description0000 / "SUCCESS"
6001 / "Invalid Header or Header Missing";
6002 / "Invalid Request No."
6003 / "Invalid Execution Date"
6004 / "Invalid Message Type"
7005 / "Invalid client id"
7007 / "Invalid Commodity Code"
7009 / "Total Quantity Mismatch"
7010 / "Invalid Quantity UOM"
8003 / "Invalid WSP Id"
8004 / "Invalid WH ID / WH Reg. No."
8008 / "Invalid Bag Type"
8009 / "Invalid Number of pack / bags"
8010 / "Invalid Bag Size"
8011 / "Invalid Bag UOM"
8012 / "Invalid Quality Standard"
8013 / "Invalid Estimated Value at the time of deposit"
8014 / "Invalid Moisture at the time of deposit"
8019 / "Invalid Insurance Company Code"
8020 / "Invalid PUIN"
8021 / "Invalid Insurance Policy No"
8022 / "Invalid Insurance Coverage Amount"
9019 / "Bad Request"
9020 / "Invalid Request Source"
9021 / "Invalid Request Date"
9022 / "Invalid InternaL Reference No"
9023 / "Invalid Auth Code"
9028 / " Deposit Request WSP/WH Entry Already Present For This Internal Refrence No"
9024 / "Invalid StackNo"
9025 / "Invalid Godown"
9026 / "Invalid SampleId"
9027 / "Invalid No Of Bag"
8018 / "Invalid Lot Number"