Skip to main content

Making Your First API Request

You'll make a request to the List EnvironmentsList Environment endpoint.

Tools Available

There are multiple tools to make API requests, a few are listed below.

Get a List of Environments

You'll use the command line for this example. If you are using Linux or Mac, you can continue.

Windows users, you might need to download cURL.

  1. Get your Access Token.

  2. Review the request URL for List Environments. https://app.coalescesoftware.io/api/v1/environments?detail=false.

    1. Server URL- https://app.coalescesoftware.io/api/v1
    2. Base URL- app.coalescesoftware.io. You'll need to update this before making a request to your app address. If you don't know yours, reach out to our support team for help. It's usually the URL you use to log in.
    3. Endpoint Path- The resource on the server you want to access with your request.
    4. Query Parameters - These help determine what data is returned. The are usually optional and can help filter large amounts of data. In our example, details is false, which means it will return abridged information about any environments.
    https://app.coalescesoftware.io/api/v1/environments?detail=false
    \_____________________________________ /\__________/ \__________/
    server URL endpoint query parameters
    \______________________/ path
    base URL
  3. Build your API request. Using cURL, the request type is GET, since we are only reading data.

    1. The header is application/json which tells the server to return the data as JSON. Coalesce returns and accepts data in JSON format.
    2. Another header is set for the Authorization as bearer type.
    3. You can copy this code and run it in your command line. Remember to replace your access token.
    curl --request GET \
    --url 'https://app.coalescesoftware.io/api/v1/environments?detail=false' \
    --header 'accept: application/json' \
    --header 'authorization: Bearer replace-with-your-token'
  4. Review your response. The information is returned in a JSON format to make it easy to use in other applications.

{
"data": [
{
"createdAt": "2024-03-19T16:36:11.409Z",
"createdBy": {
"id": "Owb7B45m0UNSL4OumkDNpcFifTA3",
"firstName": "Ada",
"lastName": "Lovelace"
},
"id": "12",
"name": "QA",
"status": "Waiting",
"project": "8398bbb9-5e0d-4b17-9f79-b65e3183b187"
},
{
"createdAt": "2024-04-12T19:18:47.876Z",
"createdBy": {
"id": "Owb7B45m0UNSL4OumkDNpcFifTA3",
"firstName": "Ada",
"lastName": "Lovelace"
},
"id": "17",
"name": "BUILD",
"status": "Waiting",
"project": "007e867f-806a-48f0-b766-f13789f30b25"
},
{
"createdAt": "2024-02-05T21:11:27.872Z",
"createdBy": {
"id": "Owb7B45m0UNSL4OumkDNpcFifTA3",
"firstName": "Ada",
"lastName": "Lovelace"
},
"id": "2",
"name": "Production",
"status": "Failed Deploy",
"project": "4502de52-048f-4ab3-bf17-5c58b2b5403c"
},
{
"createdAt": "2024-02-26T19:03:05.020Z",
"createdBy": {
"id": "Owb7B45m0UNSL4OumkDNpcFifTA3",
"firstName": "Ada",
"lastName": "Lovelace"
},
"id": "6",
"name": "QA",
"status": "Waiting",
"project": "4502de52-048f-4ab3-bf17-5c58b2b5403c"
},
{
"createdAt": "2024-02-27T19:06:38.317Z",
"createdBy": {
"id": "Owb7B45m0UNSL4OumkDNpcFifTA3",
"firstName": "Ada",
"lastName": "Lovelace"
},
"id": "8",
"name": "New Environment",
"status": "Waiting",
"project": "cfedac5c-1262-4ad9-9a00-313ec1156e69"
}
]
}

You've made your first request. Try changing details=true and compare the responses. Try making requests with other endpoints.