Badges
Build or integrate into your solution by using BWS Blockchain Badges API.
A badge is a digital representation of an accomplishment, skill, or authorization that an individual can earn and display. It acts as verifiable proof of the user's achievements and can be shared across various digital platforms, enhancing their professional and personal credibility.
In the context of the Open Badge standard, a badge is represented as a JSON object that includes key metadata such as the badge name, description, criteria for earning it, issuing organization, and recipient information. This standardized format ensures interoperability and enables badges to be verified, trusted, and recognized globally.
new_badge
Use this operation to create a Badge you can later use to certify recognition (award/credentials).
POST
https://api.bws.ninja/v1/call
Request Body
new_badge Method Parameters
name
string
Badge name (e.g. "Certified Data Analyst").
description
string
A description of the badge and what it represents.
criteria
string
Narrative describing the criteria to earn the badge.
image
base64
The image representing the badge as a base64 encoded string.
new_badge API Call Example
const fs = require('fs');
const axios = require('axios');
/* get the file representing the badge */
const fileData = fs.readFileSync('./files/badge.png');
/* encode file content to base64 */
const encodedData = fileData.toString('base64');
/* build request to use BWS Badges solution */
const request = {
{
"solution": "BWS.Blockchain.Badges",
"operation": "new_badge",
"parameters": {
"name": "Cloud Developer",
"description": "Recognizes professionals who have demonstrated expertise in cloud computing, including development and management of cloud applications and services.",
"criteria": "To earn this badge, complete an accredited course in cloud computing, demonstrate practical experience with a portfolio of cloud projects, and pass an exam on cloud computing concepts, service models, and development practices.",
"image": encodedData
}
}
/* call BWS API using Axios */
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.bws.ninja/v1/call',
headers: {
'X-Api-Key': 'XqaLg...... A5k2V729v', /* use your API key here! */
'Content-Type': 'application/json'
},
data : JSON.stringify(request)
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
new_badge Call Response
When the API call is successfully executed, it returns the badge id
, which is also the url you can use to fetch the badge image.
{
"statusCode": 200,
"info": {
"badgeId": "https://badges.staging.bws.ninja/certify-badge/badge/0c4078ab-8195-40fa-9d8d-0389b5547a86"
}
}
list_badges
Use this operation to get the list of all the badges you created.
POST
https://api.bws.ninja/v1/call
Request Body
solution*
string
BWS.Blockchain.Badges
operation*
string
list_badges
list_badges API Call Example
curl --location 'https://api.staging.bws.ninja/v1/call' \
--header 'X-Api-Key: XqaLg...729v' \
--header 'Content-Type: application/json' \
--data '{
"solution": "BWS.Blockchain.Badges",
"operation": "list_badges"
}'
list_badges Call Response
Once executed correctly, you will get a list of your badges, including the badge ID and the badge data.
{
"statusCode": 200,
"info": [
{
"@context": "https://w3id.org/openbadges/v2",
"type": "BadgeClass",
"id": "https://badges.staging.bws.ninja/certify-badge/badge/a51233aa-f3a9-43ac-b784-a0e72ec93036",
"name": "BWS Blockchain Developer Associate",
"description": "Recognizes professionals who have demonstrated expertise in blockchain, including development of applications using BWS cloud services.",
"image": "https://ipfs.bws.ninja/ipfs/QmXAkiFMsrMYQEiZE76oZ2hT4YEu97bvh8wdCnApvpFdeG",
"criteria": {
"narrative": "To earn the Certified Blockchain Professional - BWS Cloud Services badge, candidates must complete an approved training course, demonstrate practical experience with BWS cloud services, submit a project, and pass a comprehensive written and practical exam."
},
"issuer": {
"id": "https://badges.staging.bws.ninja/certify-badge/issuer/d9623c7f-41ee-4481-86d4-974a322210b3",
"name": "Blockchain Web Services",
"url": "https://www.bws.ninja",
"email": "[email protected]",
"type": "Issuer",
"verified": true
}
}
]
}
delete_badge
Use this API operation to delete an existing Badge.
POST
https://api.bws.ninja/v1/call
Request Body
solution*
string
BWS.Blockchain.Badges
operation*
string
delete_badge
delete_badge Method Parameters
badgeId
string
The badge ID to delete.
delete_badge API Call Example
const axios = require('axios');
/* build request to use BWS Badges solution */
const request = {
{
"solution": "BWS.Blockchain.Badges",
"operation": "delete_badge",
"parameters": {
"badgeId": "https://badges.staging.bws.ninja/certify-badge/badge/0c4078ab-8195-40fa-9d8d-0389b5547a86"
}
}
/* call BWS API using Axios */
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.bws.ninja/v1/call',
headers: {
'X-Api-Key': 'XqaLg...... A5k2V729v', /* use your API key here! */
'Content-Type': 'application/json'
},
data : JSON.stringify(request)
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
delete_badge Call Response
If the call succeeds and the badge gets deleted, you will get a standard 200 response.
{
"statusCode": 200
}
Last updated
Was this helpful?