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

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

Updated Javascript code snippet to start a submission

See merge request !172
parents 55cf11a2 7af7fa9e
No related branches found
No related tags found
1 merge request!172Updated Javascript code snippet to start a submission
......@@ -62,33 +62,37 @@ $ curl -L -X POST "$SUBMISSION_API/v1/submissions" \
<TabItem value="js">
```js
import axios from 'axios'
const 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 data = {
"destinationId": "879ee109-a690-4db8-ab32-424284184d7d",
const data = JSON.stringify({
"destinationId": DESTINATION_ID,
"announcedAttachments": [
"123ee109-a690-4db8-ab32-424284184d7d",
"456ee109-a690-4db8-ab32-424284184d7d"
"12399641-2067-4e8b-b049-91b2a6c90544"
],
"serviceType": {
"name": "Bauantrag",
"identifier": "urn:de:fim:leika:leistung:99010003001006"
}
}
const token = 'eyJhbGciOiJIUzI1NiJ9.eyJyYW5kb20iOiJyYW5kb20ifQ.lXckRWoWCUBGM4ACZ6wIhYqplJeSw0HMEfE91jD1JPU'
axios.post(
'/v1/submissions',
data
{
SUBMISSION_API,
timeout: 2000,
headers: {
'Authorization': `Bearer ${token}`
}
"name": "Antrag Name",
"identifier": "urn:de:fim:leika:leistung:99102013104000"
}
)
});
const config = {
method: 'post',
url: SUBMISSION_API + '/v1/submissions',
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