## Get a subscription discount

### cURL

```
curl --request GET \
  --url https://prod01.copilot.fabric.inc/data-subscription/v1/subscriptionDiscount/{offerId} \
  --header 'Authorization: Bearer <token>'
```

### Python

```python
import requests

url = "https://prod01.copilot.fabric.inc/data-subscription/v1/subscriptionDiscount/{offerId}"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
```

### JavaScript (Fetch)

```javascript
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://prod01.copilot.fabric.inc/data-subscription/v1/subscriptionDiscount/{offerId}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### PHP

```php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://prod01.copilot.fabric.inc/data-subscription/v1/subscriptionDiscount/{offerId}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
```

### Go

```go
package main

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

func main() {

url := "https://prod01.copilot.fabric.inc/data-subscription/v1/subscriptionDiscount/{offerId}"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))
}
```

### Java (Unirest)

```java
HttpResponse<String> response = Unirest.get("https://prod01.copilot.fabric.inc/data-subscription/v1/subscriptionDiscount/{offerId}")
  .header("Authorization", "Bearer <token>")
  .asString();
```

### Ruby

```ruby
require 'uri'
require 'net/http'

url = URI("https://prod01.copilot.fabric.inc/data-subscription/v1/subscriptionDiscount/{offerId}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

### Sample Responses

**200**
```json
{
  "responseStatus": "OK",
  "message": "Request processed successfully",
  "data": {
    "id": "62d9196aeec12800095633f2",
    "status": "ACTIVE",
    "offerCode": "SUB-D45DD7",
    "validity": {
      "startDate": "2022-07-21T13:14:51.474Z",
      "endDate": "2022-07-21T13:14:51.474Z",
      "applyOnOrders": [
        2,
        3
      ]
    },
    "message": "Offer terms and conditions",
    "discount": {
      "amount": 10
    },
    "skus": [
      "MOBO-X570"
    ],
    "categories": [
      "holiday-best-sellers"
    ],
    "frequency": {
      "shippingFrequency": 1,
      "shippingFrequencyType": "daily",
      "billingFrequency": 1,
      "billingFrequencyType": "daily"
    },
    "itemQuantity": 1,
    "channel": "WEBSITE",
    "target": "PDP",
    "customerSegment": [
      "employee"
    ],
    "isDeleted": false,
    "DeletedAt": "2019-01-01T00:00:00.000Z",
    "createdAt": "2021-10-12T21:35:05.756Z",
    "updatedAt": "2021-10-14T05:40:55.997Z"
  }
}
```

**403**
```json
{
  "Message": "User is not authorized to access this resource with an explicit deny"
}
```

**404**
```json
{
  "responseStatus": "NOT_FOUND",
  "message": "Not found"
}
```

### Authorizations

**Authorization**  
`string header required`  
Bearer authentication header of the form `Bearer <token>`, where `<token>` is your auth token.

### Path Parameters

**offerId**  
`string required`  
Offer code

Example:
`"SUB-D45DD7"`

### Response

**200**
`application/json`  
Request processed successfully  
Single discount by offerCode

**responseStatus**  
`string`  
Brief response status  
Example:
`"OK"`
  
**message**  
`string`  
Full response message  
Example:
`"Request processed successfully"`

**data**  
`object`  
Discount details.
