Overview

HTTPS SSH

README

License

CC0 Public Domain - https://creativecommons.org/publicdomain/zero/1.0/

Setup

You must define your API_KEY, API_SECRET and BOOK_ID in your script.

define("API_KEY", "");
define("API_SECRET", "");
define("BOOK_ID", "");

require "alankitap.php";

Or, in order to make these constants available only to AlanKitap you can use

define("AlanKitap\API_KEY", "");
define("AlanKitap\API_SECRET", "");
define("AlanKitap\BOOK_ID", "");

handy if you are integrating multiple API clients which may use API_KEY.

Records

Create, get, search, update and delete records in a sheet

Create a record

$CreateData = [
    "product_name" => "API Test Product"
    , "in_stock"   => 5
    , "on_order"   => 55
    , "wholesale"  => 1.02
    , "retail"     => 2.25
];
$CreateResult = \AlanKitap\Record::Create("products", $CreateData);
print_r($CreateResult);

Search records

$SearchResults = \AlanKitap\Record::Search("products", ["in_stock" => 1], true);
print_r($SearchResults);

Get a record

$GetResult = \AlanKitap\Record::Get("products", 1, ["include" => ["id", "product_name", "in_stock", "on_order", "wholesale", "retail"]]);
print_r($GetResult);

Update a record

$UpdateResult = \AlanKitap\Record::Update("products", 3, ['in_stock' => 100]);
print_r($UpdateResult);

Delete a record

$DestroyResult = \AlanKitap\Record::Destroy("products", 100);
print_r($DestroyResult);

Meta

Book and sheet meta data

Book Meta

$BookMeta = \AlanKitap\Meta::Book();
print_r($BookMeta);

Sheets Meta

$SheetsMeta = \AlanKitap\Meta::Sheets();
print_r($SheetsMeta);

Sheet Meta

$SheetMeta = \AlanKitap\Meta::Sheet('5ae91ba5f9d76e00038a53c5');
print_r($SheetMeta);

Sheet Fields Meta

$FieldsMeta = \AlanKitap\Meta::Fields('5ae91ba5f9d76e00038a53c5');
print_r($FieldsMeta);

Webhooks

Create, destroy and list webhooks on a book

Create Webhook

$CreateParams = [
    "url" => "https://example.com/webhook.php"
    "actions" => [
        "create",
        "update"
    ]
];
$CreateResult = \AlanKitap\Webhooks::Create( $CreateParams , true);
print_r($CreateResult);

Destroy Webhook

$DestroyResult = \AlanKitap\Webhooks::Destroy('5ae972aa54cd80000339eb3f');
print_r($DestroyResult);

List Webhooks

$ListAllResult = \AlanKitap\Webhooks::List();
print_r($ListAllResult);

API Docs

Full Fieldbook docs available at https://github.com/fieldbook/api-docs