# Demo Code

## Post

**Request POST** <https://oltest.api.offerslook.com/v1/offers>

```
<?php

$request = new HttpRequest();
$request->setUrl('http://oltest1.api.offerslook.com/v1/offers');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'postman-token' => 'e74fa976-c532-0118-32da-1a9f1e8c90ce',
  'cache-control' => 'no-cache',
  'authorization' => 'Basic b2x0ZXN0MTo1YzVjZTZiMTZiMGE0NDNkOTg0ZDYyMjZlOTZkZGMzOQ==',
  'content-type' => 'application/json'
));

$request->setBody('{
    "offer": {
        "adult_allowed": 0,
        "advertiser_id": 5556,
        "description": "This is our company's website address: http://www.offerslook.com.Welcome to visit!",
        "destination_url": "https://oltest1.offerstrack.net/pixelBack.php?offer_id=19943&adv_id=5556&amount=100" ,

        "incent_allowed": 0,
        "name": "000-wyqirx",
        "offer_approval": 1,
    "preview_url": "http://www.offerslook.com",
    "push_allowed": 0,
    "revenue_type": "RPA+RPS",
    "revenue": "5",
    "percent_revenue": "10.00",
    "payout_type": "CPA",
    "payout": "2",
    "status": "active",      
    "redirect_offer_id": 19921,
    "global_redirect_enabled": 0,
    "currency": "USD",
    "conversion_protocol": "1",
    "is_ssl": "0",
    "approve_conversions": "0"
    },
    "offer_platform": {
        "target": [
            {
                "platform": "Mobile",
                "system": "iOS",
                "is_above":1,
                "version": [
                    "5.1",
                    "6.0",
                    "6.1"
                ]
            },
            {
                "platform": "Mobile",
                "system": "Android",
                "version": []

            },
            {
                "platform": "PC",
                "system": null,
                "version": null     
            }
```

## Put

**Request Put** <https://oltest.api.offerslook.com/v1/offers/54905>

```
<?php

$request = new HttpRequest();
$request->setUrl('http://oltest1.api.offerslook.com/v1/offers/54905');
$request->setMethod(HTTP_METH_PUT);

$request->setHeaders(array(
  'postman-token' => '4eeb8570-f3a9-dde0-1c23-dc02e303e857',
  'cache-control' => 'no-cache',
  'authorization' => 'Basic b2x0ZXN0MTo1YzVjZTZiMTZiMGE0NDNkOTg0ZDYyMjZlOTZkZGMzOQ==',
  'content-type' => 'application/json'
));

$request->setBody('{
    "offer": {
        "name":"rrrrrwrwr",
        "adult_allowed": 0,
        "advertiser_id": 5556,
        "description": "This is our company's website address: http://www.offerslook.com.Welcome to visit!",
        "destination_url": "https://oltest1.offerstrack.net/pixelBack.php?offer_id=19943&adv_id=5556&amount=100" ,
        "end_date": 1577808000,
        "incent_allowed": 0,
        "offer_approval": 1,
        "preview_url": "http://www.offerslook.com",
        "push_allowed": 0,
       "revenue_type": "RPA+RPS",
      "revenue": "5.55",
      "percent_revenue": "10.00",
      "payout_type": "CPI",
      "payout": "2",
      "status": "active",    
"global_redirect_enabled": 0,
"currency": "USD",
"conversion_protocol": "2",
"is_ssl": "0",
"approve_conversions": "0"
    },
    "offer_platform": {
        "target": [
            {
                "platform": "Mobile",
                "system": "iOS",
                "is_above":1,
                "version": [
                    "5.1",
                    "6.0",
                    "6.1"
                ]
            },
            {
                "platform": "Mobile",
                "system": "Android",
                "version": []

            },
            {
                "platform": "PC",
                "system": null,
                "version": null     
            }

        ]
    },
    "offer_geo": {
        "target": [
            {
                "type": 1,
                "country": "Albania",
                "city": []
            },
            {
                "type": 1,
                "country": "Armenia",
                "city": [
                    "Kapan",
                    "Agarak",
                    "Azatamut"
                ]
            },
            {
                "type":2,
                "country": "China",
                "city": [
                    "Guangzhou",
                    "shantou"
                ]
            }
        ],
        "type": 1
    },
    "offer_category": {
        "name": "Music and Audio,test,Sunday"
    },
"offer_cap": {
        "cap_timezone": "Australia/Lord_Howe",
        "adv_cap_type": 1,
      "adv_cap_click": 10000,
      "adv_cap_conversion": 100,
      "adv_cap_revenue": "500",
      "aff_cap_type": 3,
      "aff_cap_click": 10000,
      "aff_cap_conversion": 500,
      "aff_cap_payout": "800.000"
    }
}
');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
```

## Get

**Request Get** <https://oltest.api.offerslook.com/v1/offers>

```
<?php

$request = new HttpRequest();
$request->setUrl('http://oltest1.api.offerslook.com/v1/offers');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'postman-token' => 'e129e164-8863-cab7-657e-92d61f1a0c58',
  'cache-control' => 'no-cache',
  'authorization' => 'Basic b2x0ZXN0MTo1YzVjZTZiMTZiMGE0NDNkOTg0ZDYyMjZlOTZkZGMzOQ==',
  'content-type' => 'application/json'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
```

## Patch

**Request Patch** <https://oltest.api.offerslook.com/v1/offers/19800,19801,19802,19803>

```
<?php

HttpRequest::methodRegister('PATCH');
$request = new HttpRequest();
$request->setUrl('https://oltest.api.offerslook.com/v1/offers/19800,19801,19802,19803');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);

$request->setQueryData(array(
  'status' => 'paused'
));

$request->setHeaders(array(
  'postman-token' => '479de210-0914-c3f8-0026-55d0ca1d32d3',
  'cache-control' => 'no-cache',
  'authorization' => 'Basic b2x0ZXN0MTo1YzVjZTZiMTZiMGE0NDNkOTg0ZDYyMjZlOTZkZGMzOQ=='
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
```

## Delete

**Request Delete** <https://oltest.api.offerslook.com/v1/offer_categories/464>

```
<?php

$request = new HttpRequest();
$request->setUrl('http://oltest1.api.offerslook.com/v1/offer_categories/464');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'postman-token' => 'ee764ea5-87b8-e44b-e8b0-a0d2f81880ae',
  'cache-control' => 'no-cache',
  'authorization' => 'Basic b2x0ZXN0MTo1YzVjZTZiMTZiMGE0NDNkOTg0ZDYyMjZlOTZkZGMzOQ=='
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://offerslook-api.gitbook.io/api-documentation/demo_code.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
