github.com/vchain-us/vcn@v0.9.11-0.20210921212052-a2484d23c0b3/docs/user-guide/web-api.md (about) 1 # Web API 2 3 Notarization and authentication can also be used via a simple HTTP API. You can use: 4 5 - the CodeNotary hosted API at https://api.codenotary.it/ 6 - or a local web server exposing the same API by running the `vcn serve` command 7 8 All endpoints accept *Basic Auth* with user credentials (mantatory for notarization). 9 By default the login password is used as notarization password too. 10 If a custom notarization password is needed add the `x-notarization-password: <your_password>` header, otherwise if you have set an empty notarization password add the `x-notarization-password-empty: yes` header instead. 11 12 ## Notarization 13 14 **Endpoints** 15 - POST `/notarize` 16 - POST `/untrust` 17 - POST `/unsupport` 18 19 **Query params** 20 - `public` (if present and not empy will set the visibility to public, otherwise private) 21 22 **Body request** 23 ```js 24 { 25 "kind": "file", // string, optional 26 "name": "filename.pdf", // string 27 "hash": "......", // string 28 "size": 4096, // int, optional, must be equal or greater than zero 29 "contentType": "application/pdf", // string, optional 30 "metadata": { // object, optional 31 // ... 32 } 33 } 34 ``` 35 36 **Body response** 37 Same as authentication, see below. 38 39 ## Authentication 40 41 **Endpoint** 42 - GET `/authentication/<hash>` 43 44 **Query params** 45 - `signers` comma-separated list of SignerID(s) 46 - `org` organization ID 47 > `org` if present, takes precedence over `signers` 48 49 **Body response** 50 51 Results are indentical to ones of `vcn authenticate <asset> --output=json`. 52 > Status and level codes explanation can be found [here](notarization.md#Statuses) 53 54 Example of unverified asset: 55 ```json 56 { 57 "kind": "", 58 "name": "", 59 "hash": "", 60 "size": 0, 61 "contentType": "", 62 "url": "", 63 "metadata": null, 64 "visibility": "", 65 "createdAt": "", 66 "verificationCount": 0, 67 "signerCount": 0, 68 "signer": "", 69 "company": "", 70 "website": "", 71 "verification": { 72 "level": 0, 73 "owner": "", 74 "status": 2, 75 "timestamp": "" 76 } 77 } 78 ``` 79 80 Example of a trusted asset with all field populated: 81 ```json 82 { 83 "kind": "file", 84 "name": "vcn-v0.6.3-linux-amd64", 85 "hash": "cabea5ccdf9380775f1d40fd2a1baec8ee697ecf107f13283bcfc08bd0c9df65", 86 "size": 16433816, 87 "contentType": "application/x-executable", 88 "url": "...", 89 "metadata": { 90 "architecture": "x86_64", 91 "file": { 92 "arch": "X86_64", 93 "format": "ELF", 94 "platform": "GNU/Linux", 95 "type": "EXEC", 96 "x64": true 97 }, 98 "platform": "GNU/Linux", 99 "version": "0.6.3" 100 }, 101 "visibility": "PUBLIC", 102 "createdAt": "2019-09-25T14:01:23.159792", 103 "verificationCount": 3, 104 "signerCount": 1, 105 "signer": "leonardo@vchain.us", 106 "company": "vChain", 107 "website": "https://codenotary.io", 108 "verification": { 109 "level": 3, 110 "owner": "0x068e10d036175b874017320db5a9b852620679c4", 111 "status": 0, 112 "timestamp": "2019-09-25T14:01:20Z" 113 } 114 } 115 ```