This page will contains the details of ONDC APIs Adaptors developed by NSDL eGov complied with Beckn Protocol
- Introduction
- ONDC API Adaptor Flow
- Deployment
- Postgres DB script
- Sample Postman Collection
- Configuration Details
- NSDL BG Configuration Details
- NSDL Sandbox
Sr.No. | Description | Date | Version |
---|---|---|---|
1. | Initial Version of Adaptor | 1.0 | |
2. | Change in adaptor with JPA and no JPA | 1.1 | |
3. | Change in adaptor to handle multi-tenancy | 25-Jan-2022 | 1.2 |
ONDC aims at promoting open networks developed on open-sourced methodology, using open specifications and open network protocols independent of any specific platform. NSDL eGov is helping building the ONDC API adaptors which is powered by Beckn Protocols for the netowrk participants who can easily run and integrate with their applications.
Two options are available:
- Default - Run it as a microservice. (It can be also docker enabled). Use OpenJDK11 and above
- Integration with Java application.
a. Put the jar file in maven dependency directory
b. Add package scan in pom.xml
Postgres DB scripts have been provided who wish to capture API transaction details in their database for audit.
Postman collection have been provided with sample json for each API services.
a. BAP - buyer node Configuration ("buyer node" compliant with Beckn BAP specifications)
1. If you are using beckn-multi-api-jpa-0.0.1.jar file then postgres properties can be passed.
2. If you are using beckn-multi-api-0.0.1.jar then you dont need to pass "db-postgres" property.
3. If you want to logs transaction in log file then "file" property needs to passed in configuration.
- Application.yml
a) server:
port: 8080
b) ehcache:
cacheregion:
beckn-api:
common-cache:
timetolive: 86400
entrycount: 1000
lookup-cache:
timetolive: 1800
entrycount: 1000
c) beckn:
persistence:
type: http|db-postgres|file
audit-schema-error: true
file-path: ./
entity:
type: buyer
Description :
-
port: it is server port number on which this jar will run
-
ehcache: The ehcache have been added which will cache the lookup api data fetched from the registry for the defined hours.
-
beckn.persistence.type: the pipe separated value for persistence strategy. Currently allowed values are http & db-postgres. Value http means response will be pushed to the url mentioned in the http_entity_endpoint parameter. If db-postgres used then response will be saved in database. Any other value is not allowed.
-
beckn.entity.type: the allowed values are bap or bpp. Depending on the value provided, jar will all auto configuration internally and start working accordingly . Any other value is not allowed.
- adaptor-config-bap.json
a) Now multiple buyers or sellers can be configured in the json config file of the adaptor. As a result of this change, the config json file is an array of configurations for each buyer/seller.
b) The password of the certificate(.p12) is now base-64 encoded in the config file. So please do not use plain text. First encode the given password and then use it. The adaptor will automatically decode it.
c) There is a change in adaptor-config-buyer.json & adaptor-config-seller.json for multi-tenancy. subscriber_id has been introduced in the root section: This is required for subscriber matching.
- adaptor-config-bap.json
{
"subscriber_id": "https://mock_bap1.com/",
...
},
[
{
"subscriber_id": "https://mock_bap1.com/",
"keyid": "buyer1.in|6",
"signing": {
"certificate_used": true,
"certificate_type": "pkcs12",
"certificate_alias": "tsa",
"certificate_path": "../network-participant.p12",
"certificate_pwd": "bnNkbDEy",
"private_key": ""
},
"api": [
{
"name": "search",
"http_entity_endpoint": "",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "select",
"http_entity_endpoint": "",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": false,
"set_authorization_header": false
},
{
"name": "cancel",
"http_entity_endpoint": "",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "confirm",
"http_entity_endpoint": "",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "init",
"http_entity_endpoint": "",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "rating",
"http_entity_endpoint": "",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "status",
"http_entity_endpoint": "",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "support",
"http_entity_endpoint": "",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "track",
"http_entity_endpoint": "",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "update",
"http_entity_endpoint": "",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "lookup",
"http_entity_endpoint": "https://pilot-gateway-1.beckn.nsdl.co.in/lookup",
"http_timeout": 9000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": false
}
]
},
{
"subscriber_id": "https://mock_bap2.com/",
"keyid": "buyer2.in|6",
"signing": {
"certificate_used": true,
"certificate_type": "pkcs12",
"certificate_alias": "tsa",
"certificate_path": "../network-participant.p12",
"certificate_pwd": "bnNkbDEy",
"private_key": ""
},
"api": [
{
"name": "search",
"http_entity_endpoint": "",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "select",
"http_entity_endpoint": "",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": false,
"set_authorization_header": false
},
{
"name": "cancel",
"http_entity_endpoint": "",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "confirm",
"http_entity_endpoint": "",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "init",
"http_entity_endpoint": "",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "rating",
"http_entity_endpoint": "",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "status",
"http_entity_endpoint": "",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "support",
"http_entity_endpoint": "",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "track",
"http_entity_endpoint": "",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "update",
"http_entity_endpoint": "",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "lookup",
"http_entity_endpoint": "https://pilot-gateway-1.beckn.nsdl.co.in/lookup",
"http_timeout": 9000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": false
}
]
}
]
Description: (As given in above example, add call back url configuration in array)
- keyid: it is the id that is used while registering as buyer to beckn.
- private_key: it is the private key of the buyer. This will be used while signing the authorization header.
- name: name of the api like search/select/init.
- http_entity_endpoint: http url for the entity endpoint of buyer.
- http_timeout: http call timeout in milliseconds .
- http_retry_count: http retry count in case of timeout error.
- header_validity: auth header validity in milliseconds.
- header_authentication: auth header validation check. Allowed values true or false. If false auth header validation will be skipped.
b. BPP - seller node Configuration ("seller node" compliant with Beckn BPP specifications)
1. If you are using beckn-multi-api-jpa-0.0.1.jar file then postgres properties can be passed.
2. If you are using beckn-multi-api-0.0.1.jar then you dont need to pass "db-postgres" property.
3. If you want to logs transaction in log file then "file" property needs to passed in configuration.
- Application.yml
a) server:
port: 8080
b) ehcache:
cacheregion:
beckn-api:
common-cache:
timetolive: 86400
entrycount: 1000
lookup-cache:
timetolive: 1800
entrycount: 1000
c) beckn:
persistence:
type: http|db-postgres|file
audit-schema-error: true
entity:
type: seller
Description :
-
port: it is server port number on which this jar will run
-
ehcache: The ehcache have been added which will cache the lookup api data fetched from the registry for the defined hours.
-
beckn.persistence.type: the pipe separated value for persistence strategy. Currently allowed values are http & db-postgres. Value http means response will be pushed to the url mentioned in the http_entity_endpoint parameter. If db-postgres used then response will be saved in database. Any other value is not allowed.
-
beckn.entity.type: the allowed values are bap or bpp. Depending on the value provided, jar will all auto configuration internally and start working accordingly . Any other value is not allowed.
- adaptor-config-bpp.json
a) Now multiple buyers or sellers can be configured in the json config file of the adaptor. As a result of this change, the config json file is an array of configurations for each buyer/seller.
b) The password of the certificate(.p12) is now base-64 encoded in the config file. So please do not use plain text. First encode the given password and then use it. The adaptor will automatically decode it.
c) There is a change in adaptor-config-buyer.json & adaptor-config-seller.json for multi-tenancy. subscriber_id has been introduced in the root section: This is required for subscriber matching.
- adaptor-config-bpp.json
{
"subscriber_id": "https://mock_bap1.com/",
...
},
Sample Json
[
{
"subscriber_id": "https://mock_bpp1.com/",
"keyid": "seller1.in|8",
"signing": {
"certificate_used": true,
"certificate_type": "pkcs12",
"certificate_alias": "tsa",
"certificate_path": "../network-participant.p12",
"certificate_pwd": "bnNkbDEy",
"private_key": ""
},
"api": [
{
"name": "search",
"http_entity_endpoint": "http://localhost:8089/seller/mock/search",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "select",
"http_entity_endpoint": "http://localhost:8089/seller/mock/select",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "cancel",
"http_entity_endpoint": "http://localhost:8089/seller/mock/cancel",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "confirm",
"http_entity_endpoint": "http://localhost:8089/seller/mock/confirm",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "init",
"http_entity_endpoint": "http://localhost:8089/seller/mock/init",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "rating",
"http_entity_endpoint": "http://localhost:8089/seller/mock/rating",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "status",
"http_entity_endpoint": "http://localhost:8089/seller/mock/status",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "support",
"http_entity_endpoint": "http://localhost:8089/seller/mock/support",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "track",
"http_entity_endpoint": "http://localhost:8089/seller/mock/track",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "update",
"http_entity_endpoint": "http://localhost:8089/seller/mock/update",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "lookup",
"http_entity_endpoint": "https://pilot-gateway-1.beckn.nsdl.co.in/lookup",
"http_timeout": 9000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": false
}
]
},
{
"subscriber_id": "https://mock_bpp2.com/",
"keyid": "seller2.in|8",
"signing": {
"certificate_used": true,
"certificate_type": "pkcs12",
"certificate_alias": "tsa",
"certificate_path": "../network-participant.p12",
"certificate_pwd": "bnNkbDEy",
"private_key": ""
},
"api": [
{
"name": "search",
"http_entity_endpoint": "http://localhost:8089/seller/mock/search",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "select",
"http_entity_endpoint": "http://localhost:8089/seller/mock/select",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "cancel",
"http_entity_endpoint": "http://localhost:8089/seller/mock/cancel",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "confirm",
"http_entity_endpoint": "http://localhost:8089/seller/mock/confirm",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "init",
"http_entity_endpoint": "http://localhost:8089/seller/mock/init",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "rating",
"http_entity_endpoint": "http://localhost:8089/seller/mock/rating",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "status",
"http_entity_endpoint": "http://localhost:8089/seller/mock/status",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "support",
"http_entity_endpoint": "http://localhost:8089/seller/mock/support",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "track",
"http_entity_endpoint": "http://localhost:8089/seller/mock/track",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "update",
"http_entity_endpoint": "http://localhost:8089/seller/mock/update",
"http_timeout": 8000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": true
},
{
"name": "lookup",
"http_entity_endpoint": "https://pilot-gateway-1.beckn.nsdl.co.in/lookup",
"http_timeout": 9000,
"http_retry_count": 0,
"header_validity": 600000,
"header_authentication": true,
"set_authorization_header": false
}
]
}
]
Description: (As given in above example, add call back url configuration in array)
- keyid: it is the id that is used while registering as seller to beckn.
- private_key: it is the private key of the seller. This will be used while signing the authorization header.
- name: name of the api like search/select/init.
- http_entity_endpoint: http url for the entity endpoint of seller.
- http_timeout: http call timeout in milliseconds .
- http_retry_count: http retry count in case of timeout error.
- header_validity: auth header validity in milliseconds.
- header_authentication: auth header validation check. Allowed values true or false. If false auth header validation will be skipped.
To get register at BG - gateway node/Registry node below field details required:
- subscriber_id
- Domain
- Entity Type (BAP/BPP)
- CallBack URL for On_Subscribe
- Signing Public Key
The end points for BG Gateway Node are as below: ("gateway node" compliant with Beckn gateway specifications)
a. Search : https://pilot-gateway-1.beckn.nsdl.co.in/search
b. On_search : https://pilot-gateway-1.beckn.nsdl.co.in/on_search
The end points for Registry Node are as below: ("registry node" compliant with Beckn registry specifications)
a. https://pilot-gateway-1.beckn.nsdl.co.in/subscribe
b. https://pilot-gateway-1.beckn.nsdl.co.in/lookup
Mail your details at : [email protected]
- BG - Gateway Node: As mentioned in section 7, provide details to get register with BG gateway node.
The end points for BG Gateway Node are as below:
a. Search : https://pilot-gateway-1.beckn.nsdl.co.in/search
b. On_search : https://pilot-gateway-1.beckn.nsdl.co.in/on_search
- Registry Node: As mentioned in section 7, provide details to get register with BG registry node.
The end points for Registry Node are as below:
a. https://pilot-gateway-1.beckn.nsdl.co.in/subscribe
b. https://pilot-gateway-1.beckn.nsdl.co.in/lookup