Skip to content

Instantly share code, notes, and snippets.

@tristansokol
Created August 17, 2017 23:51
Show Gist options
  • Save tristansokol/91e0085d7cb9aae762ef1b64bb804a85 to your computer and use it in GitHub Desktop.
Save tristansokol/91e0085d7cb9aae762ef1b64bb804a85 to your computer and use it in GitHub Desktop.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('xxx');
$api_instance = new SquareConnect\Api\CatalogApi();
$body = new \SquareConnect\Model\UpsertCatalogObjectRequest(
array("idempotency_key"=>uniqid(),
"object"=>array(
"type"=>"CATEGORY",
"id"=>"#Drinks",
"category_data"=>array(
"name"=>"Drinks"
)
)
)
);
try {
$result = $api_instance->upsertCatalogObject($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling CatalogApi->upsertCatalogObject: ', $e->getMessage(), PHP_EOL;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment