VIA-Connect - REST API » DiscountOffers » DiscountOffers-Examples

DiscountOffers-Examples

Zuletzt geändert von Thomas Hoffmann am 2013/10/07 12:24
Kommentare (0) · Anhänge (0) · Historie

Streichpreis definieren

Im unteren Beispiel wird ein Streichpreis für das Product mit der Id 1 erstellt.

Request

Im unteren Beispiel wird ein UVP Streichpreis von 9,99 EUR definiert.

Request Methode


POST                    http://sandboxapi.via.de/publicapi/v1/api.svc/DiscountOffers


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:ProductId>1</d:ProductId>       
       <d:Price>9.99</d:Price>
       <d:Type>1</d:Type>        
     </m:properties>
   </content>
</entry>

Response

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/DiscountOffers(1L)</id>
 <title type="text"></title>
 <updated>2013-10-07T09:51:53Z</updated>
 <author>
   <name />
 </author>
 <link rel="edit" title="DiscountOffer" href="DiscountOffers(1L)" />
 <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Product" type="application/atom+xml;type=entry" title="Product" href="DiscountOffers(1L)/Product" />
 <category term="Via.BlackBox.Entities.Api.DiscountOffer" 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:ProductId m:type="Edm.Int64">1</d:ProductId>
     <d:Type m:type="Edm.Int16">1</d:Type>
     <d:ModifiedDate m:type="Edm.DateTime">2013-10-07T09:51:53.933</d:ModifiedDate>
     <d:Price m:type="Edm.Decimal">9.99</d:Price>
   </m:properties>
 </content>
</entry>

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:ProductId>1</d:ProductId>       
       <d:Price>9.99</d:Price>
       <d:Type>1</d:Type>
       <d:ProductVariationId>1</d:ProductVariationId>
     </m:properties>
   </content>
</entry>

Response

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/DiscountOffers(1L)</id>
 <title type="text"></title>
 <updated>2013-10-07T09:51:53Z</updated>
 <author>
   <name />
 </author>
 <link rel="edit" title="DiscountOffer" href="DiscountOffers(1L)" />
 <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Product" type="application/atom+xml;type=entry" title="Product" href="DiscountOffers(1L)/Product" />
 <category term="Via.BlackBox.Entities.Api.DiscountOffer" 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:ProductId m:type="Edm.Int64">1</d:ProductId>
     <d:Type m:type="Edm.Int16">1</d:Type>
     <d:ModifiedDate m:type="Edm.DateTime">2013-10-07T09:51:53.933</d:ModifiedDate>
     <d:Price m:type="Edm.Decimal">9.99</d:Price>
     <d:ProductVariationId m:type="Edm.Int64">1</d:ProductVariationId>
   </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

{
"ProductId" : "1",
"Price" : "9.99",
"Type" : "1"
}

Response

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/DiscountOffers(1L)",
"type" : "Via.BlackBox.Entities.Api.DiscountOffer"
},
"Id" : "1",
"ProductId" : "1",
"Type" : 1,
"ModifiedDate" : "\/Date(1381140115557)\/",
"Price" : "9.99",
"Product" : {
"__deferred" : {
"uri" : "http://sandboxapi.via.de/PublicApi/v1/Api.svc/DiscountOffers(1L)/Product"
}
}
}
}

Request-Body

{
"ProductId" : "1",
"Price" : "9.99",
"Type" : "1",
       "ProductVariationId" : "1"
}

Response

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/DiscountOffers(1L)",
"type" : "Via.BlackBox.Entities.Api.DiscountOffer"
},
"Id" : "1",
"ProductId" : "1",
"Type" : 1,
"ModifiedDate" : "\/Date(1381140115557)\/",
"Price" : "9.99",
               "ProductVariationId" : "1",
"Product" : {
"__deferred" : {
"uri" : "http://sandboxapi.via.de/PublicApi/v1/Api.svc/DiscountOffers(1L)/Product"
}
}
               "ProductVariation" : {
"__deferred" : {
"uri" : "http://sandboxapi.via.de/PublicApi/v1/Api.svc/DiscountOffers(1L)/ProductVariation"
}
}
}
}

