markmarushak/curlapi

connect to API by curl request

dev-master 2018-12-13 14:12 UTC

This package is auto-updated.

Last update: 2024-09-14 03:48:29 UTC


README

Build Status Latest Stable Version Total Downloads License

This repository contains the open source PHP that allows you to access the REST API

Installation

The Curl API can be installed with Composer. Run this command:

composer require markmarushak/curlapi

Usage

Note: This version of the curl API SDK for PHP requires PHP 5.6 or greater.

Example

$argument_1 = 'test@example.com';
$argument_2 = 'test';

$client = new Voluum\Client\API(new Voluum\Auth\PasswordCredentials($argument_1, $argument_2));

$report_api = new Voluum\API($client);

Or use access id and key:

$access_key_id = "access_key_id";
$access_key = "access_key";

$client = new Voluum\Client\API(new Voluum\Auth\AccessKeyCredentials($access_key_id, $access_key));

$report_api = new Voluum\API($client);

How to get report:

$result = $report_api->get("report", [
   "from" => date("Y-m-d"),
   "to" => date("Y-m-d"),
   "groupBy" => "campaign"
]);

//Get result as json
echo $result->getJson();

//Get result as object
var_dump($result->getData());

Create new lander:

$result = $report_api->post("lander", [
   "namePostfix" => "Test",
   "url" => "http://example.com"
]);

Edit lander:

$result = $report_api->put("lander/xxxxx-xxxxxx-xxxxxx-xxxxx", [
   "namePostfix" => "Test 1",
   "url" => "http://example.com"
]);

Delete lander:

$result = $report_api->delete("lander", [
   "ids" => "xxxxx-xxxxxx-xxxxxx-xxxxxx"
]);

documentation voluum! here. documentation adsBridge here.

License

Please see the license file for more information.