Skip to content
This repository was archived by the owner on Feb 13, 2019. It is now read-only.

DECODEproject/credential-issuer-api-definition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Credential Issuer API definition

Swagger that defines how the credential issuer API should behave.

This is an API definition, the purpose is to ease the integration of the credential backend and frontend.

The code has been autogenerated from the swagger spec file as an example. Then the generated api has been modified to add some error cases.

Build and start generated API with Docker

Build the Docker image:

docker build -t credential-issuer-api .

Start the generated server:

docker run --rm -ti -p 8080:8080 credential-issuer-api

Checking that it works

Run the following curl request (any DNI value except "invalid" or "500" will be accepted).

curl -X POST \
  http://localhost:8080/issue-credential \
  -H 'Content-Type: application/json' \
  -d '{
	"dni": "12345678A"
}'

The response should be:

{
  "credential": "1234567890"
}

Checking an invalid ID case

Pass the string "invalid" as DNI to test this case.

curl -X POST \
  http://localhost:8080/issue-credential \
  -H 'Content-Type: application/json' \
  -d '{
	"dni": "invalid"
}'

The response should be:

{
  "error": "The specified ID is not valid"
}

Checking an internal error

Pass the string "500" as DNI to test this case.

curl -X POST \
  http://localhost:8080/issue-credential \
  -H 'Content-Type: application/json' \
  -d '{
	"dni": "500"
}'

The response should be:

{
  "error": "There was an error while issuing the credential"
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors