# API

## Curl

Curl syntax to get token.

```
curl -X POST -d 'grant_type=client_credentials&client_id=[APP_ID]&client_secret=[PASSWORD]&resource=https%3A%2F%2Fmanagement.azure.com%2F' https://login.microsoftonline.com/[TENANT_ID]/oauth2/token
```

Example.

```
curl -X POST -d 'grant_type=client_credentials&client_id=4g70a597-88b7-41f9-bfe9-9yf4486c9563&client_secret=BdtWthpHRW/J1.Ia]oE7H3a5[/ssj@Au&resource=https%3A%2F%2Fmanagement.azure.com%2F' https://login.microsoftonline.com/82bf54ae-4197-4ff2-b1a1-1fd0ca92a6c3/oauth2/token
```

Get the `access_token` from the output.

Then use the following syntax.

```
curl -X GET -H "Authorization: Bearer [TOKEN]" -H "Content-Type: application/json" https://management.azure.com/subscriptions/[SUBSCRIPTION_ID]/providers/Microsoft.Web/sites?api-version=2016-08-01
```

Example.

```
curl -X GET -H "Authorization: Bearer eyJDSAFdsfEWFV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IllNRUxIVDBndmIwbXhvU0RvWWZvbWpxZmpZVSIsImtpZCI6IllNRUxIVDBndmIwbXhvU0RvWWZvbWpxZmpZVSJ9.eyJhdWQiOiJodHRwczovL21hbmFnZW1lbnQuYXp1cmUuY29tLyIsImlzcyI6Imh0dHBzOi8vc3RzLndpbmRvd3MubmV0L2NlZjA0YjE5LTc3NzYtNGE5NC1iODliLTM3NWM3N2E4ZjkzNi8iLCJpYXQiOjE1ODYzNTUyMjQsIm5iZiI6MTU4NjM1NTIyNCwiZXhwIjoxNTg2MzU5MTI0LCJhaW8iOiI0MmRnWU5DNnE3cGdTaSszS1ArNUZPYk5WakgxQUE9PSIsImFwcGlkIjoiM2Y3MGEyNjMtNzdiNy00MWY5LWJmZTktOWZiNDQ4NmM1MDYzIiwiYXBwaWRhY3IiOiIxIiwiaWRwIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvY2VmMDRiMTktNzc3Ni00YTk0LWI4OWItMzc1Yzc3YThmOTM2LyIsIm9pZCI6ImFiNjkzNzRmLTRlYzgtNDFkMS1iYjE1LWQwMTdjMTMzZWUzZiIsInN1YiI6ImFiNjkzNzRmLTRlYzgtNDFkMS1iYdASDFdfewfHTHRThtDSFSADFmNlZjA0YjE5LTc3NzYtNGE5NC1iODliLTM3NWM3N2E4ZjkzNiIsInV0aSI6IkpyOEFmX1hUc0VpUUNGTEpxTE5PQUEiLCJ2ZXIiOiIxLjAifQ.KowRMIrbtkiDYYs-UntjCd_ny7TqamwA8dM6zpQ41YRUMttnQnDhORo_GHtdD4645pIDJpA0_Tupx16nt7qsiiYd7dk8TUWwg631uJ86vr-8aKQ4g_fJ85KKqvPwwmUnQ5CoRo7_rarbzCfzRvfR39VfUARJRRpfHwkIrl6JUckKhsvZgsKg9VqO7Hmu1cxRRSYThA92VzfwqXGxJU0LtBf6aXOI3J18oNMNxljdhT9F6WEowTOuSVA2zQSLo2FJ2SZRgGEyOyo0XvtjJGrhsiKxkYcq5ueWkDaKpM_yo_rSGZ1kTec1R6ljSADFasdfdsFDEdfasdFsdf" -H "Content-Type: application/json" https://management.azure.com/subscriptions/82bf54ae-4197-4ff2-b1a1-1fd0ca92a6c3/providers/Microsoft.Web/sites?api-version=2016-08-01
```

### References

<https://medium.com/@mauridb/calling-azure-rest-api-via-curl-eb10a06127>

## List all resources types

<https://docs.microsoft.com/en-us/rest/api/resources/providers/list>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.devops.buzz/public/azure/api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
