Earners can use claim codes to claim badges. For example, a claim code can be distributed at an event or given to the earner on completion of an achievement. The issuer site can facilitate issuing badges by allowing earners to submit claim codes.
NAME | VALUE |
---|---|
id |
integer - id from database entry |
code |
string - code used to claim a badge |
claimed |
boolean |
email |
string |
multiuse |
boolean - claim codes can be single use or multi-use |
badge |
badge claim code is for |
- Retrieve Claim Codes
GET /systems/:slug/badges/:slug/codes
GET /systems/:slug/issuers/:slug/badges/:slug/codes
GET /systems/:slug/issuers/:slug/programs/:slug/badges/:slug/codes
- Retrieve Specific Claim Code
GET /systems/:slug/badges/:slug/codes/:code
GET /systems/:slug/issuers/:slug/badges/:slug/codes/:code
GET /systems/:slug/issuers/:slug/programs/:slug/badges/:slug/codes/:code
- Retrieve Badge from Claim Code
GET /systems/:slug/codes/:code
GET /systems/:slug/issuers/:slug/codes/:code
GET /systems/:slug/issuers/:slug/programs/:slug/codes/:code
- Create Claim Code
POST /systems/:slug/badges/:slug/codes
POST /systems/:slug/issuers/:slug/badges/:slug/codes
POST /systems/:slug/issuers/:slug/programs/:slug/badges/:slug/codes
- Create Random Code
POST /systems/:slug/badges/:slug/codes/random
POST /systems/:slug/issuers/:slug/badges/:slug/codes/random
POST /systems/:slug/issuers/:slug/programs/:slug/badges/:slug/codes/random
- Delete Claim Code
DELETE /systems/:slug/badges/:slug/codes/:code
DELETE /systems/:slug/issuers/:slug/badges/:slug/codes/:code
DELETE /systems/:slug/issuers/:slug/programs/:slug/badges/:slug/codes/:code
- Claim a Code
POST /systems/:slug/badges/:slug/codes/:code/claim
POST /systems/:slug/issuers/:slug/badges/:slug/codes/:code/claim
POST /systems/:slug/issuers/:slug/programs/:slug/badges/:slug/codes/:code/claim
Retrieves all claim codes for a badge within a system, issuer or program.
GET /systems/:slug/badges/:slug/codes
GET /systems/:slug/issuers/:slug/badges/:slug/codes
GET /systems/:slug/issuers/:slug/programs/:slug/badges/:slug/codes
page
: - page of results to returncount
: - count of results to return per page
e.g. /systems/<slug>/badges/<slug>/codes?count=2&page=1
HTTP/1.1 200 OK
Content-Type: application/json
{
"claimCodes": [
{
"id": 1,
"code": "0fba9c4457",
"claimed": false,
"email": "[email protected]",
"multiuse": false
},
...
],
"badge": {
...
},
"pageData": {
"page": 1,
"count": 2,
"total": 4
}
}
pageData
is returned when pagination parameters are used.
- claimCodes
[ ]
- id
- code
- claimed
- multiuse
- badge
None
Retrieve the details for a specific claim code for a badge.
GET /systems/:slug/badges/:slug/codes/:code
GET /systems/:slug/issuers/:slug/badges/:slug/codes/:code
GET /systems/:slug/issuers/:slug/programs/:slug/badges/:slug/codes/:code
HTTP/1.1 200 OK
Content-Type: application/json
{
"badge": {
...
},
"claimCode": {
"id": 1,
"code": "2f91d622dd",
"claimed": false,
"email": null,
"multiuse": false
}
}
- badge
- claimCode
- id
- code
- claimed
- multiuse
- Claim code not found
HTTP/1.1 404 Not Found
Content-Type: application/json
{
"code": "ResourceNotFound",
"message": "Could not find the request claim code: <attempted-code>"
}
Retrieve the details for a badge using a claim code within a system, issuer or program context.
GET /systems/:slug/codes/:code
GET /systems/:slug/issuers/:slug/codes/:code
GET /systems/:slug/issuers/:slug/programs/:slug/codes/:code
HTTP/1.1 200 OK
Content-Type: application/json
{
"badge": {
"id": 1,
"slug": "badge-slug",
"name": "Badge Name",
"strapline": "Badge strapline.",
"earnerDescription": "Description for earners.",
"consumerDescription": "Description for consumers.",
"issuerUrl": "http://issuersite.com",
"rubricUrl": "http://issuersite.com/rubric",
"timeValue": 0,
"timeUnits": "minutes",
"evidenceType": "URL",
"limit": 0,
"unique": 0,
"created": "2014-05-21T19:22:09.000Z",
"imageUrl": "http://issuersite.com/badeg.jpg",
"type": "badge type",
"archived": false,
"system": {
...
},
"issuer": {
...
},
"program": {
...
},
"criteriaUrl": "http://issuersite.com/criteria",
"criteria": [ ],
"categories": [ ],
"tags": [ ],
"milestones": [ ],
"claimed": 0
}
}
- badge
- ...
- claimed
- Claim code not found
HTTP/1.1 404 Not Found
Content-Type: application/json
{
"code": "ResourceNotFound",
"message": "Could not find the request claim code: <attempted-code>"
}
Create a claim code for a badge.
POST /systems/:slug/badges/:slug/codes
POST /systems/:slug/issuers/:slug/badges/:slug/codes
POST /systems/:slug/issuers/:slug/programs/:slug/badges/:slug/codes
Requests can be sent as application/json
, application/x-www-form-urlencoded
or multipart/form-data
.
Parameters | Required | Description |
---|---|---|
code | required | The claim code you are creating. String with maximum length 255 characters. |
claimed | optional | Boolean indicator of whether the badge has been claimed. |
multiuse | optional | Boolean indicator of whether the badge is multiuse or not (single use). |
optional |
HTTP/1.1 201 Created
Content-Type: application/json
{
"status": "created",
"claimCode": {
"id": 1,
"code": "abcde12345",
"claimed": false,
"multiuse": false
},
"badge": {
...
}
}
- status
- claimCode
- id
- code
- claimed
- multiuse
- badge
- Invalid data
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"code": "ValidationError",
"message": "Could not validate required fields",
"details": [
{
"message": "String is not in range",
"field": "code",
"value": "..."
},
...
]
}
- Duplicate entry
HTTP/1.1 409 Conflict
Content-Type: application/json
{
"code": "ResourceConflict",
"error": "claimCode with that `code` already exists",
"details": {
...
}
}
Creates a random claim code - BadgeKit API will generate the claim code using a random algorithm.
POST /systems/:slug/badges/:slug/codes/random
POST /systems/:slug/issuers/:slug/badges/:slug/codes/random
POST /systems/:slug/issuers/:slug/programs/:slug/badges/:slug/codes/random
Requests can be sent as application/json
, application/x-www-form-urlencoded
or multipart/form-data
.
Parameters | Required | Description |
---|---|---|
claimed | optional | Boolean indicator of whether the badge has been claimed. |
multiuse | optional | Boolean indicator of whether the badge is multiuse or not (single use). |
optional |
HTTP/1.1 201 Created
Content-Type: application/json
{
"status": "created",
"claimCode": {
"id": 1,
"code": "abcde12345",
"claimed": false,
"multiuse": false
},
"badge": {
...
}
}
- status
- claimCode
- id
- code
- claimed
- multiuse
- badge
None
Delete a claim code.
DELETE /systems/:systemSlug/badges/:badgeSlug/codes/:code
DELETE /systems/:systemSlug/issuers/:issuerSlug/badges/:badgeSlug/codes/:code
DELETE /systems/:systemSlug/issuers/:issuerSlug/programs/:programSlug/badges/:badgeSlug/codes/:code
HTTP/1.1 200 OK
Content-Type: application/json
{
"status": "deleted",
"claimCode": {
"id": 1,
"code": "0fba9c4457",
"claimed": false,
"email": null,
"multiuse": false
},
"badge": {
"id": 1,
"slug": "badge-slug",
"name": "Badge Name",
"strapline": "Badge strapline.",
"earnerDescription": "Badge description for potential earners.",
"consumerDescription": "Badge description for consumers.",
"issuerUrl": "http://issuersite.com",
"rubricUrl": "http://issuersite.com/rubric",
"timeValue": 10,
"timeUnits": "minutes",
"evidenceType": "URL",
"limit": 5,
"unique": false,
"created": "2014-05-21T19:22:09.000Z",
"imageUrl": "http://issuersite.com/badge.png",
"type": "badge type",
"archived": false,
"criteriaUrl": "http://issuersite.com/criteria",
"criteria": [ ],
"categories": [ ],
"tags": [ ],
"milestones": [ ]
}
}
- status
- claimCode
- badge
- Claim code not found
HTTP/1.1 404 Not Found
Content-Type: application/json
{
"code": "ResourceNotFound",
"message": "Could not find claimCode field: `code`, value: <attempted-code>"
}
Claim a code.
POST /systems/:slug/badges/:slug/codes/:code/claim
POST /systems/:slug/issuers/:slug/badges/:slug/codes/:code/claim
POST /systems/:slug/issuers/:slug/programs/:slug/badges/:slug/codes/:code/claim
Requests can be sent as application/json
, application/x-www-form-urlencoded
or multipart/form-data
.
Parameters | Required |
---|---|
optional |
HTTP/1.1 200 OK
Content-Type: application/json
{
"status": "updated",
"claimCode": {
"id": 1,
"code": "abcde12345",
"claimed": false,
"email": null,
"multiuse": false
},
"badge": {
...
}
}
- status
- claimCode
- id
- code
- claimed
- multiuse
- badge
- Claim code already claimed (if single use)
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"code": "CodeAlreadyUsed",
"message": "Claim code `code` has already been claimed"
}
- Claim code not found
HTTP/1.1 404 Not Found
Content-Type: application/json
{
"code": "ResourceNotFound",
"message": "Could not find claimCode field: `code`, value: <attempted-code>"
}