Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


The following is an example of using the Admin Interface API to automatically upload a Delft-FEWS configuration using an Azure DevOps pipeline. In a build pipeline a Config.zip is prepared as artifact.

In a release pipeline the config can be uploaded using the admin interface api using a bash script as in the following example.


Code Block
echo 'Uploading the Delft-FEWS Config file'
# login and store session cookie
curl -u $(ApiUser):$(ApiKey) --dump-header headers.txt --cookie cookie.txt --cookie-jar cookie.txt $(AdminInterfaceApi)/login
set $(cat headers.txt | grep X-CSRF-TOKEN:)
csrfToken=$2
echo 'uploading now ...'
curl -v -H "X-CSRF-TOKEN: ${csrfToken}"  --cookie cookie.txt -F file=@'$(System.DefaultWorkingDirectory)/_AzureDevopsRepo/drop/Config.zip' $(AdminInterfaceApi)/configmanagement/fewsconfig
curl --cookie cookie.txt $(AdminInterfaceApi)/systemstatus
curl --cookie cookie.txt $(AdminInterfaceApi)/logout