Hyperledger Supply Chain
  • Hyperledger Supply-Chain
  • Hyperledger Overview
  • Business Case
  • Implementation
    • System Architecture
    • Governance
    • API Reference
    • Deploy/run dApp
    • User Interface
    • Development Tools
  • Contact
  • Appendix
  • MIT License
Powered by GitBook
On this page
  • Get Product
  • Create Product
  • Get Product With History
  • Product Exists
  • Ship Product

Was this helpful?

  1. Implementation

API Reference

Get Product

GET https://localhost:3003/getProduct/:id

Retrieves information about the product.

Path Parameters

Name
Type
Description

id

string

ID of the product to retieve

{
    "result": {
        "barcode": "1234567890",
        "batchQuantity": 1000,
        "category": "Fruits",
        "componentProductIds": [],
        "expirationDate": "2022-06-24T18:25:43.511Z",
        "id": "1001",
        "locationData": {
            "current": {
                "arrivalDate": "2021-06-30T18:00:58.511Z",
                "location": "Markham Farm, Marham, ON, Canada"
            },
            "previous": []
        },
        "misc": "{}",
        "name": "Apples",
        "placeOfOrigin": "Markham, ON, Canada",
        "productionDate": "2021-06-24T18:25:43.511Z",
        "unitPrice": "$5.00",
        "unitQuantity": 300,
        "unitQuantityType": "mg",
        "variety": null
    }
}

Create Product

POST https://localhost:3003/createProduct

Creates a new product.

Request Body

Name
Type
Description

locationData.previous

array

locationData.current

object

variety

string

unitQuantityType

string

E.g., mg, liters etc.

unitQuantity

number

unitPrice

string

Currency symbol formatted amount

productionDate

string

ISO Date

placeOfOrigin

string

name

string

misc

object

Miscellaneous information

expirationDate

string

ISO Date

componentProductIds

array

category

string

batchQuantity

number

barcode

string

id

string

{
    "result": {
        "type": "Buffer",
        "data": []
    }
}

Get Product With History

GET https://localhost:3003/getProductWithHistory/:id

Retrieves the product data together with its history.

Path Parameters

Name
Type
Description

id

string

ID of product to retrieve

{
    "result": {
        "barcode": "1234567890",
        "batchQuantity": 1000,
        "category": "Fruits",
        "componentProductIds": [],
        "expirationDate": "2022-06-24T18:25:43.511Z",
        "id": "1001",
        "locationData": {
            "current": {
                "arrivalDate": "2021-07-07T01:11:18.409Z",
                "location": "Waterloo, ON"
            },
            "previous": [
                {
                    "arrivalDate": "2021-06-30T18:00:58.511Z",
                    "location": "Markham Farm, Marham, ON, Canada"
                }
            ]
        },
        "misc": "{}",
        "name": "Apples",
        "placeOfOrigin": "Markham, ON, Canada",
        "productionDate": "2021-06-24T18:25:43.511Z",
        "unitPrice": "$5.00",
        "unitQuantity": 300,
        "unitQuantityType": "mg",
        "variety": null,
        "componentProducts": []
    }
}

Product Exists

GET http://localhost:3003/productExists/:id

Verifies if a product exists or not.

Path Parameters

Name
Type
Description

id

string

Product ID to check

{
    "exists": "false"
}

Ship Product

POST http://localhost:3003/shipProduct

Sends the product to a new location.

Request Body

Name
Type
Description

arrivalDate

string

ISO Date

newLocation

string

productId

string

{
    "status": "Transaction submitted.",
    "txId": ""
}
PreviousGovernanceNextDeploy/run dApp

Last updated 3 years ago

Was this helpful?