Skip to content

Commit b206dd7

Browse files
author
David Albrecht
committed
addes upload image and create contract examples
1 parent 13879d0 commit b206dd7

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,45 @@ $result = $service->createSocialAccount([
4848
'account_type' => 'twitter',
4949
'username' => 'user',
5050
]);
51+
52+
// upload an image
53+
$imageurl = "https://placekitten.com/200/300";
54+
$imagedata = file_get_contents($imageurl);
55+
$base64 = base64_encode($imagedata);
56+
$image = [
57+
'image' => $base64
58+
];
59+
$imageResult = $this->service->uploadImage($image);
60+
61+
// create a new contract (i.e. a new product offering)
62+
$contract = [
63+
'expiration_date' => '',
64+
'metadata_category' => 'physical good',
65+
'title' => 'Product Title',
66+
'currency_code' => 'EUR',
67+
'description' => 'A Description about the product',
68+
'price' => '9.90',
69+
'process_time' => '1',
70+
'nsfw' => 'false',
71+
'terms_conditions' => '',
72+
'shipping_origin' => 'GERMANY',
73+
'ships_to' => 'ALL',
74+
'est_delivery_domestic' => '2 Business Days',
75+
'est_delivery_international' => '7-21 Business Days',
76+
'returns' => '',
77+
'shipping_currency_code' => 'EUR',
78+
'shipping_domestic' => 6,
79+
'shipping_international' => 12,
80+
'keywords' => 'vinyl',
81+
'category' => '',
82+
'condition' => 'New',
83+
'sku' => '',
84+
'free_shipping' => 'false',
85+
'images' => $imageResult['image_hashes'][0],
86+
'moderators' => 'e85ac56a60d01fa5ad20b3194bfc1c593db17cba',
87+
'contract_id' => '',
88+
];
89+
$result = $this->service->createContract($contract);
5190
?>
5291
```
5392
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.

0 commit comments

Comments
 (0)