Die Definition von einem Variationsset erfolgt über das EntitySet Products und dem Property ProductType 0.
Ein Einzelprodukt kann Spezifikationen haben und die Spezifikationen werden im EntitySet ProductRelations definiert (Siehe dazu Spezifikationen zuweisen).
Ein Einzelprodukt kann einem Setprodukt (Variationssets und/oder Produktsets) zugewiesen sein.
Die Zuweisung von Einzelprodukten zu einem Setprodukt wird in dem EntitySet ProductRelations definiert (Siehe dazu Einzelprodukte zu Sets zuweisen).
Im unteren Beispiel wird ein Standardprodukt "Apple iPhone 3GS 16 GB - Schwarz (Ohne Simlock) Smartphone" definiert.
Request Methode
POST http://sandboxapi.via.de/publicapi/v1/api.svc/Products
Request HTTP-Header
Content-Type: application/atom+xml
SubscriptionToken: g93af799-6ae8-e111-8406-0050568261dc
Cookie: .ASPXAUTH=0186587E1743637D35632A7EDAF4F07EA67C6E4577770C3778FD9C17904A9D85B01369A8198B23A9AF530DBE93A68687C219BE1876B16B 0DAEBBD2C3318CA6C99D9C53E5B9FE17B7CF9661C5CDDDB97B90D5D3AF550100227EC8D6E6858FAE986AF2302C337B8DFEC6099898C19AA335A81317AB2B382DE72586AA9DF830C715332215AEBFD5E2FBA45F2BB5A7CA9793; path=/; HttpOnly
Request Body
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<entry xml:base="http://sandboxapi.via.de/publicapi/v1/api.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
<content type="application/xml">
<m:properties>
<d:ForeignId>987654321</d:ForeignId>
<d:Title>Apple iPhone 3GS 16 GB - Schwarz (Ohne Simlock) Smartphone</d:Title>
<d:Description><![CDATA[<div>Beschreibung für Apple iPhone 3GS 16 GB - Schwarz (Ohne Simlock) Smartphone</div>]]></d:Description>
<d:Price>1299.99</d:Price>
<d:StockAmount>100</d:StockAmount>
<d:Ean>0784090091994</d:Ean>
<d:ProductType>0</d:ProductType>
</m:properties>
</content>
</entry>
Response HTTP-Header
Status Code: 201 Created
Cache-Control: no-cache
Content-Length: 2154
Content-Type: application/atom+xml;charset=utf-8
DataServiceVersion: 1.0;
...
Response Body
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<entry xml:base="http://sandboxapi.via.de/publicapi/v1/api.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
<id>http://sandboxapi.via.de/publicapi/v1/api.svc/Products(1L)</id>
<title type="text"></title>
<updated>2012-08-17T07:26:48Z</updated>
<author>
<name />
</author>
<link rel="edit" title="Product" href="Products(1L)" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ProductImages" type="application/atom+xml;type=feed" title="ProductImages" href="Products(1L)/ProductImages" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ChildProducts" type="application/atom+xml;type=feed" title="ChildProducts" href="Products(1L)/ChildProducts" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ParentProducts" type="application/atom+xml;type=feed" title="ParentProducts" href="Products(1L)/ParentProducts" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ProductSpecifics" type="application/atom+xml;type=feed" title="ProductSpecifics" href="Products(1L)/ProductSpecifics" />
<category term="Via.BlackBox.Product" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
<d:Id m:type="Edm.Int64">1</d:Id>
<d:UserId m:type="Edm.Int64">2</d:UserId>
<d:ForeignId>987654321</d:ForeignId>
<d:CreationDate m:type="Edm.DateTime">2012-07-01T13:37:43</d:CreationDate>
<d:Title>Apple iPhone 3GS 16 GB - Schwarz (Ohne Simlock) Smartphone</d:Title>
<d:Description><div>Beschreibung für Apple iPhone 3GS 16 GB - Schwarz (Ohne Simlock) Smartphone</div></d:Description>
<d:Price m:type="Edm.Decimal">1299.99</d:Price>
<d:StockAmount m:type="Edm.Int32">100</d:StockAmount>
<d:Ean>0784090091994</d:Ean>
<d:Upc m:null="true" />
<d:Isbn m:null="true" />
<d:ProductType m:type="Edm.Int16">0</d:ProductType>
</m:properties>
</content>
</entry>
Request HTTP-Header
Content-Type: application/json
Accept: application/json
SubscriptionToken: g93af799-6ae8-e111-8406-0050568261dc
Cookie: .ASPXAUTH=0186587E1743637D35632A7EDAF4F07EA67C6E4577770C3778FD9C17904A9D85B01369A8198B23A9AF530DBE93A68687C219BE1876B16B 0DAEBBD2C3318CA6C99D9C53E5B9FE17B7CF9661C5CDDDB97B90D5D3AF550100227EC8D6E6858FAE986AF2302C337B8DFEC6099898C19AA335A81317AB2B382DE72586AA9DF830C715332215AEBFD5E2FBA45F2BB5A7CA9793; path=/; HttpOnly
Request Body
{
"ForeignId" : "987654321",
"Title" : "Apple iPhone 3GS 16 GB - Schwarz (Ohne Simlock) Smartphone",
"Description" : "<div>Beschreibung für Apple iPhone 3GS 16 GB - Schwarz (Ohne Simlock) Smartphone</div>",
"Price" : "1299.99",
"StockAmount" : "100",
"Ean" : "0784090091994",
"ProductType" : "0"
}
Response HTTP-Header
Status Code: 201 Created
Cache-Control: no-cache
Content-Length: 2154
Content-Type: application/atom+xml;charset=utf-8
DataServiceVersion: 1.0;
...
Response Body
{
"d" : {
"__metadata" : {
"uri" : "http://sandboxapi.via.de/publicapi/v1/Api.svc/Products(1L)",
"type" : "Via.BlackBox.Entities.Api.Product"
},
"Id" : "3295",
"ForeignId" : "987654321",
"CreationDate" : "\/Date(1351514288710)\/",
"Title" : "Apple iPhone 3GS 16 GB - Schwarz (Ohne Simlock) Smartphone",
"Description" : "<div>Beschreibung für Apple iPhone 3GS 16 GB - Schwarz (Ohne Simlock) Smartphone</div>",
"Price" : "1299.99",
"StockAmount" : 100,
"Ean" : "0784090091994",
"Upc" : null,
"Isbn" : null,
"ProductType" : 0,
"ModificationDate" : "\/Date(1351514288258)\/",
"MatchingStatus" : 0,
"ProductImages" : {
"__deferred" : {
"uri" : "http://sandboxapi.via.de/publicapi/v1/Api.svc/Products(1L)/ProductImages"
}
},
"ChildProducts" : {
"__deferred" : {
"uri" : "http://sandboxapi.via.de/publicapi/v1/Api.svc/Products(1L)/ChildProducts"
}
},
"ParentProducts" : {
"__deferred" : {
"uri" : "http://sandboxapi.via.de/publicapi/v1/Api.svc/Products(1L)/ParentProducts"
}
},
"ProductSpecifics" : {
"__deferred" : {
"uri" : "http://sandboxapi.via.de/publicapi/v1/Api.svc/Products(1L)/ProductSpecifics"
}
},
"Catalogs" : {
"__deferred" : {
"uri" : "http://sandboxapi.via.de/publicapi/v1/Api.svc/Products(1L)/Catalogs"
}
},
"ListingItems" : {
"__deferred" : {
"uri" : "http://sandboxapi.via.de/publicapi/v1/Api.svc/Products(1L)/ListingItems"
}
},
"Listings" : {
"__deferred" : {
"uri" : "http://sandboxapi.via.de/publicapi/v1/Api.svc/Products(1L)/Listings"
}
}
}
}
Von unserem System wurde diesem neuen Entity eine eindeutige Id 1 zugewiesen.
Die Definition von einem Variationsset erfolgt über das EntitySet Products und dem Property ProductType 1.
Die Details zu den Variationen (SKU, Preis, Ausprägung) werden in den EntitySets ProductVariations bzw. ProductVariationSpecifics definiert.
Im unteren Beispiel wird ein Variationsset "T-Shirt in verschiedenen Grössen und Farben" definiert.
Request Methode
POST http://sandboxapi.via.de/publicapi/v1/api.svc/Products
Request HTTP-Header
Content-Type: application/atom+xml
SubscriptionToken: g93af799-6ae8-e111-8406-0050568261dc
Cookie: .ASPXAUTH=0186587E1743637D35632A7EDAF4F07EA67C6E4577770C3778FD9C17904A9D85B01369A8198B23A9AF530DBE93A68687C219BE1876B16B 0DAEBBD2C3318CA6C99D9C53E5B9FE17B7CF9661C5CDDDB97B90D5D3AF550100227EC8D6E6858FAE986AF2302C337B8DFEC6099898C19AA335A81317AB2B382DE72586AA9DF830C715332215AEBFD5E2FBA45F2BB5A7CA9793; path=/; HttpOnly
Request-Body
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<entry xml:base="http://sandboxapi.via.de/publicapi/v1/api.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
<content type="application/xml">
<m:properties>
<d:ForeignId>987654321</d:ForeignId>
<d:Title>T-Shirt in verschiedenen Grössen und Farben</d:Title>
<d:Description><![CDATA[<div>Beschreibung für das T-Shirt in verschiedenen Grössen und Farben</div>]]></d:Description>
<d:Price>2.99</d:Price>
<d:StockAmount>100</d:StockAmount>
<d:Ean>123456789</d:Ean>
<d:ProductType>1</d:ProductType>
</m:properties>
</content>
</entry>
Response HTTP-Header
Status Code: 201 Created
Cache-Control: no-cache
Content-Length: 2154
Content-Type: application/atom+xml;charset=utf-8
DataServiceVersion: 1.0;
...
Response-Body
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<entry xml:base="http://sandboxapi.via.de/publicapi/v1/api.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
<id>http://sandboxapi.via.de/publicapi/v1/api.svc/Products(5L)</id>
<title type="text"></title>
<updated>2012-08-17T07:26:48Z</updated>
<author>
<name />
</author>
<link rel="edit" title="Product" href="Products(5L)" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ProductImages" type="application/atom+xml;type=feed" title="ProductImages" href="Products(5L)/ProductImages" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ChildProducts" type="application/atom+xml;type=feed" title="ChildProducts" href="Products(5L)/ChildProducts" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ParentProducts" type="application/atom+xml;type=feed" title="ParentProducts" href="Products(5L)/ParentProducts" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ProductSpecifics" type="application/atom+xml;type=feed" title="ProductSpecifics" href="Products(5L)/ProductSpecifics" />
<category term="Via.BlackBox.Product" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
<d:Id m:type="Edm.Int64">5</d:Id>
<d:ForeignId>123457</d:ForeignId>
<d:CreationDate m:type="Edm.DateTime">2012-07-01T13:38:43</d:CreationDate>
<d:Title>T-Shirt in verschiedenen Grössen und Farben</d:Title>
<d:Description><div>Beschreibung für das T-Shirt in verschiedenen Grössen und Farben</div></d:Description>
<d:Price m:type="Edm.Decimal">2.99</d:Price>
<d:StockAmount m:type="Edm.Int32">100</d:StockAmount>
<d:Ean>34509549382</d:Ean>
<d:Upc m:null="true" />
<d:Isbn m:null="true" />
<d:ProductType m:type="Edm.Int16">1</d:ProductType>
</m:properties>
</content>
</entry>
Request HTTP-Header
Content-Type: application/json
SubscriptionToken: g93af799-6ae8-e111-8406-0050568261dc
Cookie: .ASPXAUTH=0186587E1743637D35632A7EDAF4F07EA67C6E4577770C3778FD9C17904A9D85B01369A8198B23A9AF530DBE93A68687C219BE1876B16B 0DAEBBD2C3318CA6C99D9C53E5B9FE17B7CF9661C5CDDDB97B90D5D3AF550100227EC8D6E6858FAE986AF2302C337B8DFEC6099898C19AA335A81317AB2B382DE72586AA9DF830C715332215AEBFD5E2FBA45F2BB5A7CA9793; path=/; HttpOnly
Request-Body
{
"ForeignId": "123457",
"Title": "T-Shirt in verschiedenen Grössen und Farben",
"Description": "<div>Beschreibung für das T-Shirt in verschiedenen Grössen und Farben</div>",
"Price": "2.99",
"StockAmount": "100",
"Ean": "34509549382",
"ProductType": "1"
}
Response HTTP-Header
Status Code: 201 Created
Cache-Control: no-cache
Content-Length: 2154
Content-Type: application/json;charset=utf-8
DataServiceVersion: 1.0;
...
Response-Body
{
d : {
__metadata : {
uri : "http://sandboxapi.via.de/PublicApi/v1/Api.svc/Products(5L)"
type : "Via.BlackBox.Entities.Api.Product"
}
-
Id : "5"
ForeignId : "123457"
CreationDate : "/Date(1381142662547)/"
Title : "T-Shirt in verschiedenen Grössen und Farben"
Description : "<div>Beschreibung für das T-Shirt in verschiedenen Grössen und Farben</div>"
Price : "2.99"
StockAmount : 15
Ean : "34509549382"
Upc : null
Isbn : null
ProductType : 1
ModificationDate : "/Date(1381142662491)/"
MatchingStatus : 0
VatPercent : null
ProductImages : {
__deferred : {
uri : "http://sandboxapi.via.de/PublicApi/v1/Api.svc/Products(5L)/ProductImages"
}
-
}
-
ChildProducts : {
__deferred : {
uri : "http://sandboxapi.via.de/PublicApi/v1/Api.svc/Products(5L)/ChildProducts"
}
-
}
-
ParentProducts : {
__deferred : {
uri : "http://sandboxapi.via.de/PublicApi/v1/Api.svc/Products(5L)/ParentProducts"
}
-
}
-
ProductSpecifics : {
__deferred : {
uri : "http://sandboxapi.via.de/PublicApi/v1/Api.svc/Products(5L)/ProductSpecifics"
}
-
}
-
Catalogs : {
__deferred : {
uri : "http://sandboxapi.via.de/PublicApi/v1/Api.svc/Products(5L)/Catalogs"
}
-
}
-
ListingItems : {
__deferred : {
uri : "http://sandboxapi.via.de/PublicApi/v1/Api.svc/Products(5L)/ListingItems"
}
-
}
-
Listings : {
__deferred : {
uri : "http://sandboxapi.via.de/PublicApi/v1/Api.svc/Products(5L)/Listings"
}
-
}
-
ProductVariations : {
__deferred : {
uri : "http://sandboxapi.via.de/PublicApi/v1/Api.svc/Products(5L)/ProductVariations"
}
-
}
-
DiscountOffers : {
__deferred : {
uri : "http://sandboxapi.via.de/PublicApi/v1/Api.svc/Products(5L)/DiscountOffers"
}
-
}
-
}
-
}
Die Definition von einem Produktset erfolgt über das EntitySet Products und dem Property ProductType 2.
Ein Produktset besteht aus Einzelprodukten ohne Spezifikationen.
Die Zuweisung von Einzelprodukten zu einem Produktset erfolgt über das EntitySet ProductRelations (Siehe dazu Einzelprodukte zu Sets zuweisen).
Im unteren Beispiel wird ein Produktset "Topfset mit 4 verschiedenen Töpfen" (z.B.: 4-tlg. Topfset) definiert.
Request Methode
POST http://sandboxapi.via.de/publicapi/v1/api.svc/Products
Request HTTP-Header
Content-Type: application/atom+xml
SubscriptionToken: g93af799-6ae8-e111-8406-0050568261dc
Cookie: .ASPXAUTH=0186587E1743637D35632A7EDAF4F07EA67C6E4577770C3778FD9C17904A9D85B01369A8198B23A9AF530DBE93A68687C219BE1876B16B 0DAEBBD2C3318CA6C99D9C53E5B9FE17B7CF9661C5CDDDB97B90D5D3AF550100227EC8D6E6858FAE986AF2302C337B8DFEC6099898C19AA335A81317AB2B382DE72586AA9DF830C715332215AEBFD5E2FBA45F2BB5A7CA9793; path=/; HttpOnly
Request-Body
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<entry xml:base="http://sandboxapi.via.de/publicapi/v1/api.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
<content type="application/xml">
<m:properties>
<d:ForeignId>987654321</d:ForeignId>
<d:Title>4-tlg. Topfset</d:Title>
<d:Description><![CDATA[<div>Beschreibung für 4-tlg. Topfset</div>]]></d:Description>
<d:Price>2.99</d:Price>
<d:StockAmount>100</d:StockAmount>
<d:Ean>123456789</d:Ean>
<d:ProductType>2</d:ProductType>
</m:properties>
</content>
</entry>
Response HTTP-Header
Status Code: 201 Created
Cache-Control: no-cache
Content-Length: 2154
Content-Type: application/atom+xml;charset=utf-8
DataServiceVersion: 1.0;
...
Response-Body
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<entry xml:base="http://sandboxapi.via.de/publicapi/v1/api.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
<id>http://sandboxapi.via.de/publicapi/v1/api.svc/Products(10L)</id>
<title type="text"></title>
<updated>2012-08-17T07:26:48Z</updated>
<author>
<name />
</author>
<link rel="edit" title="Product" href="Products(10L)" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ProductImages" type="application/atom+xml;type=feed" title="ProductImages" href="Products(10L)/ProductImages" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ChildProducts" type="application/atom+xml;type=feed" title="ChildProducts" href="Products(10L)/ChildProducts" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ParentProducts" type="application/atom+xml;type=feed" title="ParentProducts" href="Products(10L)/ParentProducts" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ProductSpecifics" type="application/atom+xml;type=feed" title="ProductSpecifics" href="Products(10L)/ProductSpecifics" />
<category term="Via.BlackBox.Product" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
<d:Id m:type="Edm.Int64">10</d:Id>
<d:UserId m:type="Edm.Int64">2</d:UserId>
<d:ForeignId>987654321</d:ForeignId>
<d:CreationDate m:type="Edm.DateTime">2012-07-01T13:39:43</d:CreationDate>
<d:Title>4-tlg. Topfset</d:Title>
<d:Description><div>Beschreibung für das 4-tlg. Topfset</div></d:Description>
<d:Price m:type="Edm.Decimal">99.98</d:Price>
<d:StockAmount m:type="Edm.Int32">100</d:StockAmount>
<d:Ean>123456789</d:Ean>
<d:Upc m:null="true" />
<d:Isbn m:null="true" />
<d:ProductType m:type="Edm.Int16">2</d:ProductType>
</m:properties>
</content>
</entry>
Request HTTP-Header
Content-Type: application/json
Accept: application/json
SubscriptionToken: g93af799-6ae8-e111-8406-0050568261dc
Cookie: .ASPXAUTH=0186587E1743637D35632A7EDAF4F07EA67C6E4577770C3778FD9C17904A9D85B01369A8198B23A9AF530DBE93A68687C219BE1876B16B 0DAEBBD2C3318CA6C99D9C53E5B9FE17B7CF9661C5CDDDB97B90D5D3AF550100227EC8D6E6858FAE986AF2302C337B8DFEC6099898C19AA335A81317AB2B382DE72586AA9DF830C715332215AEBFD5E2FBA45F2BB5A7CA9793; path=/; HttpOnly
Request-Body
{
"ForeignId" : "987654321",
"Title" : "4-tlg. Topfset",
"Description" : "<div>Beschreibung für 4-tlg. Topfset</div>",
"Price" : "29.99",
"StockAmount" : "100",
"Ean" : "123456789",
"ProductType" : "2"
}
Response HTTP-Header
Status Code: 201 Created
Cache-Control: no-cache
Content-Length: 2154
Content-Type: application/atom+xml;charset=utf-8
DataServiceVersion: 1.0;
...
Response-Body
{
"d" : {
"__metadata" : {
"uri" : "http://sandboxapi.via.de/publicapi/v1/Api.svc/Products(10L)",
"type" : "Via.BlackBox.Entities.Api.Product"
},
"Id" : "3296",
"ForeignId" : "987654321",
"CreationDate" : "\/Date(1351514945997)\/",
"Title" : "4-tlg. Topfset",
"Description" : "<div>Beschreibung f\u00fcr 4-tlg. Topfset</div>",
"Price" : "29.99",
"StockAmount" : 100,
"Ean" : "123456789",
"Upc" : null,
"Isbn" : null,
"ProductType" : 2,
"ModificationDate" : "\/Date(1351514945482)\/",
"MatchingStatus" : 0,
"ProductImages" : {
"__deferred" : {
"uri" : "http://sandboxapi.via.de/publicapi/v1/Api.svc/Products(10L)/ProductImages"
}
},
"ChildProducts" : {
"__deferred" : {
"uri" : "http://sandboxapi.via.de/publicapi/v1/Api.svc/Products(10L)/ChildProducts"
}
},
"ParentProducts" : {
"__deferred" : {
"uri" : "http://sandboxapi.via.de/publicapi/v1/Api.svc/Products(10L)/ParentProducts"
}
},
"ProductSpecifics" : {
"__deferred" : {
"uri" : "http://sandboxapi.via.de/publicapi/v1/Api.svc/Products(10L)/ProductSpecifics"
}
},
"Catalogs" : {
"__deferred" : {
"uri" : "http://sandboxapi.via.de/publicapi/v1/Api.svc/Products(10L)/Catalogs"
}
},
"ListingItems" : {
"__deferred" : {
"uri" : "http://sandboxapi.via.de/publicapi/v1/Api.svc/Products(10L)/ListingItems"
}
},
"Listings" : {
"__deferred" : {
"uri" : "http://sandboxapi.via.de/publicapi/v1/Api.svc/Products(10L)/Listings"
}
}
}
}
Products Entities können über die Methode PUT aktualisiert werden.
Eine Änderung eines Entity wird wie bei einem DELETE nur über das Property Id gewährleistet.
Um ein Property eines Entity zu aktualisieren nutzt man folgende URL Syntax
PUT http://sandboxapi.via.de/publicapi/v1/api.svc/Products({Id}L)/{Property}
{Id} entspricht dem Entity und für {Property} gibt man die Bezeichnung eines Property für das EntitySet Products an.
Im unteren Beispiel wird das Property StockAmount (Bestand) für das Entity mit der Id 1 aktualisiert.
Request Methode
PUT http://sandboxapi.via.de/publicapi/v1/api.svc/Products(1L)/StockAmount
Request HTTP-Header
Content-Type: application/atom+xml
SubscriptionToken: g93af799-6ae8-e111-8406-0050568261dc
Cookie: .ASPXAUTH=0186587E1743637D35632A7EDAF4F07EA67C6E4577770C3778FD9C17904A9D85B01369A8198B23A9AF530DBE93A68687C219BE1876B16B 0DAEBBD2C3318CA6C99D9C53E5B9FE17B7CF9661C5CDDDB97B90D5D3AF550100227EC8D6E6858FAE986AF2302C337B8DFEC6099898C19AA335A81317AB2B382DE72586AA9DF830C715332215AEBFD5E2FBA45F2BB5A7CA9793; path=/; HttpOnly
Request Body
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<StockAmount xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
105<StockAmount>
Request HTTP-Header
Content-Type: application/json
Accept: application/json
SubscriptionToken: g93af799-6ae8-e111-8406-0050568261dc
Cookie: .ASPXAUTH=0186587E1743637D35632A7EDAF4F07EA67C6E4577770C3778FD9C17904A9D85B01369A8198B23A9AF530DBE93A68687C219BE1876B16B 0DAEBBD2C3318CA6C99D9C53E5B9FE17B7CF9661C5CDDDB97B90D5D3AF550100227EC8D6E6858FAE986AF2302C337B8DFEC6099898C19AA335A81317AB2B382DE72586AA9DF830C715332215AEBFD5E2FBA45F2BB5A7CA9793; path=/; HttpOnly
Request Body
{
"StockAmount " : "105"
}
Response Header
Status Code: 204 No Content
Cache-Control: no-cache
Connection: Close
Content-Length: 0
...
Products Entities können über die Methode DELETE entfernt werden.
Wird ein Entity aus dem EntitySet Products entfernt, so werden alle Relationen zu diesem Entity in den EntitySets ProductImages, ProductSpecifics und ProductRelations direkt mit entfernt.
Request Methode
DELETE http://sandboxapi.via.de/publicapi/v1/api.svc/Products({Id}L)
{Id} entspricht dem Entity in dem EntitySet Products.
Request Methode
Mit dieser Request wird das Entity mit der Id 1 entfernt.
DELETE http://sandboxapi.via.de/publicapi/v1/api.svc/Products(1L)
Request HTTP-Header
SubscriptionToken: g93af799-6ae8-e111-8406-0050568261dc
Cookie: .ASPXAUTH=0186587E1743637D35632A7EDAF4F07EA67C6E4577770C3778FD9C17904A9D85B01369A8198B23A9AF530DBE93A68687C219BE1876B16B 0DAEBBD2C3318CA6C99D9C53E5B9FE17B7CF9661C5CDDDB97B90D5D3AF550100227EC8D6E6858FAE986AF2302C337B8DFEC6099898C19AA335A81317AB2B382DE72586AA9DF830C715332215AEBFD5E2FBA45F2BB5A7CA9793; path=/; HttpOnly
Das Zuordnen eines Produktes zu einem Katalog erfolgt über den OData Operator $links.
Mit diesem Operator können sogenannte Links angelegt und gelöscht werden.
Im unteren Beispiel wird das Produkt mit der Id 1 dem Katalog mit der Id 1 zugewiesen.
Request Methode
POST http://sandboxapi.via.de/publicapi/v1/api.svc/Products(1L)/$links/Catalogs
Request HTTP-Header
Content-Type: application/atom+xml
SubscriptionToken: g93af799-6ae8-e111-8406-0050568261dc
Cookie: .ASPXAUTH=0186587E1743637D35632A7EDAF4F07EA67C6E4577770C3778FD9C17904A9D85B01369A8198B23A9AF530DBE93A68687C219BE1876B16B 0DAEBBD2C3318CA6C99D9C53E5B9FE17B7CF9661C5CDDDB97B90D5D3AF550100227EC8D6E6858FAE986AF2302C337B8DFEC6099898C19AA335A81317AB2B382DE72586AA9DF830C715332215AEBFD5E2FBA45F2BB5A7CA9793; path=/; HttpOnly
Request Body
<uri xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices">
http://sandboxapi.via.de/publicapi/v1/api.svc/Catalogs(1L)
</uri>
Request HTTP-Header
Content-Type: application/json
Accept: application/json
SubscriptionToken: g93af799-6ae8-e111-8406-0050568261dc
Cookie: .ASPXAUTH=0186587E1743637D35632A7EDAF4F07EA67C6E4577770C3778FD9C17904A9D85B01369A8198B23A9AF530DBE93A68687C219BE1876B16B 0DAEBBD2C3318CA6C99D9C53E5B9FE17B7CF9661C5CDDDB97B90D5D3AF550100227EC8D6E6858FAE986AF2302C337B8DFEC6099898C19AA335A81317AB2B382DE72586AA9DF830C715332215AEBFD5E2FBA45F2BB5A7CA9793; path=/; HttpOnly
Request Body
{
"uri" : "http://sandboxapi.via.de/publicapi/v1/api.svc/Catalogs(1L)"
}
Response HTTP-Header
Status Code: 204 No Content
Cache-Control: no-cache
DataServiceVersion: 1.0;
...
Im unteren Beispiel wird die Zuweisung des Katalog mit der Id 1 zu dem Produkt mit der Id 1 entfernt.
Request Methode
DELETE http://sandboxapi.via.de/publicapi/v1/api.svc/Products(1L)/$links/Catalogs(1L)
Request HTTP-Header
SubscriptionToken: g93af799-6ae8-e111-8406-0050568261dc
Cookie: .ASPXAUTH=0186587E1743637D35632A7EDAF4F07EA67C6E4577770C3778FD9C17904A9D85B01369A8198B23A9AF530DBE93A68687C219BE1876B16B 0DAEBBD2C3318CA6C99D9C53E5B9FE17B7CF9661C5CDDDB97B90D5D3AF550100227EC8D6E6858FAE986AF2302C337B8DFEC6099898C19AA335A81317AB2B382DE72586AA9DF830C715332215AEBFD5E2FBA45F2BB5A7CA9793; path=/; HttpOnly
Response HTTP-Header
Status Code: 204 No Content
Cache-Control: no-cache
DataServiceVersion: 1.0;
...
Mit dem unteren Beispiel kann man prüfen, ob ein bestimmtes Produkt einem bestimmten Katalog schon zu gewiesen ist.
Das Beispiel bezieht sich auf eine Zuweisung des Produktes mit der Id 1 zu dem Katalog mit der Id 1.
Request Methode
GET http://sandboxapi.via.de/publicapi/v1/api.svc/Products(1L)/$links/Catalogs(1L)
Request HTTP-Header
Content-Type: application/xml
SubscriptionToken: g93af799-6ae8-e111-8406-0050568261dc
Cookie: .ASPXAUTH=0186587E1743637D35632A7EDAF4F07EA67C6E4577770C3778FD9C17904A9D85B01369A8198B23A9AF530DBE93A68687C219BE1876B16B 0DAEBBD2C3318CA6C99D9C53E5B9FE17B7CF9661C5CDDDB97B90D5D3AF550100227EC8D6E6858FAE986AF2302C337B8DFEC6099898C19AA335A81317AB2B382DE72586AA9DF830C715332215AEBFD5E2FBA45F2BB5A7CA9793; path=/; HttpOnly
Request Body
Keiner notwendig
Zuweisung vorhanden
Ist eine Zuweisung vorhanden, so ist der Status Code im Response HTTP-Header 200.
Response HTTP-Header
Status Code: 200 OK
Cache-Control: no-cache
Content-Length: 2154
Content-Type: application/xml
DataServiceVersion: 1.0;
...
Response Body
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<uri xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices">http://sandboxapi.via.de/PublicApi/v1/Api.svc/Catalogs(1L)</uri>
Zuweisung nicht vorhanden
Ist eine Zuweisung nicht vorhanden, so ist der Status Code im Response HTTP-Header 400.
Status Code: 404 Not Found
Cache-Control: no-cache
Content-Length: 248
Content-Type: application/xml
DataServiceVersion: 1.0;
...
Response Body
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<code></code>
<message xml:lang="de-DE">Resource not found for the segment 'Catalogs'.</message>
</error>
Request HTTP-Header
Content-Type: application/xml
Accept: application/json
SubscriptionToken: g93af799-6ae8-e111-8406-0050568261dc
Cookie: .ASPXAUTH=0186587E1743637D35632A7EDAF4F07EA67C6E4577770C3778FD9C17904A9D85B01369A8198B23A9AF530DBE93A68687C219BE1876B16B 0DAEBBD2C3318CA6C99D9C53E5B9FE17B7CF9661C5CDDDB97B90D5D3AF550100227EC8D6E6858FAE986AF2302C337B8DFEC6099898C19AA335A81317AB2B382DE72586AA9DF830C715332215AEBFD5E2FBA45F2BB5A7CA9793; path=/; HttpOnly
Request Body
Keiner notwendig
Zuweisung vorhanden
Ist eine Zuweisung vorhanden, so ist der Status Code im Response HTTP-Header 200.
Response HTTP-Header
Status Code: 200 OK
Cache-Control: no-cache
Content-Length: 2154
Content-Type: application/json
DataServiceVersion: 1.0;
...
Response Body
{
"d" : {
"uri" : "http://sandboxapi.via.de/PublicApi/v1/Api.svc/Catalogs(1L)"
}
}
Zuweisung nicht vorhanden
Ist eine Zuweisung nicht vorhanden, so ist der Status Code im Response HTTP-Header 400.
Status Code: 404 Not Found
Cache-Control: no-cache
Content-Length: 248
Content-Type: application/json
DataServiceVersion: 1.0;
...
Response Body
{
"error" : {
"code" : "",
"message" : {
"lang" : "de-DE",
"value" : "Resource not found for the segment 'Catalogs'."
}
}
}