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

Updated Javascript code snippet to upload an attachment

parent 2be7c574
No related branches found
No related tags found
1 merge request!173Updated Javascript code snippet to upload an attachment
......@@ -43,26 +43,32 @@ Unvollständige Einreichungen, die durch das sendende System (Onlinedienst) nich
<TabItem value="js">
```js
import axios from 'axios'
const SUBMISSION_API = "https://submission-api-testing.fit-connect.fitko.dev"
const token = "eyJhbGciOiJIUzI1NiJ9.eyJJc3N1Z...NL-MKFrDGvn9TvkA"
const submissionId = "63f0c991-0635-4e18-8a4b-fb0c01de9f5c"
const attachmentId = "90ae8309-2102-4e81-a325-ceda480d0e9d"
const data = "6r4H2H_WIzCv8Pd-uetmcbK...iVBKF3ylHRUahmZ"
axios.put(
`/v1/submissions/${submissionId}/attachments/${attachmentId}`,
data
{
SUBMISSION_API,
timeout: 2000,
headers: {
'Content-Type': 'application/jose',
'Authorization': `Bearer ${token}`,
}
}
)
var axios = require('axios');
var data = 'eyJhbGciOiJSU0Et...MRPcWqnLJDtp6ZA0Q';
const SUBMISSION_ID = "a562cf6a-3860-4a7e-96e3-1d01f8a5252d"
const ATTACHMENT_ID = "12399641-2067-4e8b-b049-91b2a6c90544"
const TOKEN = "eyJraWQiOiJHb2JOIiwi...Xh1TWcb2uhLVVnDBQ"
const SUBMISSION_API = "https://submission-api-testing.fit-connect.fitko.dev"
var config = {
method: 'put',
url: SUBMISSION_API + '/v1/submissions/' + SUBMISSION_ID + '/attachments/' + ATTACHMENT_ID,
headers: {
'Authorization': 'Bearer ' + TOKEN,
'Content-Type': 'application/jose'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
```
......
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