Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

Introduction

The purpose of this service is to save new products to Vision database,

Request

Request URL POST : https://<pathtoapi>/service/ProductCode

POST Body structure : PC XML Structure

 Request body sample
<?xml version="1.0" standalone="yes"?> 
<PRODUCTS>
    <PC>
        <HD>
            <CustomerCode>CUST01</CustomerCode>
            <SiteCode>TH</SiteCode>
            <CountryOfOrigin />
            <ProductCode>PRO1</ProductCode>
            <ProductDescription>king</ProductDescription>
            <NetWeightKG>1.0000</NetWeightKG>
            <GrossWeightKG>1.7000</GrossWeightKG>
            <SinglesPerUnit>1</SinglesPerUnit>
            <SingleSize>1.0000</SingleSize>
            <ReserveCustomer xml:space="preserve"> </ReserveCustomer>
        </HD>
        <HO>
            <ProductType>0</ProductType>
            <BrandName>king</BrandName>
            <KilogramsPerUnit />
            <UnitsPerPallet>1</UnitsPerPallet>
            <Height />
            <StrengthABV />
            <LitresLiquidPerUnit />
            <LitresAlcoholPerUnit />
            <CigarettesPerUnit />
            <ProductGroupCode />
            <VatCode />
            <CommodityCode />
            <CountryWhenceConsigned />
            <TaxCode />
            <UnitToChargeBy />
            <PackageDescription />
            <AlternativeCode />
            <AlternativeDescription />
            <UnitsPerLayer>1</UnitsPerLayer>
            <ContainerQuantity />
            <MinStockLevel />
            <MinPurchaseOrderQuantity />
            <MinSalesOrderQuantity />
            <TraderUnitCode />
            <SubUnitCode />
            <UsePackageQuantity />
            <IsSerialNumberRequired />
            <CarriagePricePerUnit />
            <CIFPricePerUnit />
            <SalesPricePerUnit />
            <UnderBondSalesPricePerUnit />
            <PurchaseCostPerUnit />
            <InsuranceCostPerUnit />
            <SubtituteProduct1 />
            <SubtituteProduct2 />
            <SubtituteProduct3 />
            <CigarettesSellingPricePerUnit />
            <ProductLife />
            <ShelfLifeDays />
            <ProductCostPerUnit />
            <ProductCostCurrency />
            <InsuranceCostCurrency />
            <FreightCostCurrency />
            <vintage>1990</vintage>
        </HO>
    </PC>
</PRODUCTS>

Response

Response body will have new tag <RES> attached with input XML which will have information about the response.

<RES>
       <Code></Code> 
       <Message></Message>
</RES>

Code will be 200 or 400, 200 is for success, if the code is 400 node <Message> will have reason for failure

HTTP Response Codes

Code

Message

200

OK, All request processed

406

Input XML validation failed, response body will have reason for failure

429

API access restricted (Exceeded the rate limit / access not allowed)

207

Multi-Status, <RES> tag have more information

400

Request processing all record failed, <RES> tag have more information

Response samples

Code : 200

<PRODUCTS>
    <PC>
        <HD>
            <ProductCode>PRO1</ProductCode>
        </HD>
        <RES>
            <Code>200</Code>
            <Message>ProductCode processed</Message>
        </RES>
    </PC>
    <PC>
        <HD>
            <ProductCode>PRO2</ProductCode>
        </HD>
        <RES>
            <Code>200</Code>
            <Message>ProductCode processed</Message>
        </RES>
    </PC>
</PRODUCTS>

Code : 207

<PRODUCTS>
    <PC>
        <HD>
            <ProductCode>PRO1</ProductCode>
        </HD>
        <RES>
            <Code>200</Code>
            <Message>ProductCode processed</Message>
        </RES>
    </PC>
    <PC>
        <HD>
            <ProductCode>PRO2</ProductCode>
        </HD>
        <RES>
            <Code>400</Code>
            <Message>Validation failure occurred on line: 1 Product Code is mandatory</Message>
        </RES>
    </PC>
</PRODUCTS>

Code : 400

<PRODUCTS>
    <PC>
        <HD>
            <ProductCode>PRO1</ProductCode>
        </HD>
       <RES>
            <Code>400</Code>
            <Message>Validation failure occurred on line: 1 Product Code is mandatory</Message>
        </RES>
    </PC>
    <PC>
        <HD>
            <ProductCode>PRO2</ProductCode>
        </HD>
        <RES>
            <Code>400</Code>
            <Message>Validation failure occurred on line: 1 Product Code is mandatory</Message>
        </RES>
    </PC>
</PRODUCTS>

Code : 406 Response Body

Failed validation because field 'SiteCode' exceeded the maximum number of characters allowed.

  • No labels