Discussions

Ask a Question
Back to All

Getting Error 403 while updating inventory

I am trying to update inventory for a product as a test but getting Error 403. I am using PHP. Here is the request which I am sending.

$inventory_array["inventory"][0] = array (
"sku" => "abcdefg",
"warehouse_uuid" => "",
"on_hand" => 50,
);
$unamepwd = "abcdefgh:jklmnopq";
$unamepwd = base64_encode($unamepwd);
$api_call = "https://api.sellbrite.com/v1/inventoy";

$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $api_call );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array ('Content-type: application/json', 'Accept: application/json') );
curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt( $ch, CURLOPT_HTTPHEADER, array("Authorization : Basic ".$unamepwd));
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $inventory_array);
$result = curl_exec( $ch );

$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo "HTTP Code ".$httpcode;

Please advice what is wrong in this request.
Thanks!