Skip to content

Public Verification ​

Public ang mga endpoint na ito at hindi nangangailangan ng authentication. Nagbibigay-daan ang mga ito sa sinuman na i-verify ang mga badge credential at kunin ang Open Badge v2.0 JSON data.

Lahat ng endpoint ay relative sa https://api.badges.ninja.

Kunin ang Issuer ​

Kunin ang Open Badge v2.0 Issuer Profile JSON para sa isang issuer.

GET /certify-badge/issuer/{guid}

Halimbawa ​

bash
curl https://api.badges.ninja/certify-badge/issuer/a1b2c3d4-e5f6-7890-abcd-ef1234567890

Response ​

json
{
  "@context": "https://w3id.org/openbadges/v2",
  "type": "Issuer",
  "id": "https://api.badges.ninja/certify-badge/issuer/a1b2c3d4-...",
  "name": "Acme Academy",
  "url": "https://acme.example.com",
  "email": "badges@acme.example.com",
  "verification": {
    "type": "hosted",
    "allowedOrigins": "api.badges.ninja"
  }
}

Kunin ang Badge ​

Kunin ang Open Badge v2.0 BadgeClass JSON para sa isang badge.

GET /certify-badge/badge/{guid}

Halimbawa ​

bash
curl https://api.badges.ninja/certify-badge/badge/b1c2d3e4-f5a6-7890-bcde-f12345678901

Response ​

json
{
  "@context": "https://w3id.org/openbadges/v2",
  "type": "BadgeClass",
  "id": "https://api.badges.ninja/certify-badge/badge/b1c2d3e4-...",
  "name": "JavaScript Fundamentals",
  "description": "Demonstrates proficiency in core JavaScript concepts",
  "criteria": {
    "narrative": "Completed the JavaScript Fundamentals course with a score of 80% or higher"
  },
  "image": "https://badges.ninja/images/{sha256}.png",
  "issuer": "https://api.badges.ninja/certify-badge/issuer/a1b2c3d4-..."
}

Kunin ang Credential ​

Kunin ang Open Badge v2.0 Assertion JSON para sa isang credential.

GET /certify-badge/award/{guid}

Halimbawa ​

bash
curl https://api.badges.ninja/certify-badge/award/c1d2e3f4-a5b6-7890-cdef-123456789012

Response ​

json
{
  "@context": "https://w3id.org/openbadges/v2",
  "type": "Assertion",
  "id": "https://api.badges.ninja/certify-badge/award/c1d2e3f4-...",
  "recipient": {
    "type": "email",
    "hashed": true,
    "identity": "sha256$..."
  },
  "badge": "https://api.badges.ninja/certify-badge/badge/b1c2d3e4-...",
  "issuedOn": "2025-01-15T00:00:00.000Z",
  "verification": {
    "type": "hosted"
  },
  "revoked": false
}

Kung na-revoke ang credential, may "revoked": true ang assertion at, kung may ibinigay na dahilan, isang "revocationReason" string:

json
{
  "revoked": true,
  "revocationReason": "Issued in error"
}

Ito ang Open Badges 2.0 na view ng revocation. Ipinapakita rin ang parehong revocation sa Open Badges 3.0 Verifiable Credential ng credential — tingnan ang Revocation (Bitstring Status List).

Mga Tala ​

  • Ang email ng recipient ay naka-hash (SHA-256) para sa privacy, ayon sa Open Badge spec.
  • Naka-cache ang mga response nang 5 minuto (Cache-Control: public, max-age=300). Mas maikling 30-segundong cache (max-age=30) ang gamit ng mga na-revoke na credential para mabilis kumalat ang revocation.

Kunin ang Share Text ng Credential ​

Kunin ang custom na share text para sa badge ng isang credential.

GET /certify-badge/award/{guid}/share-text

Halimbawa ​

bash
curl https://api.badges.ninja/certify-badge/award/c1d2e3f4-a5b6-7890-cdef-123456789012/share-text

Response ​

json
{
  "text": "I just earned the JavaScript Fundamentals badge! Check it out:"
}

Kung walang naka-set na custom share text, default na mensahe ang ibabalik.


Magpadala ng Credential Email (Public) ​

Magpadala ng credential notification email mula sa public endpoint. Ginagamit ito ng public share page.

POST /certify-badge/award/{guid}/send-email

Mga Parameter ​

ParameterUriKinakailanganPaglalarawan
recipientsstringOoListahan ng mga email address na pinaghihiwalay ng kuwit
messagestringHindiCustom na mensaheng isasama sa email

Halimbawa ​

bash
curl -X POST https://api.badges.ninja/certify-badge/award/c1d2e3f4-a5b6-7890-cdef-123456789012/send-email \
  -H "Content-Type: application/json" \
  -d '{
    "parameters": {
      "recipients": "colleague@example.com",
      "message": "Check out this badge!"
    }
  }'

Response ​

json
{
  "statusCode": 200,
  "info": "award sent"
}

Ito ang tanging endpoint na bumabalot ng resulta nito sa { "statusCode", "info" } envelope. Direktang ibinabalik ng lahat ng ibang endpoint ang payload nila.


I-verify ang Issuer ​

I-verify ang isang issuer sa pag-click ng verification link na ipinadala sa email ng issuer. Karaniwang binubuksan ito sa pamamagitan ng link sa verification email, hindi direktang tinatawag.

GET /certify-badge/verify-issuer/{guid}/{code}

Mga Parameter ​

ParameterUriPaglalarawan
guidstringAng GUID ng issuer
codestringAng verification code

Response ​

Nagbabalik ng HTML page na nagkukumpirma kung nagtagumpay o nabigo ang verification. Idinisenyo ang endpoint na ito para buksan sa browser.

badges.ninja Documentation