Delegate List API

Hello Everybody.

Introduction

In the Harness Delegate page under Account Resources, we get the details of the running delegate and if we expand the tab for each delegate we can then see the details of each of the instances and the version they are on and if they are connected.

This is good to fetch the details until we grow the delegates by a significant amount on the Account at which point it would become tedious to track and find each delegate details. Having an API call to fetch these details would help reduce the time drastically.

Summary

We do have an internal Harness API which can help here, running the below API will return the details of the delegates and all the info related to it in a JSON format. You can also use JQ to format them better and make them readable.

curl 'https://app.harness.io/gateway/api/setup/delegates/ng/v2?routingId=<Acc_ID>&accountId=<Acc_ID>&pageIndex=0&pageSize=10' \
  -H 'authority: app.harness.io' \
  -H 'authorization: Bearer <Bearer Token>' \
  -H 'content-type: application/json' \
  --data-raw '{"filterType":"Delegate"}' \
  --compressed | jq

You will mainly need to replace the Placeholders for Account ID and the Bearer Token to get this Curl running and the output would look something like this :

1 Like