# Get promotions by ID

With the `/promotions/{promotionid}` endpoint, you can fetch the details of a promotion by making a request with its ID

## Promotions by ID

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

#### Path Parameters

| Name        | Type    | Description        |
| ----------- | ------- | ------------------ |
| promotionId | integer | The promotion's ID |

#### Headers

| Name          | Type   | Description                                                             |
| ------------- | ------ | ----------------------------------------------------------------------- |
| Authorization | 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" %}
{% tabs %}
{% tab title="JSON" %}

```bash
{
  "promotionId":5,
  "operatorId":114,
  "title":"Movistar Ecuador From 01 Jan 2018 00:00 To 01 Jul 20",
  "title2":"Bonus 2x",
  "description":"For top ups of USD$2.00 (EUR 5) or more",
  "startDate":"Mon, 01 Jan 2018 05:00:00 +0000",
  "endDate":"Mon, 02 Jul 2018 04:59:00 +0000",
  "denominations":"USD 2 and up",
  "localDenominations":null
}
```

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

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

```bash
{
  "timeStamp":"2021-05-18 14:27:36",
  "message":"Full authentication is required to access this resource",
  "path":"/promotions/6984",
  "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-18T15:29:50.022+0000",
  "status":404,
  "error":"Not Found",
  "message":"No message available",
  "path":"/promotion/6984"
}
```

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

###

### Request samples

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

```bash
curl --location --request GET 'https://topups.reloadly.com/promotions/8652' \
--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/promotions/8652");

      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/promotions/8652"
  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/promotions/8652")
  .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 request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://topups.reloadly.com/promotions/8652',
  'headers': {
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN_HERE',
    'Accept': 'application/com.reloadly.topups-v1+json',
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://topups.reloadly.com/promotions/8652',
  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/promotions/8652"

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                                                                                          |
| -------------------- | ------- | ---------------------------------------------------------------------------------------------------- |
| `promotionId`        | integer | The promotion ID. This is a unique identifier for the ongoing promotion                              |
| `operatorId`         | integer | Indicates the ID of the operator offering the promotion                                              |
| `title1`             | string  | Indicates the duration of the promotion and the name of the operator offering it                     |
| `title2`             | string  | Indicates additional information on the promotion                                                    |
| `description`        | string  | This indicates a summary of what the promotion is about                                              |
| `startDate`          | string  | The date the promotion begins                                                                        |
| `endDate`            | string  | The date the promotion ends                                                                          |
| `denominations`      | string  | Indicates the top-up amounts that are eligible for the promotion                                     |
| `localDenominations` | string  | Indicates the local top-up amounts in the destination's currency that are eligible for the promotion |
