Skip to content
Snippets Groups Projects
Commit bf80459b authored by Pascal Osterwinter's avatar Pascal Osterwinter
Browse files

Merge branch 'docs/3-js-snippet-update' into 'main'

Updated Javascript code snippet to submit a submission.

See merge request !174
parents a695d90f 3cb761e4
No related branches found
No related tags found
1 merge request!174Updated Javascript code snippet to submit a submission.
......@@ -46,27 +46,31 @@ $ curl -L -X PUT "$SUBMISSION_API/v1/submissions/$SUBMISSION_ID" \
<TabItem value="js">
```js
import axios from 'axios'
const axios = require('axios');
const data = JSON.stringify({
"encryptedMetadata": "eyJhbGciOi...H82t9kVSf3Q"
});
const SUBMISSION_ID = "a562cf6a-3860-4a7e-96e3-1d01f8a5252d"
const ATTACHMENT_ID = "12399641-2067-4e8b-b049-91b2a6c90544"
const TOKEN = "eyJraWQiOiJHb2JOIiwi...NtPaYZ8YWHXh1TWcb2uhLVVnDBQ"
const SUBMISSION_API = "https://submission-api-testing.fit-connect.fitko.dev"
const data = {
encryptedMetadata: 'mt2w8Pd-uetmcbKq0MqCw7zyBYj5HHDV1I7F0...',
encryptedData: 'eyJlbmMiOiJB...'
}
const token = 'eyJhbGciOiJIUzI1NiJ9.eyJyYW5kb20iOiJyYW5kb20ifQ.lXckRWoWCUBG...w0HMEfE91jD1JPU'
axios.put(
'/v1/submissions/63f0c991-0635-4e18-8a4b-fb0c01de9f5c',
data
{
SUBMISSION_API,
timeout: 2000,
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`,
}
}
)
const config = {
method: 'put',
url: SUBMISSION_API + '/v1/submissions/' + SUBMISSION_ID,
headers: {
'Authorization': 'Bearer ' + TOKEN,
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(response => console.log(JSON.stringify(response.data)))
.catch(error => console.log(error));
```
</TabItem>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment