Go-to-Light Service 4.0.0.2397 - 121 - API License to Cloud Demo

<back to all web services

StockCreate

Requires Authentication
The following routes are available for this service:
All Verbs/CreateStock
All Verbs/StockCreate
<?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};


class StockCreate implements JsonSerializable
{
    public function __construct(
        /** @description Global Trade Item Number : usually is the barcode of product (EAN, UPC, Gencode, etc...) */
        // @ApiMember(Description="Global Trade Item Number : usually is the barcode of product (EAN, UPC, Gencode, etc...)")
        /** @var string */
        public string $Gtin='',

        /** @description Location of main stock or stock address */
        // @ApiMember(Description="Location of main stock or stock address", IsRequired=true)
        /** @var string */
        public string $StockLocation='',

        /** @description Quantity physically stocked at this location */
        // @ApiMember(Description="Quantity physically stocked at this location", IsRequired=true)
        /** @var float */
        public float $PhysicalQuantityStockLocation=0.0,

        /** @description Location of reserve stock (2nd stock location address) */
        // @ApiMember(Description="Location of reserve stock (2nd stock location address)")
        /** @var string */
        public string $ReserveStockLocation='',

        /** @description Quantity physically stocked at this location */
        // @ApiMember(Description="Quantity physically stocked at this location")
        /** @var float */
        public float $PhysicalQuantityReserveStockLocation=0.0,

        /** @description Product ID */
        // @ApiMember(Description="Product ID")
        /** @var string */
        public string $ProductID='',

        /** @description Second product ID E.g. in case of variant */
        // @ApiMember(Description="Second product ID E.g. in case of variant")
        /** @var string */
        public string $ProductAttributeID='',

        /** @description Product reference */
        // @ApiMember(Description="Product reference")
        /** @var string */
        public string $Reference='',

        /** @description GTIN of variant */
        // @ApiMember(Description="GTIN of variant")
        /** @var string */
        public string $GtinAttribute='',

        /** @description Product label */
        // @ApiMember(Description="Product label")
        /** @var string */
        public string $Label=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Gtin'])) $this->Gtin = $o['Gtin'];
        if (isset($o['StockLocation'])) $this->StockLocation = $o['StockLocation'];
        if (isset($o['PhysicalQuantityStockLocation'])) $this->PhysicalQuantityStockLocation = $o['PhysicalQuantityStockLocation'];
        if (isset($o['ReserveStockLocation'])) $this->ReserveStockLocation = $o['ReserveStockLocation'];
        if (isset($o['PhysicalQuantityReserveStockLocation'])) $this->PhysicalQuantityReserveStockLocation = $o['PhysicalQuantityReserveStockLocation'];
        if (isset($o['ProductID'])) $this->ProductID = $o['ProductID'];
        if (isset($o['ProductAttributeID'])) $this->ProductAttributeID = $o['ProductAttributeID'];
        if (isset($o['Reference'])) $this->Reference = $o['Reference'];
        if (isset($o['GtinAttribute'])) $this->GtinAttribute = $o['GtinAttribute'];
        if (isset($o['Label'])) $this->Label = $o['Label'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Gtin)) $o['Gtin'] = $this->Gtin;
        if (isset($this->StockLocation)) $o['StockLocation'] = $this->StockLocation;
        if (isset($this->PhysicalQuantityStockLocation)) $o['PhysicalQuantityStockLocation'] = $this->PhysicalQuantityStockLocation;
        if (isset($this->ReserveStockLocation)) $o['ReserveStockLocation'] = $this->ReserveStockLocation;
        if (isset($this->PhysicalQuantityReserveStockLocation)) $o['PhysicalQuantityReserveStockLocation'] = $this->PhysicalQuantityReserveStockLocation;
        if (isset($this->ProductID)) $o['ProductID'] = $this->ProductID;
        if (isset($this->ProductAttributeID)) $o['ProductAttributeID'] = $this->ProductAttributeID;
        if (isset($this->Reference)) $o['Reference'] = $this->Reference;
        if (isset($this->GtinAttribute)) $o['GtinAttribute'] = $this->GtinAttribute;
        if (isset($this->Label)) $o['Label'] = $this->Label;
        return empty($o) ? new class(){} : $o;
    }
}

PHP StockCreate DTOs

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

HTTP + CSV

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

POST /CreateStock HTTP/1.1 
Host: clouddemo.pickeos.com 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"Gtin":"String","StockLocation":"String","PhysicalQuantityStockLocation":0,"ReserveStockLocation":"String","PhysicalQuantityReserveStockLocation":0,"ProductID":"String","ProductAttributeID":"String","Reference":"String","GtinAttribute":"String","Label":"String"}