Back to bcome.biz

How to integrate via API platform

Integrating BCome Extension in Your E-commerce

BCome has developed a custom script to seamlessly integrate key metrics into your platform. The API enables you to integrate BCome metrics directly into your system, offering flexibility without relying on the widget provided by BCome. This guide outlines the steps to manually install and configure the API extension.

Limitations

The API can be consumed from any platform or framework since it returns data in JSON format, ensuring compatibility with most programming languages.

Authentication

Authentication is managed using an API Key, generated uniquely for each user. If the API Key is compromised, it can be reset after notifying the client to ensure uninterrupted access. To regenerate your API Key, simply contact the BCome team, and they will assist you promptly.

How to Start

Begin improving your e-commerce by integrating our API. This will allow you to automate processes and optimize data management efficiently.

How to Implement the Script

The API makes the integration process highly flexible. Follow these steps:

Step 01 | Obtain Your API Key

Log into your account, navigate to the Digitization Integration section, and copy your unique API Key.

Step 02 | Make the API Call

Make a GET request to the specified URL provided by BCome. You’ll need to pass two query parameters:

  • hostname: Must be registered and approved in your account as an allowed host.
  • references: Specify the items for which you want to retrieve data.

Additionally, include a security header called securehash, which you must generate. Instructions on creating this hash are provided below.

Step 03 | Authenticate the API

Authenticate your API call by generating a hash, which concatenates the hostname and references parameters, using your API Key. This hash ensures secure communication and prevents tampering.

To maintain security, avoid exposing your API Key and always use HTTPS for encrypted data transmission.

Step 04 | Test the Integration

Run tests to verify that the API is functioning properly. Ensure all data is being transferred and that no errors are present.

Step 05 | Understand the Returned Data

The API returns specific data based on your plan and integration. Each data point relates to sustainability metrics like traceability, Product Lifecycle Management (PLM), Life Cycle Assessment (LCA), Circular Economy Indicators (CEI), and more!

📍 Note: If certain data points are missing, they may not be enabled in your current plan. To access additional features, ensure they are activated or contact support.

Security and Request

For added security, generate a token using the sha512 algorithm and pass it in the securehash header. Follow these steps to create the token:

1. Create the String to Encrypt
Concatenate the hostname, the + symbol, and the references parameter into a single string. Example: [hostname]+[references].

2. Encrypt the String with sha512
Encrypt this string using the sha512 algorithm and your API Key as the encryption key. Here’s an example in JavaScript: 

3. PHP example
Below is a PHP example to generate the hash, as PHP is one of the most common programming languages:

This process ensures that your API requests are secure and properly authenticated. If needed, examples in other programming languages can be provided.

How to Test API Integration Without Writing Code

If you’d like to test using Postman or another client without coding yet, you can generate the securehash using this website: HMAC Generator.

Step 01 | Generate the Secure Hash

To test the API without coding, use the HMAC Generator here. Select the hashing algorithm (e.g., SHA-512), input hostname+references, and enter the API Key as the secret. This will generate the securehash.

Step 02 | Set the API Request Parameters

Specify the API URL, and include the hostname and references as parameters. Add the securehash as a value in the request header to authenticate.

Step 03 | Retrieve the API Response

When the API request is executed, it will return a JSON object that contains multiple nested objects. These will detail the results based on the parameters provided:

  • PLM
  • LCA
  • Eco-Score
  • CEI
  • Others

The following image provides a complete example of the API response:

Additionally, here is a functional call example using CURL:

curl --location 'https://api.bcome.biz/api/articles/externalApi?hostname=www.demo.com&references=GAKNODRAT6270WW56' \
--header 'securehash: a5c5cd2791a73f75f04ae46b942198d4b738d3e7948b02aaf2070457b327c1c8dd6439318b4e81e1210a0fef2b953e74dcfae0761e09ec724ba89df0ef3634f9'

Related articles

API Parameter Communication: User Guide for Effective Integration

How to integrate the e-commerce in your website

How to integrate through SPA platform