GeniuslinkAPI

<back to all web services

ProductMetadataLookupRequest

Requires Authentication
The following routes are available for this service:
GET/v3.5/product-metadata/lookup
<?php namespace dtos;

use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};


// @DataContract
class ProductIdentifiers implements JsonSerializable
{
    public function __construct(
        // @DataMember(Name="productGuid", EmitDefaultValue=false)
        /** @var string */
        public string $productGuid='',

        // @DataMember(Name="gtins", EmitDefaultValue=false)
        /** @var array<string>|null */
        public ?array $gtins=null,

        // @DataMember(Name="mpns", EmitDefaultValue=false)
        /** @var array<string>|null */
        public ?array $mpns=null,

        // @DataMember(Name="ean8", EmitDefaultValue=false)
        /** @var array<string>|null */
        public ?array $ean8=null,

        // @DataMember(Name="ean13", EmitDefaultValue=false)
        /** @var array<string>|null */
        public ?array $ean13=null,

        // @DataMember(Name="isbn9", EmitDefaultValue=false)
        /** @var array<string>|null */
        public ?array $isbn9=null,

        // @DataMember(Name="isbn10", EmitDefaultValue=false)
        /** @var array<string>|null */
        public ?array $isbn10=null,

        // @DataMember(Name="isbn13", EmitDefaultValue=false)
        /** @var array<string>|null */
        public ?array $isbn13=null,

        // @DataMember(Name="itf14", EmitDefaultValue=false)
        /** @var array<string>|null */
        public ?array $itf14=null,

        // @DataMember(Name="upc12", EmitDefaultValue=false)
        /** @var array<string>|null */
        public ?array $upc12=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['productGuid'])) $this->productGuid = $o['productGuid'];
        if (isset($o['gtins'])) $this->gtins = JsonConverters::fromArray('string', $o['gtins']);
        if (isset($o['mpns'])) $this->mpns = JsonConverters::fromArray('string', $o['mpns']);
        if (isset($o['ean8'])) $this->ean8 = JsonConverters::fromArray('string', $o['ean8']);
        if (isset($o['ean13'])) $this->ean13 = JsonConverters::fromArray('string', $o['ean13']);
        if (isset($o['isbn9'])) $this->isbn9 = JsonConverters::fromArray('string', $o['isbn9']);
        if (isset($o['isbn10'])) $this->isbn10 = JsonConverters::fromArray('string', $o['isbn10']);
        if (isset($o['isbn13'])) $this->isbn13 = JsonConverters::fromArray('string', $o['isbn13']);
        if (isset($o['itf14'])) $this->itf14 = JsonConverters::fromArray('string', $o['itf14']);
        if (isset($o['upc12'])) $this->upc12 = JsonConverters::fromArray('string', $o['upc12']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->productGuid)) $o['productGuid'] = $this->productGuid;
        if (isset($this->gtins)) $o['gtins'] = JsonConverters::toArray('string', $this->gtins);
        if (isset($this->mpns)) $o['mpns'] = JsonConverters::toArray('string', $this->mpns);
        if (isset($this->ean8)) $o['ean8'] = JsonConverters::toArray('string', $this->ean8);
        if (isset($this->ean13)) $o['ean13'] = JsonConverters::toArray('string', $this->ean13);
        if (isset($this->isbn9)) $o['isbn9'] = JsonConverters::toArray('string', $this->isbn9);
        if (isset($this->isbn10)) $o['isbn10'] = JsonConverters::toArray('string', $this->isbn10);
        if (isset($this->isbn13)) $o['isbn13'] = JsonConverters::toArray('string', $this->isbn13);
        if (isset($this->itf14)) $o['itf14'] = JsonConverters::toArray('string', $this->itf14);
        if (isset($this->upc12)) $o['upc12'] = JsonConverters::toArray('string', $this->upc12);
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class BookAttributes implements JsonSerializable
{
    public function __construct(
        // @DataMember(Name="authors", EmitDefaultValue=false)
        /** @var array<string>|null */
        public ?array $authors=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['authors'])) $this->authors = JsonConverters::fromArray('string', $o['authors']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->authors)) $o['authors'] = JsonConverters::toArray('string', $this->authors);
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class AudiobookAttributes extends BookAttributes implements JsonSerializable
{
    /**
     * @param array<string>|null $authors
     */
    public function __construct(
        ?array $authors=null
    ) {
        parent::__construct($authors);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class EBookAttributes extends BookAttributes implements JsonSerializable
{
    /**
     * @param array<string>|null $authors
     */
    public function __construct(
        ?array $authors=null
    ) {
        parent::__construct($authors);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class ItemAttributes implements JsonSerializable
{
    public function __construct(
        // @DataMember(Name="book", EmitDefaultValue=false)
        /** @var BookAttributes|null */
        public ?BookAttributes $book=null,

        // @DataMember(Name="audiobook", EmitDefaultValue=false)
        /** @var AudiobookAttributes|null */
        public ?AudiobookAttributes $audiobook=null,

        // @DataMember(Name="ebook", EmitDefaultValue=false)
        /** @var EBookAttributes|null */
        public ?EBookAttributes $ebook=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['book'])) $this->book = JsonConverters::from('BookAttributes', $o['book']);
        if (isset($o['audiobook'])) $this->audiobook = JsonConverters::from('AudiobookAttributes', $o['audiobook']);
        if (isset($o['ebook'])) $this->ebook = JsonConverters::from('EBookAttributes', $o['ebook']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->book)) $o['book'] = JsonConverters::to('BookAttributes', $this->book);
        if (isset($this->audiobook)) $o['audiobook'] = JsonConverters::to('AudiobookAttributes', $this->audiobook);
        if (isset($this->ebook)) $o['ebook'] = JsonConverters::to('EBookAttributes', $this->ebook);
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class ProductAttributes implements JsonSerializable
{
    public function __construct(
        // @DataMember(Name="retailer", EmitDefaultValue=false)
        /** @var string|null */
        public ?string $retailer=null,

        // @DataMember(Name="retailerGuid", EmitDefaultValue=false)
        /** @var string */
        public string $retailerGuid='',

        // @DataMember(Name="storefront", EmitDefaultValue=false)
        /** @var string|null */
        public ?string $storefront=null,

        // @DataMember(Name="storefrontIso2", EmitDefaultValue=false)
        /** @var string|null */
        public ?string $storefrontIso2=null,

        // @DataMember(Name="storefrontGuid", EmitDefaultValue=false)
        /** @var string */
        public string $storefrontGuid='',

        // @DataMember(Name="category", EmitDefaultValue=false)
        /** @var string|null */
        public ?string $category=null,

        // @DataMember(Name="categoryGuid", EmitDefaultValue=false)
        /** @var string */
        public string $categoryGuid='',

        // @DataMember(Name="brand", EmitDefaultValue=false)
        /** @var string|null */
        public ?string $brand=null,

        // @DataMember(Name="brandGuid", EmitDefaultValue=false)
        /** @var string */
        public string $brandGuid='',

        // @DataMember(Name="manufacturer", EmitDefaultValue=false)
        /** @var string|null */
        public ?string $manufacturer=null,

        // @DataMember(Name="manufacturerGuid", EmitDefaultValue=false)
        /** @var string */
        public string $manufacturerGuid='',

        // @DataMember(Name="identifiers", EmitDefaultValue=false)
        /** @var ProductIdentifiers|null */
        public ?ProductIdentifiers $identifiers=null,

        // @DataMember(Name="itemAttributes", EmitDefaultValue=false)
        /** @var ItemAttributes|null */
        public ?ItemAttributes $itemAttributes=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['retailer'])) $this->retailer = $o['retailer'];
        if (isset($o['retailerGuid'])) $this->retailerGuid = $o['retailerGuid'];
        if (isset($o['storefront'])) $this->storefront = $o['storefront'];
        if (isset($o['storefrontIso2'])) $this->storefrontIso2 = $o['storefrontIso2'];
        if (isset($o['storefrontGuid'])) $this->storefrontGuid = $o['storefrontGuid'];
        if (isset($o['category'])) $this->category = $o['category'];
        if (isset($o['categoryGuid'])) $this->categoryGuid = $o['categoryGuid'];
        if (isset($o['brand'])) $this->brand = $o['brand'];
        if (isset($o['brandGuid'])) $this->brandGuid = $o['brandGuid'];
        if (isset($o['manufacturer'])) $this->manufacturer = $o['manufacturer'];
        if (isset($o['manufacturerGuid'])) $this->manufacturerGuid = $o['manufacturerGuid'];
        if (isset($o['identifiers'])) $this->identifiers = JsonConverters::from('ProductIdentifiers', $o['identifiers']);
        if (isset($o['itemAttributes'])) $this->itemAttributes = JsonConverters::from('ItemAttributes', $o['itemAttributes']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->retailer)) $o['retailer'] = $this->retailer;
        if (isset($this->retailerGuid)) $o['retailerGuid'] = $this->retailerGuid;
        if (isset($this->storefront)) $o['storefront'] = $this->storefront;
        if (isset($this->storefrontIso2)) $o['storefrontIso2'] = $this->storefrontIso2;
        if (isset($this->storefrontGuid)) $o['storefrontGuid'] = $this->storefrontGuid;
        if (isset($this->category)) $o['category'] = $this->category;
        if (isset($this->categoryGuid)) $o['categoryGuid'] = $this->categoryGuid;
        if (isset($this->brand)) $o['brand'] = $this->brand;
        if (isset($this->brandGuid)) $o['brandGuid'] = $this->brandGuid;
        if (isset($this->manufacturer)) $o['manufacturer'] = $this->manufacturer;
        if (isset($this->manufacturerGuid)) $o['manufacturerGuid'] = $this->manufacturerGuid;
        if (isset($this->identifiers)) $o['identifiers'] = JsonConverters::to('ProductIdentifiers', $this->identifiers);
        if (isset($this->itemAttributes)) $o['itemAttributes'] = JsonConverters::to('ItemAttributes', $this->itemAttributes);
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class RetailerSpecificAttributes implements JsonSerializable
{
    public function __construct(
        // @DataMember(Name="name", EmitDefaultValue=false)
        /** @var string|null */
        public ?string $name=null,

        // @DataMember(Name="description", EmitDefaultValue=false)
        /** @var string|null */
        public ?string $description=null,

        // @DataMember(Name="skus", EmitDefaultValue=false)
        /** @var array<string>|null */
        public ?array $skus=null,

        // @DataMember(Name="asin", EmitDefaultValue=false)
        /** @var string|null */
        public ?string $asin=null,

        // @DataMember(Name="url", EmitDefaultValue=false)
        /** @var string|null */
        public ?string $url=null,

        // @DataMember(Name="productImages", EmitDefaultValue=false)
        /** @var array<string,string>|null */
        public ?array $productImages=null,

        // @DataMember(Name="additionalData", EmitDefaultValue=false)
        /** @var array<string,string>|null */
        public ?array $additionalData=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['description'])) $this->description = $o['description'];
        if (isset($o['skus'])) $this->skus = JsonConverters::fromArray('string', $o['skus']);
        if (isset($o['asin'])) $this->asin = $o['asin'];
        if (isset($o['url'])) $this->url = JsonConverters::from('string', $o['url']);
        if (isset($o['productImages'])) $this->productImages = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','Uri']), $o['productImages']);
        if (isset($o['additionalData'])) $this->additionalData = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['additionalData']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->description)) $o['description'] = $this->description;
        if (isset($this->skus)) $o['skus'] = JsonConverters::toArray('string', $this->skus);
        if (isset($this->asin)) $o['asin'] = $this->asin;
        if (isset($this->url)) $o['url'] = JsonConverters::to('string', $this->url);
        if (isset($this->productImages)) $o['productImages'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','Uri']), $this->productImages);
        if (isset($this->additionalData)) $o['additionalData'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->additionalData);
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class ProductData implements JsonSerializable
{
    public function __construct(
        // @DataMember(Name="attributes", EmitDefaultValue=false)
        /** @var ProductAttributes|null */
        public ?ProductAttributes $attributes=null,

        // @DataMember(Name="retailerSpecificAttributes", EmitDefaultValue=false)
        /** @var RetailerSpecificAttributes|null */
        public ?RetailerSpecificAttributes $retailerSpecificAttributes=null,

        // @DataMember(Name="rawSourceData", EmitDefaultValue=false)
        /** @var string|null */
        public ?string $rawSourceData=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['attributes'])) $this->attributes = JsonConverters::from('ProductAttributes', $o['attributes']);
        if (isset($o['retailerSpecificAttributes'])) $this->retailerSpecificAttributes = JsonConverters::from('RetailerSpecificAttributes', $o['retailerSpecificAttributes']);
        if (isset($o['rawSourceData'])) $this->rawSourceData = $o['rawSourceData'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->attributes)) $o['attributes'] = JsonConverters::to('ProductAttributes', $this->attributes);
        if (isset($this->retailerSpecificAttributes)) $o['retailerSpecificAttributes'] = JsonConverters::to('RetailerSpecificAttributes', $this->retailerSpecificAttributes);
        if (isset($this->rawSourceData)) $o['rawSourceData'] = $this->rawSourceData;
        return empty($o) ? new class(){} : $o;
    }
}

