- Authentication
- Verify your sender-email
- Request a Double-Opt-In
- Calls (Confirm - dApp) Confirm a Double-Opt-In via email/browser
- Calls (Verify - dApp)
- Export (Opt-Ins)
- Calls (Users)
List of JSON-RPC-API calls for the version 1.
All call urls in version 1 start with /api/v1/
You need a valid token for some of the RPC calls. Get the token with:
-
Url:
login
-
Parameter:
username
- Authentification Usernamepassword
- Authentification Password
-
Example request (cURL)
curl -H "Content-Type: application/json" -X POST -d '{"username":"admin","password":"password"}' http://localhost:3000/api/v1/login
- Response with valid credentials:
{
"status": "success",
"data": {
"authToken": "BbTe9w3DTZhPNriUWv1aU6a_FDawlkYjKMQ6I2t3V2k",
"userId": "8BxFMSZAc7Ez2iiR6"
}
}
You can authorize yourself now with the request headers:
X-Auth-Token: BbTe9w3DTZhPNriUWv1aU6a_FDawlkYjKMQ6I2t3V2k
X-User-Id: 8BxFMSZAc7Ez2iiR6
- Auth required: yes
- Role required:
none
- Url:
email/verify
- Method:
POST
- Query-Parameter:
sender_mail
- Email of the sender which should be verified over Doichain
- Example request:
curl -X POST -H "Content-Type: application/json" -H "X-Auth-Token:xzy789" -H "X-User-Id: abc123" http://localhost:3000/api/v1/email/verify -d '{"sender_mail":"bob@ci-doichain.org"}'
- Success-Response:
{
"status": "success",
"data": {
"txData": [...],
"status": "success",
"message": "Email address sent to validator(s)"
}
}
- Fail-Response:
{
"status": "fail",
"message": "Error: queryTxt ECONNREFUSED doichain.org [dns.getOptInKey.exception]"
}
- Auth required: yes
- Role required:
none
- Url:
opt-in
- Method:
POST
- Query-Parameter:
recipient_mail
- Email of the recipientsender_mail
- Email of the senderownerid
- (ADMIN ONLY) Userid of Opt-In-ownerdata
- (OPTIONAL) Recipient/Opt-In data json encoded stringscreenshot
- (OPTIONAL) Can store a screenshot of the subscriptiontemplateParam
- (OPTIONAL) Parameters to be added to template URLredirectParam
- (OPTIONAL) Parameters to be added to redirect URL
- Example request:
curl -X POST -H "Content-Type: application/json" -H "X-Auth-Token: TNjWzy1IaGLj9JrSWaUILMXYKEgVJFwXqp2M9AtcW7g" -H "X-User-Id: GQTKD2WiFKpx8Ndc2" http://localhost:3000/api/v1/opt-in -d '{"recipient_mail":"bob@ci-doichain.org", "sender_mail":"alice-xyz@ci-doichain.org"}'
- Success-Response:
{
"status" : "success",
"data" :
{
"id" : "optinId",
"status" : "success",
"message" : "Opt-In added"
}
}
- Fail-Response:
{
"status" : "fail",
"message" : "Errormessage"
}
- Auth required: No
- Url:
opt-in/confirm/:HASH
- Method:
GET
- Parameter:
HASH
- The internally generatet hash. It contains following information:opt-in id
- The database id of the opt-inconfirmation token
- A random generated token for the confirmation validationredirect url
- Url where the customer should be redirected to
- Description: verify on any known dApp all four parameters mandatory
- Auth required: No
- Url:
opt-in/verify
- Method:
GET
- Parameter:
recipient_mail
- Email of the recipientsender_mail
- Email of the sendername_id
- Blockchain entry name idrecipient_public_key
- Public key of the recipient
- verify email permission on own local dApp with sender email and recipients email only
- Auth required: Yes
- Role required:
admin
- Url:
opt-in/verify
- Method:
GET
- Parameter:
recipient_mail
- Email of the recipientsender_mail
- Email of the sender
- Auth required: yes
- Role required:
none
- Url:
export
- Method:
GET
- Query-Parameter:
status
- not yet workingownerid
- (ADMIN ONLY,OPTIONAL) userId of specific Opt-in owner
- Example request:
curl -X GET -H "X-Auth-Token: BbTe9w3DTZhPNriUWv1aU6a_FDawlkYjKMQ6I2t3V2k"-H "X-User-Id: 8BxFMSZAc7Ez2iiR6" http://localhost:3000/api/v1/export
- Success-Response:
{
"data": {
"status": "success",
"data": [
{
"_id": "EFxZCfAx7JqosrQ2E",
"ownerId": "qWgndg2gmsYZqCqin",
"createdAt": "2019-01-04T12:50:46.946Z",
"nameId": "60ADC586B8F03530100CA0BB524572B1664B8A43F7161B5F3D0197B3CD0ED2EB",
"confirmedAt": "2019-01-04T12:51:12.974Z",
"RecipientEmail": {
"email": "bob@ci-doichain.org"
},
"SenderEmail": {
"email": "alice-a@ci-doichain.org"
}
},
{
"_id": "z7HotbvPRG2tsuvd4",
"ownerId": "qWgndg2gmsYZqCqin",
"createdAt": "2019-01-04T12:51:19.115Z",
"nameId": "157305C71AE0C10A2C65B9D4CA19BF3104255DD307EAC4E6B32B8BAB422EC004",
"confirmedAt": "2019-01-04T12:51:38.012Z",
"RecipientEmail": {
"email": "bob@ci-doichain.org"
},
"SenderEmail": {
"email": "alice-b@ci-doichain.org"
}
}
]
}
- Fail-Response:
{
"status" : "fail",
"message" : "Errormessage"
}
- Auth required: Yes
- Role required:
admin
- Url:
users/getAll
- Method:
GET
- Parameter: none
- Success-Response:
{
"status": "success",
"data": [
{
"_id": "EdyRSPxxxxxxxxx",
"createdAt": "2019-05-18T07:25:42.250Z",
"services": {
"password": {
"bcrypt": "$2b$10$t6A.pvwMlTNM7qo5CGajvuLYzVT1melAEqckgmuZUBO/DRrCFeydW"
},
"resume": {
"loginTokens": [
{
"when": "2019-05-20T13:00:25.433Z",
"hashedToken": "a2mxkKnloFEtzoBzOwJrXXN2E4pYBYchZAaZpDmNJsI="
},
{
"when": "2019-05-21T09:29:12.274Z",
"hashedToken": "eoCq3aJ0keZaKhZXbnpGie1wxbLHvAEzeap/jsVXCt8="
},
{
"hashedToken": "zPY+rDq9BEsks0/oAGXn6ThoegMxPUL/+IdLcAZ2Gxc="
}
]
}
},
"username": "admin",
"emails": [
{
"address": "admin@xyz.org",
"verified": false
}
],
"roles": [
"admin"
]
}
]
- Auth required: Yes
- Role required:
admin
- Url:
users
- Method:
POST
- Parameter:
username
- Username of new useremail
- Email of new userpassword
- Password of new usermailTemplate
- (OPTIONAL) Form information as JSONsubject
- (OPTIONAL) Subject of the emailsenderName
- (OPTIONAL) Name of senderredirect
- (OPTIONAL) Redirect URLreturnPath
- (OPTIONAL) Return PathtemplateURL
- (OPTIONAL) Confirm mail template URL- text/plain
- text/html
- application/json
{"text":"","html":""}
- Example request:
curl -X POST -H "Content-Type: application/json" -H "X-Auth-Token: Nqa7aNhvE-e2ROE_kBWhUmHwpscqpEfS5J-nIbwEDv_" -H "X-User-Id: izGMmYSx5ZgSARBcd" http://localhost:3000/api/v1/users -d '{
"username":"peter",
"password":"balicoworking",
"email":"peter@bali-coworking.org",
"mailTemplate":{"subject":"Email permission request of Peter from Bali Coworking",
"redirect":"http://www.doichian.org",
"returnPath":"peter@bali-coworking.org",
"templateURL":"http://put-your-template-url.here.txt"}}'```
* Success-Response:
```json
{
"status" : "success",
"data" :
{
"userid" : "userid",
}
}
- Fail-Response:
{
"status" : "fail",
"message" : "Errormessage"
}
- Auth required: Yes
- Role required: none
- Url:
users/:userId
- Method:
PUT
- Parameter:
mailTemplate
- Changed form information as JSONsubject
- (OPTIONAL) Subject of the emailredirect
- (OPTIONAL) Redirect URLreturnPath
- (OPTIONAL) Return PathtemplateURL
- (OPTIONAL) Confirm mail template URL- text/plain
- text/html
- application/json
{"text":"","html":""}
- Note: This uses
PUT
method. It will overwrite all data inmailTemplate
! - Example request:
curl -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: BbTe9w3DTZhPNriUWv1aU6a_FDawlkYjKMQ6I2t3V2k" -H "X-User-Id: 8BxFMSZAc7Ez2iiR6" http://localhost:3000/api/v1/users/8BxFMSZAc7Ez2iiR6 -d '{"mailTemplate":{"subject":"changedSubject","redirect":"RedirectPage","returnPath":"ReturnAddress","templateURL":"changedTemplateURL"}}'
- Success-Response:
{
"status" : "success",
"data" :
{
"subject" : "changedSubject",
"templateURL" : "changedTemplateURL",
}
}
- Fail-Response:
{
"status" : "fail",
"message" : "Errormessage"
}
- Auth required: false
- Url:
doi-mail
- Method:
GET
- Query-Parameter:
name_id
- Blockchain entry name idsignature
- Signature created with:message
- Blockchain entry name idprivate key
- Confirm dApp private key