Updates product price data for the product of the given id. All price information gets replaced with the new one.
PUT https://gambio-shop.de/shop1/api.php/v2/products/{product_id}/product_prices
Parameter name | Value | Description | Additional |
---|---|---|---|
product_id | int64 | The product id |
Required |
Read-only parameters such as a resource's ID field are to be omitted.
The request body takes a GXProductPrices resource, containing the following writable properties:
{
"groupPrices": [
{
"customerGroupId": 1,
"graduatedPrices": [
{
"graduatedPrice": 115,
"threshold": 5
},
{
"graduatedPrice": 100,
"threshold": 10
}
],
"groupPrice": 122.122
},
{
"customerGroupId": 2,
"groupPrice": 100
},
{
"customerGroupId": 3,
"graduatedPrices": [
{
"graduatedPrice": 98,
"threshold": 2.5
},
{
"graduatedPrice": 95,
"threshold": 5
},
{
"graduatedPrice": 90,
"threshold": 7.5
}
]
}
],
"price": 123.123
}
{
"groupPrices": [
{
"graduatedPrices": [
{
"graduatedPrice": "double",
"threshold": "double"
}
],
"groupPrice": "double"
}
],
"price": "double"
}
Name | Type | Description | Additional |
---|---|---|---|
groupPrices[] | array | Optional | |
groupPrices[].graduatedPrices[] | array | Optional | |
groupPrices[].graduatedPrices[].graduatedPrice | double | Required | |
groupPrices[].graduatedPrices[].threshold | double | Required | |
groupPrices[].groupPrice | double | Optional | |
price | double | Optional |
In order to provide the authentication, you must insert the Basic Auth inside the HTTP header. The Basic Auth
is an encrypted base64 string that holds the following content: admin@shop.de:12345
where the structure is
as follows: username:password
.
An example header would look as follows:
Authorization: Basic YWRtaW5Ac2hvcC5kZToxMjM0NQ==
This request requires the use of one of following authorisation methods:
BASIC
.
The following HTTP status codes may be returned, optionally with a response resource.
Status code | Description | Resource |
---|---|---|
200 | OK Upon success, returns all price information for the updated product |
GXProductPrices |
400 | Bad Request (Missing or invalid id) |
|
404 | Not Found (Product not found) |
defaultErrorResponse |
Here are some example implementations for this operation.
curl --request PUT \ --header 'authorization: Basic REPLACE_BASIC_AUTH' \ --header 'content-type: application/json' \ --data '{}'
wget --quiet \ --method PUT \ --header 'content-type: application/json' \ --header 'authorization: Basic REPLACE_BASIC_AUTH' \ --body-data '{}' \ --output-document
echo '{}' | \ authorization:'Basic REPLACE_BASIC_AUTH' \ content-type:application/json
HttpResponse response = Unirest.put("https://gambio-shop.de/shop1/api.php/v2/products/{product_id}/product_prices") .header("content-type", "application/json") .header("authorization", "Basic REPLACE_BASIC_AUTH") .body("{}") .asString();
OkHttpClient client = new OkHttpClient(); MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{}"); Request request = new Request.Builder() .put(body) .addHeader("content-type", "application/json") .addHeader("authorization", "Basic REPLACE_BASIC_AUTH") .build(); Response response = client.newCall(request).execute();
var client = new RestClient("https://gambio-shop.de/shop1/api.php/v2/products/{product_id}/product_prices"); var request = new RestRequest(Method.PUT); request.AddHeader("authorization", "Basic REPLACE_BASIC_AUTH"); request.AddHeader("content-type", "application/json"); request.AddParameter("application/json", "{}", ParameterType.RequestBody); IRestResponse response = client.Execute(request);
var http = require("https"); var options = {
"method": "PUT", "hostname": "gambio-shop.de", "port": null, "path": "/shop1/api.php/v2/products/{product_id}/product_prices", "headers": { "content-type": "application/json",
"authorization": "Basic REPLACE_BASIC_AUTH" }
}; var req = http.request(options, function (res) {
var chunks = []; res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString()); });
}); req.write(JSON.stringify({}));
req.end();
var request = require("request"); var options = { method: 'PUT',
url: headers: { authorization: 'Basic REPLACE_BASIC_AUTH', 'content-type': 'application/json' },
body: {},
json: true }; request(options, function (error, response, body) {
if (error) throw new Error(error); console.log(body);
});
var unirest = require("unirest"); var req = unirest("PUT", "https://gambio-shop.de/shop1/api.php/v2/products/{product_id}/product_prices");
req.headers({
"authorization": "Basic REPLACE_BASIC_AUTH", "content-type": "application/json" }); req.type("json");
req.send({}); req.end(function (res) {
if (res.error) throw new Error(res.error); console.log(res.body);
});
var data = JSON.stringify({}); var xhr = new XMLHttpRequest();
xhr.withCredentials = true; xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) { console.log(this.responseText);
}
}); xhr.setRequestHeader("content-type", "application/json"); xhr.setRequestHeader("authorization", "Basic REPLACE_BASIC_AUTH"); xhr.send(data);
var settings = { "async": true, "crossDomain": true, "method": "PUT", "headers": { "content-type": "application/json",
"authorization": "Basic REPLACE_BASIC_AUTH" },
"processData": false, "data": "{}" } $.ajax(settings).done(function (response) {
console.log(response); });
<?php $curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "PUT", CURLOPT_POSTFIELDS => "{}", CURLOPT_HTTPHEADER => array( "authorization: Basic REPLACE_BASIC_AUTH",
"content-type: application/json" ),
)); $response = curl_exec($curl);
$err = curl_error($curl); curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err; } else { echo $response; }
<?php $request = new HttpRequest();
$request->setUrl('https://gambio-shop.de/shop1/api.php/v2/products/{product_id}/product_prices'); $request->setMethod(HTTP_METH_PUT); $request->setHeaders(array(
'authorization' => 'Basic REPLACE_BASIC_AUTH', 'content-type' => 'application/json' )); $request->setBody('{}');
try {
$response = $request->send(); echo $response->getBody();
} catch (HttpException $ex) { echo $ex; }
<?php $client = new http\Client;
$request = new http\Client\Request; $body = new http\Message\Body;
$body->append('{}'); $request->setRequestUrl('https://gambio-shop.de/shop1/api.php/v2/products/{product_id}/product_prices');
$request->setRequestMethod('PUT'); $request->setBody($body); $request->setHeaders(array(
'authorization' => 'Basic REPLACE_BASIC_AUTH', 'content-type' => 'application/json' )); $client->enqueue($request)->send();
$response = $client->getResponse(); echo $response->getBody();
import http.client conn = http.client.HTTPSConnection("gambio-shop.de")
payload = "{}"
headers = {
'content-type': "application/json",
'authorization': "Basic REPLACE_BASIC_AUTH" } conn.request("PUT", "/shop1/api.php/v2/products/{product_id}/product_prices", payload, headers)
res = conn.getresponse()
data = res.read() print(data.decode("utf-8"))
import requests payload = "{}"
headers = { 'content-type': "application/json",
'authorization': "Basic REPLACE_BASIC_AUTH" } response = requests.request("PUT", url, data=payload, headers=headers)
print(response.text)
require 'uri' require 'net/http' http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json' request["authorization"] = 'Basic REPLACE_BASIC_AUTH' request.body = "{}" response = http.request(request)
puts response.read_body
CURL *hnd = curl_easy_init(); curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "https://gambio-shop.de/shop1/api.php/v2/products/{product_id}/product_prices"); struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "authorization: Basic REPLACE_BASIC_AUTH"); headers = curl_slist_append(headers, "content-type: application/json"); curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{}");
CURLcode ret = curl_easy_perform(hnd);
package main import (
"fmt"
"strings" "net/http" "io/ioutil" )
func main() {
url := "https://gambio-shop.de/shop1/api.php/v2/products/{product_id}/product_prices"
payload := strings.NewReader("{}") req, _ := http.NewRequest("PUT", url, payload) req.Header.Add("content-type", "application/json") req.Header.Add("authorization", "Basic REPLACE_BASIC_AUTH") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) }
#import NSDictionary *headers = @{ @"content-type": @"application/json",
@"authorization": @"Basic REPLACE_BASIC_AUTH" };
NSDictionary *parameters = @{ };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://gambio-shop.de/shop1/api.php/v2/products/{product_id}/product_prices"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0]; [request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers]; [request setHTTPBody:postData]; NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) { NSLog(@"%@", error); } else { NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response; NSLog(@"%@", httpResponse); } }]; [dataTask resume];
import Foundation let headers = [
"content-type": "application/json", "authorization": "Basic REPLACE_BASIC_AUTH" ] let parameters = [] let postData = NSJSONSerialization.dataWithJSONObject(parameters, options: nil, error: nil)
var request = NSMutableURLRequest(URL: NSURL(string: "https://gambio-shop.de/shop1/api.php/v2/products/{product_id}/product_prices")!,
cachePolicy: .UseProtocolCachePolicy,
timeoutInterval: 10.0) request.HTTPMethod = "PUT"
request.allHTTPHeaderFields = headers request.HTTPBody = postData let session = NSURLSession.sharedSession()
let dataTask = session.dataTaskWithRequest(request, completionHandler: { (data, response, error) -> Void in if (error != nil) { println(error)
} else {
let httpResponse = response as? NSHTTPURLResponse
println(httpResponse) }
}) dataTask.resume()
open Cohttp_lwt_unix open Cohttp open Lwt let uri = Uri.of_string "https://gambio-shop.de/shop1/api.php/v2/products/{product_id}/product_prices" in
let headers = Header.add_list (Header.init ()) [ ("content-type", "application/json"); ("authorization", "Basic REPLACE_BASIC_AUTH"); ] in let body = Cohttp_lwt_body.of_string "{}" in Client.call ~headers ~body `PUT uri
= fun (res, body_stream) ->
(* Do stuff with the result *)