Issue with POST - Add product to deal

Hello. I’m having issues adding products to a deal. The below code was working until the last update (March 29). Now, I get an error:

‘product_id’ must be integer, ‘item_price’ must be number, ‘quantity’ must be number, ‘discount_percentage’ must match a schema in anyOf

#PHP CODE for Adding Product to Deal
$prod_id = 23;
$prod_price = 332.12;
$s_discount = 0.15;

$data = array(
    'product_id' => (int)$prod_id, 
    'item_price' => (float)$prod_price,
    'quantity' => 1,
    'discount_percentage' => (float)$s_discount,
// URL for updating a Deal
$url = 'https://'.$company.'' . $api_token;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$output = curl_exec($ch);

Try alter the method to PUT

Hello, @Greg_Chang and welcome to the community! :wave:

We have improved our validation for this endpoint to make sure that the correct data is supplied and the endpoint works based on our documented data types - here is the API documentation for adding products to a deal.

Looking at the error message, it seems that you are not suppling the product_id as an integer, and other parameters as a number.

Could you review your request payload to be according to our documentation and let us know if you still experience any issues. Thank you! :slight_smile: