Would it be possible to make an API call from a Gitlab Pipeline job? I am investigating to see if we can replace the clicking of a button on our Swagger Ui and instead add the API call to a gitlab pipeline job to automate this.
Yes, you can make api calls from a Gitlab job using curl
very easily. Here is the simplest example of a Gitlab job with a curl
command to your Swagger endpoint:
stages:
- api_call
call_swagger_api:
stage: api_call
script:
- curl -X POST https://your-swagger-url.com/api/endpoint
Other methods like wget
will also work if you install them in your pipeline.