Streichpreis aktualisieren

Request

Im unteren Beispiel wird das Entity mit der Id 1 aktualisiert.

Request Methode


PUT                     http://sandboxapi.via.de/publicapi/v1/api.svc/DiscountOffers(1L)


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:ProductId>1</d:ProductId>       
       <d:Price>8.99</d:Price>
       <d:Type>1</d:Type>
     </m:properties>
   </content>
</entry>

Response

Response HTTP-Header


Status Code:            204 No Content
Cache-Control:          no-cache
Content-Length:         2154
Content-Type:           application/atom+xml;charset=utf-8
DataServiceVersion:     1.0;
...

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:ProductId>1</d:ProductId>       
       <d:Price>8.99</d:Price>
       <d:Type>1</d:Type>
       <d:ProductVariationId>1</d:ProductVariationId>            
     </m:properties>
   </content>
</entry>

Response

Response HTTP-Header


Status Code:            204 No Content
Cache-Control:          no-cache
Content-Length:         2154
Content-Type:           application/atom+xml;charset=utf-8
DataServiceVersion:     1.0;
...


Request HTTP-Header


Content-Type:           application/json
Accept:                 application/json
SubscriptionToken:      g93af799-6ae8-e111-8406-0050568261dc
Cookie:                 .ASPXAUTH=0186587E1743637D35632A7EDAF4F07EA67C6E4577770C3778FD9C17904A9D85B01369A8198B23A9AF530DBE93A68687C219BE1876B16B 0DAEBBD2C3318CA6C99D9C53E5B9FE17B7CF9661C5CDDDB97B90D5D3AF550100227EC8D6E6858FAE986AF2302C337B8DFEC6099898C19AA335A81317AB2B382DE72586AA9DF830C715332215AEBFD5E2FBA45F2BB5A7CA9793; path=/; HttpOnly

Request-Body

{
"ProductId" : "1",
"Price" : "8.99",
"Type" : "1"
}

Response

Response HTTP-Header


Status Code:            204 No Content
Cache-Control:          no-cache
Content-Length:         2154
Content-Type:           application/json;charset=utf-8
DataServiceVersion:     1.0;
...

Request-Body

{
"ProductId" : "1",
"Price" : "8.99",
"Type" : "1",
       "ProductVariationId" : "1"
}

Response

Response HTTP-Header


Status Code:            204 No Content
Cache-Control:          no-cache
Content-Length:         2154
Content-Type:           application/json;charset=utf-8
DataServiceVersion:     1.0;
...

Streichpreis löschen

Request

Im unteren Beispiel das Entity mit der Id 1 entfernt

Request Methode


DELETE                  http://sandboxapi.via.de/publicapi/v1/api.svc/DiscountOffers(1L)

Request HTTP-Header


Content-Type:           application/json
Accept:                 application/json
SubscriptionToken:      g93af799-6ae8-e111-8406-0050568261dc
Cookie:                 .ASPXAUTH=0186587E1743637D35632A7EDAF4F07EA67C6E4577770C3778FD9C17904A9D85B01369A8198B23A9AF530DBE93A68687C219BE1876B16B 0DAEBBD2C3318CA6C99D9C53E5B9FE17B7CF9661C5CDDDB97B90D5D3AF550100227EC8D6E6858FAE986AF2302C337B8DFEC6099898C19AA335A81317AB2B382DE72586AA9DF830C715332215AEBFD5E2FBA45F2BB5A7CA9793; path=/; HttpOnly

Response

Response HTTP-Header


Status Code:            204 No Content
Cache-Control:          no-cache
Content-Length:         2154
Content-Type:           application/json;charset=utf-8
DataServiceVersion:     1.0;
...

Tags:
Erstellt von Thomas Hoffmann am 2013/10/07 11:27

Copyright 2004-2023 XWiki