Skip to content

This repository will contains Beckn API L1 code base.

Notifications You must be signed in to change notification settings

UnitedWithCode/Beckn-API

 
 

Repository files navigation

ONDC API developed by NSDL eGov complied with Beckn Protocol

This page will contains the details of ONDC APIs Adaptors developed by NSDL eGov complied with Beckn Protocol

Table of contents

  1. Introduction
  2. ONDC API Adaptor Flow
  3. Deployment
  4. Postgres DB script
  5. Sample Postman Collection
  6. Configuration Details
  7. NSDL BG Configuration Details
  8. NSDL Sandbox

1. Introduction

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.

2. ONDC API Adaptor Flow

alt text

3. Deployment

Two options are available:

  1. Default - Run it as a microservice. (It can be also docker enabled)
  2. Integration with Java application.
    a. Put the jar file in maven dependency directory
    b. Add package scan in pom.xml

4. Postgres DB script

Postgres DB scripts have been provided who wish to capture API transaction details in their database for audit.

5. Sample Postman Collection

Postman collection have been provided with sample json for each API services.

6. Configuration Details

a. BAP - buyer node Configuration ("buyer node" compliant with Beckn BAP specifications)

  1. 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
                 audit-schema-error: true
          entity:
                     type: buyer

Description :

  1. port: it is server port number on which this jar will run

  2. ehcache: The ehcache have been added which will cache the lookup api data fetched from the registry for the defined hours.

  3. 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.

  4. 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.

    1. adaptor-config-bap.json
  Sample Json
        {
            "keyid": "nsdl.co.in|nsdl_bpp_1",
            "private_key": "XXXXXX",
            "api": [
              {
                "name": "on_search",
                "http_entity_endpoint": "http://localhost:8079/buyer/mock/on_search",
                "http_timeout": 1000,
                "http_retry_count": 3,
                "header_validity": 600000,
                "header_authentication": true
              },
               {
                "name": "on_select",
                "http_entity_endpoint": "http://localhost:8079/buyer/mock/on_select",
                "http_timeout": 1000,
                "http_retry_count": 3,
                "header_validity": 600000,
                "header_authentication": true
              },
              {
                "name": "lookup",
                "http_entity_endpoint": "https://pilot-gateway-1.beckn.nsdl.co.in/lookup",
                "http_timeout": 5000,
                "http_retry_count": 0,
                "header_validity": 600000,
                "header_authentication": true
              }
            ]
        }

Description: (As given in above example, add call back url configuration in array)

  1. keyid: it is the id that is used while registering as buyer to beckn.
  2. private_key: it is the private key of the buyer. This will be used while signing the authorization header.
  3. name: name of the api like search/select/init.
  4. http_entity_endpoint: http url for the entity endpoint of buyer.
  5. http_timeout: http call timeout in milliseconds .
  6. http_retry_count: http retry count in case of timeout error.
  7. header_validity: auth header validity in milliseconds.
  8. 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. 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
                 audit-schema-error: true
          entity:
                 type: seller

Description :

  1. port: it is server port number on which this jar will run

  2. ehcache: The ehcache have been added which will cache the lookup api data fetched from the registry for the defined hours.

  3. 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.

  4. 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.

    1. adaptor-config-bpp.json
Sample Json
       {
            "keyid": "nsdl.co.in|nsdl_bpp_1",
            "private_key": "XXXXXXX",
            "api": [
              {
                "name": "search",
                "http_entity_endpoint": "http://localhost:8079/seller/mock/search",
                "http_timeout": 1000,
                "http_retry_count": 3,
                "header_validity": 600000,
                "header_authentication": true
              },
              {
                "name": "select",
                "http_entity_endpoint": "http://localhost:8079/seller/mock/select",
                "http_timeout": 1000,
                "http_retry_count": 3,
                "header_validity": 600000,
                "header_authentication": true
              },
              {
                "name": "lookup",
                "http_entity_endpoint": "https://pilot-gateway-1.beckn.nsdl.co.in/lookup",
                "http_timeout": 5000,
                "http_retry_count": 0,
                "header_validity": 600000,
                "header_authentication": true
              }
            ]
        }

Description: (As given in above example, add call back url configuration in array)

  1. keyid: it is the id that is used while registering as seller to beckn.
  2. private_key: it is the private key of the seller. This will be used while signing the authorization header.
  3. name: name of the api like search/select/init.
  4. http_entity_endpoint: http url for the entity endpoint of seller.
  5. http_timeout: http call timeout in milliseconds .
  6. http_retry_count: http retry count in case of timeout error.
  7. header_validity: auth header validity in milliseconds.
  8. header_authentication: auth header validation check. Allowed values true or false. If false auth header validation will be skipped.

7. BG - gateway node/Registry node Configuration Details

To get register at BG - gateway node/Registry node below field details required:

  1. subscriber_id
  2. Domain
  3. Entity Type (BAP/BPP)
  4. CallBack URL for On_Subscribe
  5. 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 : dhirajp@nsdl.co.in

8. NSDL Sandbox

  1. 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

  1. 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

About

This repository will contains Beckn API L1 code base.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published