Open Badges Examples

Date Issued: 28 March 2022
Status: This is an informative IMS Global document that may be revised at any time.

IPR and Distribution Notice

Recipients of this document are requested to submit, with their comments, notification of any relevant patent claims or other intellectual property rights of which they may be aware that might be infringed by any implementation of the specification set forth in this document, and to provide supporting documentation.

IMS takes no position regarding the validity or scope of any intellectual property or other rights that might be claimed to pertain implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; neither does it represent that it has made any effort to identify any such rights. Information on IMS's procedures with respect to rights in IMS specifications can be found at the IMS Intellectual Property Rights webpage: http://www.imsglobal.org/ipr/imsipr_policyFinal.pdf .

Use of this specification to develop products or services is governed by the license with IMS found on the IMS website: http://www.imsglobal.org/speclicense.html.

Permission is granted to all parties to use excerpts from this document as needed in producing requests for proposals.

The limited permissions granted above are perpetual and will not be revoked by IMS or its successors or assigns.

THIS SPECIFICATION IS BEING OFFERED WITHOUT ANY WARRANTY WHATSOEVER, AND IN PARTICULAR, ANY WARRANTY OF NONINFRINGEMENT IS EXPRESSLY DISCLAIMED. ANY USE OF THIS SPECIFICATION SHALL BE MADE ENTIRELY AT THE IMPLEMENTER'S OWN RISK, AND NEITHER THE CONSORTIUM, NOR ANY OF ITS MEMBERS OR SUBMITTERS, SHALL HAVE ANY LIABILITY WHATSOEVER TO ANY IMPLEMENTER OR THIRD PARTY FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, DIRECTLY OR INDIRECTLY, ARISING FROM THE USE OF THIS SPECIFICATION.

Public contributions, comments and questions can be posted here: http://www.imsglobal.org/forums/ims-glc-public-forums-and-resources .

© 2022 IMS Global Learning Consortium, Inc. All Rights Reserved.

Trademark information: http://www.imsglobal.org/copyright.html

Overview

This document contains informative examples.

A basic example with no special processing is coded like this:

<pre class="example json">
  { ... }
</pre>

If you want to add a title to the example:

<pre class="example json" title="Sample">
  { ... }
</pre>

If you want to add schema validation, add the data-schema attribute:

Note

Data schema validation requires the model to be loaded in the CDM. Schema validation errors will appear above the example. See, for example, § A.3 Sample with schema validation.

<pre class="example json" title="Sample"
   data-schema="org.1edtech.ob.v3p0.address.class">
  { ... }
</pre>

If you want to add proofs, add the vc or vp class and optionally a data-vc-vm attribute with the verification method (public key).

Note

If there is an error generating the proof, the proof tabs will not appear and the error will appear in the browser console.

<pre class="example json vc" title="Sample"
   data-vc-vm="https://example.edu/jkws#key-1">
  { ... }
</pre>

Each example should be in its own <section></section> so it appears in the TOC.

<section>
  <h3>My Sample</h3>
  <pre class="example json vc" title="Sample"
    data-schema="org.1edtech.ob.v3p0.address.class"
    data-vc-vm="https://example.edu/jkws#key-1">
    { ... }
  </pre>
</section>

1. Examples

A. Sample Examples

A.1 Sample with no special processing

{
  "@context": [
    "https://www.w3.org/2018/credentials/v1",
    "https://imsglobal.github.io/openbadges-specification/context.json"
  ],
  "id": "http://example.edu/credentials/3732",
  "type": ["VerifiableCredential", "AssertionCredential"],
  "issuer": {
    "id": "https://example.edu/issuers/565049",
    "name": "Example University"
  },
  "issuanceDate": "2010-01-01T00:00:00Z",
  "credentialSubject": {
    "id": "did:example:ebfeb1f712ebc6f1c276e12ec21"
  },
  "credentialSchema": [{
    "id": "https://imsum2.herokuapp.com/jsonschema?classId=org.1edtech.ob.v3p0.assertioncredential.class",
    "type": "JsonSchemaValidator2019"
  }]
}

A.2 Sample with proofs applied

{
  "@context": [
    "https://www.w3.org/2018/credentials/v1",
    "https://imsglobal.github.io/openbadges-specification/context.json"
  ],
  "id": "http://example.edu/credentials/3732",
  "type": ["VerifiableCredential", "AssertionCredential"],
  "issuer": {
    "id": "https://example.edu/issuers/565049",
    "name": "Example University"
  },
  // typo
  "issuanceData": "2010-01-01T00:00:00Z",
  "credentialSubject": {
    "id": "did:example:ebfeb1f712ebc6f1c276e12ec21"
  },
  "credentialSchema": [{
    "id": "https://imsum2.herokuapp.com/jsonschema?classId=org.1edtech.ob.v3p0.assertioncredential.class",
    "type": "JsonSchemaValidator2019"
  }]
}

A.3 Sample with schema validation

Issue 1: Invalid JSON

NOTE: This example contains invalid JSON for org.1edtech.ob.v3p0.assertioncredential.class.

  • class: must have required property 'issuanceDate'
{
  "@context": [
    "https://www.w3.org/2018/credentials/v1",
    "https://imsglobal.github.io/openbadges-specification/context.json"
  ],
  "id": "http://example.edu/credentials/3732",
  "type": ["VerifiableCredential", "AssertionCredential"],
  "issuer": {
    "id": "https://example.edu/issuers/565049",
    "name": "Example University"
  },
  // Typo. Should be "issuanceDate".
  "issuanceData": "2010-01-01T00:00:00Z",
  "credentialSubject": {
    "id": "did:example:ebfeb1f712ebc6f1c276e12ec21"
  },
  "credentialSchema": [{
    "id": "https://imsum2.herokuapp.com/jsonschema?classId=org.1edtech.ob.v3p0.assertioncredential.class",
    "type": "JsonSchemaValidator2019"
  }]
}