> For the complete documentation index, see [llms.txt](https://raphaelugwu.gitbook.io/airtime/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://raphaelugwu.gitbook.io/airtime/commissions/get-commission-by-id.md).

# Get commissions by operator ID

With the `/operators/{operatorid}/commissions` endpoint, you can retrieve the details of an active discount being carried out by an operator by making a request with the operator's ID

## Commissions by operator ID

<mark style="color:blue;">`GET`</mark> `https://topups.reloadly.com/operators/{operatorid}/commissions`

#### Path Parameters

| Name                                         | Type    | Description                                                          |
| -------------------------------------------- | ------- | -------------------------------------------------------------------- |
| operatorId<mark style="color:red;">\*</mark> | integer | The ID of the operator whose discount information is being retrieved |

#### Headers

| Name                                            | Type   | Description                                                             |
| ----------------------------------------------- | ------ | ----------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Your access token is required as a bearer token in the request's header |

{% tabs %}
{% tab title="200 This response is gotten when a successful request is made and information on discounts is retrieved" %}
{% tabs %}
{% tab title="JSON" %}

```bash
{
  "operator":{
    "operatorId":173,
    "name":"Digicel Haiti",
    "countryCode":"HT",
    "status":true,
    "bundle":false,
    "data":false
  },
  "percentage":13,
  "internationalPercentage":13,
  "localPercentage":0.00,
  "updatedAt":"2020-02-08 19:32:43"
}
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="401 This response is gotten when a request is made with an incorrect or expired access token" %}
{% tabs %}
{% tab title="JSON" %}

```bash
{
    "timeStamp": "2021-05-11 22:34:35",
    "message": "Full authentication is required to access this resource",
    "path": "/operators/173/commissions",
    "errorCode": "INVALID_TOKEN",
    "infoLink": null,
    "details": []
}
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="404 This response is gotten when a request is made to an incorrect URL path" %}
{% tabs %}
{% tab title="JSON" %}

```bash
{
    "timestamp": "2021-05-11T22:33:12.101+0000",
    "status": 404,
    "error": "Not Found",
    "message": "No message available",
    "path": "/operators/173/commission"
}
```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

###

### Request samples

{% tabs %}
{% tab title="cURL" %}

```bash
curl --location --request GET 'https://topups.reloadly.com/operators/173/commissions' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN_HERE' \
--header 'Accept: application/com.reloadly.topups-v1+json'
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Threading.Tasks;
using System.Net.Http;
using System.Text;
using Newtonsoft.Json;

namespace WebAPIClient {
  class Program {

    static async Task Main(string[] args) {
      await ApiCall();
    }

    private static async Task ApiCall() {

      var message = new HttpRequestMessage(HttpMethod.Get, "https://topups.reloadly.com/operators/173/commissions");

      message.Headers.TryAddWithoutValidation("Authorization", "Bearer YOUR_ACCESS_TOKEN_HERE");
      message.Headers.TryAddWithoutValidation("Accept", "application/com.reloadly.topups-v1+json");

      using
      var httpClient = new HttpClient();
      var response = await httpClient.SendAsync(message);
      var responseBody = await response.Content.ReadAsStringAsync();
      var result = JsonConvert.DeserializeObject < dynamic > (responseBody);

      Console.WriteLine(result);
    }

  }
}
```

{% endtab %}

{% tab title="Golang" %}

```go
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://topups.reloadly.com/operators/173/commissions"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Authorization", "Bearer YOUR_ACCESS_TOKEN_HERE")
  req.Header.Add("Accept", "application/com.reloadly.topups-v1+json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```

{% endtab %}

{% tab title="Java" %}

```java
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("https://topups.reloadly.com/operators/173/commissions")
  .method("GET", null)
  .addHeader("Authorization", "Bearer YOUR_ACCESS_TOKEN_HERE")
  .addHeader("Accept", "application/com.reloadly.topups-v1+json")
  .build();
Response response = client.newCall(request).execute();
```

{% endtab %}

{% tab title="Node JS" %}

```javascript
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer YOUR_ACCESS_TOKEN_HERE");
myHeaders.append("Accept", "application/com.reloadly.topups-v1+json");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("https://topups.reloadly.com/operators/173/commissions", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://topups.reloadly.com/operators/173/commissions',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer YOUR_ACCESS_TOKEN_HERE',
    'Accept: application/com.reloadly.topups-v1+json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

url = "https://topups.reloadly.com/operators/173/commissions"

payload={}
headers = {
  'Authorization': 'Bearer YOUR_ACCESS_TOKEN_HERE',
  'Accept': 'application/com.reloadly.topups-v1+json'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
```

{% endtab %}
{% endtabs %}

###

### Response Parameters

| Parameter                                                       | Type    | Description                                                            |
| --------------------------------------------------------------- | ------- | ---------------------------------------------------------------------- |
| `percentage`                                                    | integer | Indicates the percentage discount for every top-up                     |
| <p><code>international</code></p><p><code>Percentage</code></p> | integer | Indicates the percentage discount for international top-ups            |
| `localPercentage`                                               | integer | Indicates the percentage discount for local top-ups                    |
| `updatedAt`                                                     | integer | Indicates the time the discount was first created by the operator      |
| `operatorId`                                                    | string  | Indicates the operator's ID                                            |
| `name`                                                          | string  | Indicates the operator's name                                          |
| `countryCode`                                                   | string  | Indicates the ISO code of the country where the operator is registered |
| `data`                                                          | boolean | Indicates if the operator has any existing data discounts              |
| `bundle`                                                        | boolean | Indicates if the operator has any existing bundle discounts            |
| `status`                                                        | boolean | Indicates if the operator has any existing discounts                   |
