# REST API URL and OAuth 2.0 Endpoints

## REST API URL in Hub

Hub's REST API is available by the following URL:

```
<Hub Service URL>/api/rest/
```

`<Hub Service URL>` is the Base URL of the Hub service in your network environment. For example, you have your company's server `www.mycompany.com` and a Hub service. You can configure Hub to be accessible by `www.mycompany.com/hub` or, let's say `hub.mycompany.com`.

`/api/rest/` is the context path for the REST API of your Hub service.

For the sample Base URLs above, REST API URLs are as follows, respectively:

* For `www.mycompany.com/hub`: ``` https://www.mycompany.com/hub/api/rest ```

* For `hub.mycompany.com`: ``` https://hub.mycompany.com/api/rest/ ```

Concluding the example, endpoint URLs to, let's say, get the profile of the current user are:

* For `www.mycompany.com/hub`: ``` https://www.mycompany.com/hub/api/rest/users/me ```

* For `hub.mycompany.com`: ``` https://hub.mycompany.com/api/rest/users/me ```

## OAuth 2.0 Endpoints for Hub

For the Hub service, the OAuth 2.0 endpoints for authentication and token are:

* Authentication endpoint URL: ``` <Hub REST API URL>/oauth2/auth ```

* Token endpoint URL: ``` <Hub REST API URL>/oauth2/token ```

`<Hub REST API URL>` is the URL for the REST API of your Hub service. For details, see the description above. For sample REST API URLs that are described in the previous section, the OAuth 2.0 endpoints are as follows, respectively:

* For `www.mycompany.com/hub`: ``` https://www.mycompany.com/hub/api/rest/oauth2/auth https://www.mycompany.com/hub/api/rest/oauth2/token ```

* For `hub.mycompany.com`: ``` https://hub.mycompany.com/api/rest/oauth2/auth https://hub.mycompany.com/api/rest/oauth2/token ```

If you need to get the user info and further data, please check the description of [OpenID Connect
endpoint](https://www.jetbrains.com.cn/en-us/help/hub/?OpenID-Connect#OpenID-Connect-Endpoint).

