Certificate

These instructions will explain you about how to work with certificate upload and getting API.

Certificate model fields

Certificate model in database contains next fields:

  • Required:

    • id (uuid)

    • holder (ForeignKey to user, setting to Null, if user was deleted)

    • user_eth_address (CharField)

    • institution_title (CharField)

    • institution_link (URLField)

    • certificate_title (CharField)

    • granted_to_type (PositiveSmallIntegerField from 1 to 3)

    • ipfs_hash (CharField)

  • Optional:

    • program_title (CharField)

    • course_link (URLField)

    • industries (ManyToManyField)

    • skills (ManyToManyField)

    • score (FloatField)

    • duration (PositiveSmallIntegerField)

    • expiration_date (DateTimeField)

    • checksum_hash (CharField)

Certificate View Set

Create new certificate

Method create(self, request) acccepting POST requests with JSON information about new certificate.

Certificate file previously should be uploaded on IPFS.

Returns

  • If ok:

    • Code status 200

    • certificate_pk JSON with Certificate id on bdn

  • Else:

    • Code status 400

    • error JSON with errors

Example:

Get certificate info

Method retrieve(self, request, pk=None) acccepting GET requests with certificate id and reply with JSON information about certificate.

Returns

  • If ok:

    • Code status 200

    • JSON with Certificate data

Example

Get certificate list

Method list(self, request) acccepting GET requests reply with JSON information about certificates by issuer user.

Returns

  • If ok:

    • Code status 200

    • JSON with Certificates list data by issuer user

Example

Get certificates by learner

Method get_certificates_by_learner(self, request) acccepting GET requests with eth_address and reply with JSON information about certificates by learner ETH Address.

Returns

  • If ok:

    • Code status 200

    • JSON with Certificates list data by learner ETH Address

Example

Delete certificate by id

Method delete_by_id(self, request, pk=None) acccepting POST requests with certificate id in line.

Returns

  • If ok:

    • Code status 200

  • Else if user is not holder:

    • Code status 401

  • Else if certificate does not exist:

    • Code status 404

Example:

Last updated

Was this helpful?