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

Updated Javascript code snippet to start a submission

parent 2be7c574
No related branches found
No related tags found
1 merge request!172Updated Javascript code snippet to start a submission
...@@ -59,33 +59,41 @@ $ curl \ ...@@ -59,33 +59,41 @@ $ curl \
<TabItem value="js"> <TabItem value="js">
```js ```js
import axios from 'axios' var axios = require('axios');
const DESTINATION_ID = "f7e70568-1fbc-476e-b1fa-a691ef205c7d"
const TOKEN = "eyJraWQfaWQiOiJiMj...ZPWT1NtPaYZ8YWHXh1TWcb2uhLVVnDBQ"
const SUBMISSION_API = "https://submission-api-testing.fit-connect.fitko.dev" const SUBMISSION_API = "https://submission-api-testing.fit-connect.fitko.dev"
const data = {
"destinationId": "879ee109-a690-4db8-ab32-424284184d7d", var data = JSON.stringify({
"destinationId": DESTINATION_ID,
"announcedAttachments": [ "announcedAttachments": [
"123ee109-a690-4db8-ab32-424284184d7d", "12399641-2067-4e8b-b049-91b2a6c90544"
"456ee109-a690-4db8-ab32-424284184d7d"
], ],
"serviceType": { "serviceType": {
"name": "Bauantrag", "name": "Antrag Name",
"identifier": "urn:de:fim:leika:leistung:99010003001006" "identifier": "urn:de:fim:leika:leistung:99102013104000"
}
}
const token = 'eyJhbGciOiJIUzI1NiJ9.eyJyYW5kb20iOiJyYW5kb20ifQ.lXckRWoWCUBGM4ACZ6wIhYqplJeSw0HMEfE91jD1JPU'
axios.post(
'/v1/submissions',
data
{
SUBMISSION_API,
timeout: 2000,
headers: {
'Authorization': `Bearer ${token}`
}
} }
) });
var config = {
method: 'post',
url: SUBMISSION_API + '/v1/submissions',
headers: {
'Authorization': 'Bearer ' + TOKEN,
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
``` ```
</TabItem> </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