I want to be able to query the Gmail API through a HTTP GET request.

I'm trying to query the Gmail API to get a message unread count from my INBOX label.

API Reference : <https://developers.google.com/gmail/api/v1/reference/users/labels/get>

The API reference shows the following HTTP request to get the unread count.

```
GET https://www.googleapis.com/gmail/v1/users/userId/labels/id

```

The API reference also says you need authorization through OAuth 2.0.

I managed to get examples working in the PHP library to successfully query the API but there is not enough PHP documentation to write any specific code.

However the API reference lists all HTTP calls to access different parts of the API however I can't figure out how to use OAuth (Access Tokens) with these HTTP requests?