Skip to content

Commit

Permalink
addes upload image and create contract examples
Browse files Browse the repository at this point in the history
  • Loading branch information
David Albrecht committed May 12, 2016
1 parent 13879d0 commit b206dd7
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,45 @@ $result = $service->createSocialAccount([
'account_type' => 'twitter',
'username' => 'user',
]);

// upload an image
$imageurl = "https://placekitten.com/200/300";
$imagedata = file_get_contents($imageurl);
$base64 = base64_encode($imagedata);
$image = [
'image' => $base64
];
$imageResult = $this->service->uploadImage($image);

// create a new contract (i.e. a new product offering)
$contract = [
'expiration_date' => '',
'metadata_category' => 'physical good',
'title' => 'Product Title',
'currency_code' => 'EUR',
'description' => 'A Description about the product',
'price' => '9.90',
'process_time' => '1',
'nsfw' => 'false',
'terms_conditions' => '',
'shipping_origin' => 'GERMANY',
'ships_to' => 'ALL',
'est_delivery_domestic' => '2 Business Days',
'est_delivery_international' => '7-21 Business Days',
'returns' => '',
'shipping_currency_code' => 'EUR',
'shipping_domestic' => 6,
'shipping_international' => 12,
'keywords' => 'vinyl',
'category' => '',
'condition' => 'New',
'sku' => '',
'free_shipping' => 'false',
'images' => $imageResult['image_hashes'][0],
'moderators' => 'e85ac56a60d01fa5ad20b3194bfc1c593db17cba',
'contract_id' => '',
];
$result = $this->service->createContract($contract);
?>
```
It is necessary to run the login first. After that you can run more api-calls without worrying about the authentication, since the cookie is persisted.
Expand Down

0 comments on commit b206dd7

Please sign in to comment.