class ProductMetadataLookupResponse implements IProductMetadataLookupResponse, JsonSerializable
{
    public function __construct(
        // @DataMember(Name="productMetadata")
        /** @var ProductData|null */
        public ?ProductData $productMetadata=null,

        // @DataMember(Name="responseStatus")
        /** @var ResponseStatus|null */
        public ?ResponseStatus $responseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['productMetadata'])) $this->productMetadata = JsonConverters::from('ProductData', $o['productMetadata']);
        if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->productMetadata)) $o['productMetadata'] = JsonConverters::to('ProductData', $this->productMetadata);
        if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class ProductMetadataLookupRequest implements IProductMetadataLookupRequest, JsonSerializable
{
    public function __construct(
        // @DataMember(Name="url")
        /** @var string|null */
        public ?string $url=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['url'])) $this->url = $o['url'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->url)) $o['url'] = $this->url;
        return empty($o) ? new class(){} : $o;
    }
}

PHP ProductMetadataLookupRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /v3.5/product-metadata/lookup HTTP/1.1 
Host: geniuslink-api-zane.dev.platform.georiot.com 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	productMetadata: 
	{
		attributes: 
		{
			retailer: String,
			storefront: String,
			storefrontIso2: String,
			category: String,
			brand: String,
			manufacturer: String,
			identifiers: 
			{
				gtins: 
				[
					String
				],
				mpns: 
				[
					String
				],
				ean8: 
				[
					String
				],
				ean13: 
				[
					String
				],
				isbn9: 
				[
					String
				],
				isbn10: 
				[
					String
				],
				isbn13: 
				[
					String
				],
				itf14: 
				[
					String
				],
				upc12: 
				[
					String
				]
			},
			itemAttributes: 
			{
				book: 
				{
					authors: 
					[
						String
					]
				},
				audiobook: 
				{
					authors: 
					[
						String
					]
				},
				ebook: 
				{
					authors: 
					[
						String
					]
				}
			}
		},
		retailerSpecificAttributes: 
		{
			name: String,
			description: String,
			skus: 
			[
				String
			],
			asin: String,
			productImages: {},
			additionalData: 
			{
				String: String
			}
		},
		rawSourceData: String
	},
	responseStatus: 
	{
		errorCode: String,
		message: String,
		stackTrace: String,
		errors: 
		[
			{
				errorCode: String,
				fieldName: String,
				message: String,
				meta: 
				{
					String: String
				}
			}
		],
		meta: 
		{
			String: String
		}
	}
}