Skip to content

inetbusiness/etsy-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basic implementation of the Etsy API

Install via Composer

edit composer.json file

"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/inetbusiness/etsy-api"
    }
],

and

"require": {
    "inetbusiness/etsy-api": "^1.0.0"
},
composer install

Simple usage

$etsy = new \Etsy\API("12345678.097hym1q6g", "q4a5qsp7wkg4hjwojmwopign");

$listingData = new ListingDataTransfer([
    Etsy\ListingData::TITLE => 'Handcrafted Necklace',
    Etsy\ListingData::DESCRIPTION => 'Beautiful handmade necklace.',
    // Add other listing details.
]);
$newListing = $etsy->createListing($listingData);
print_r($newListing);

$listingId = 'listing_id';
$updatedData = new ListingDataTransfer([Etsy\ListingData::TITLE => 'Updated Necklace']);
$updatedListing = $etsy->updateListing($listingId, $updatedData);
print_r($updatedListing);

$shopInfoData = $etsy->getShopInfo(\Etsy\ShopInfo::SHOP_NAME);
$shopInfo = Etsy\ShopInfoDataTransfer::fromResponseArray($shopInfoData);
echo "Shop Name: " . $shopInfo->getShopName() . "\n";
echo "Shop URL: " . $shopInfo->getShopURL() . "\n";