Skip to content

Instantly share code, notes, and snippets.

@AdamJLemmon
Last active February 22, 2021 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AdamJLemmon/40c9f7087a2a8da045aebd537035c8f1 to your computer and use it in GitHub Desktop.
Save AdamJLemmon/40c9f7087a2a8da045aebd537035c8f1 to your computer and use it in GitHub Desktop.
const axios = require('axios');
const VCX_API_KEY = process.env.VCX_API_KEY;
const ORG_ID = process.env.ORG_ID;
const issueCredential = async () => {
const url = `https://api.trybe.id/provider/issueCredentials`;
const headers = {
'vcx-api-key': VCX_API_KEY
};
const credentialToIssue = {
name: 'GLOBAL TEACHER CERTIFICATION PROGRAM: MODULE 1 Understanding By Design',
recipient: {
name: 'First Last',
email: 'demo-holder@trybe.id'
},
transcript: [
{
name: 'FINAL GRADE',
grade: '100%',
},{
name: 'GLOBAL STANDARDS MET',
grade: 'D1KCPS1, DK1KSS2, D2PPLS5, D2PAAS8',
},{
name: 'VALID FOR',
grade: '5 years',
},{
name: 'COURSE ID',
grade: '123456',
},{
name: 'COURSE VERSIONING ID',
grade: 'TC2021.1.1V1',
},{
name: 'CEUs',
grade: '0.5',
},{
name: 'ASSESSMENT TYPE',
grade: 'end of course quiz',
},{
name: 'CONTENT CATEGORY 1',
grade: 'curriculum',
},{
name: 'CONTENT CATEGORY 2',
grade: 'assessment',
},{
name: 'CONTENT CATEGORY 3',
grade: 'null',
},
],
additionalData: {
imageUrl: 'https://s3.ca-central-1.amazonaws.com/trybe.public.assets/prod/GlobalEd+Foundation/hiyyVL3zQDCoyXP6FACx5Q.png',
description: 'The Understanding by Design (UbD) framework is a tool that you can use to ensure that learning activities and assessments are aligned with key learning outcomes. Sometimes referred to as backwards design, UbD can help you be more purposeful in your day-to-day and long-term planning. Join Dr. Jayme Linton as she provides an overview of the Understanding by Design framework and the benefits of using it as you plan your lessons. Discover how it can help you with curricular planning and alignment to focus instructional activities and promote better understanding. The next webinar, "Understanding by Design Framework: Planning Stages and Examples," explains the stages of the design process and shares tips and examples for using it.',
resources: [
{
id: 'D1KCPS1',
url: 'https://example.com/1'
},{
id: 'DK1KSS2',
url: 'https://example.com/2'
},{
id: 'D2PPLS5',
url: 'https://example.com/3'
},{
id: 'D2PAAS8',
url: 'https://example.com/4'
},
]
}
}
const body = {
orgId: ORG_ID,
credentials: [
credentialToIssue
],
};
const options = { headers };
const response = await axios.post(url, body, options);
const { savedCredentials } = response.data;
const { id } = savedCredentials[0]; // Each saved credential will have an id property
return id;
};
const run = async () => {
const id = await issueCredential();
const presentationUrl = `https://app.trybe.id/verifier?id=${id}`;
console.log({ presentationUrl });
};
run();
// VCX_API_KEY=663b4151-2b80-4d46-80c2-c9ae3728a134 ORG_ID=5fc7d717da620b611af5de4f node apiProvider.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment