Hello, I’ve been having trouble adding products to deals using the /v1/deals/{id}/products endpoint.
First off, the documentation doesn’t tell you that need the product_id key, but when you add that it doesn’t work when providing valid info. I edited the urls in the errors for obvious reasons. Calls are made from a PHP backend.
This is the code I use for the call:
static::$client->post(static::$url . ‘deals/’ . $deal[‘data’][‘id’] . ‘/products?api_token=’ . static::$key,
[
‘json’ => [
‘product_id’ => 123, // this is a valid id of a product in our pipedrive project
‘name’ => ‘test’,
‘quantity’ => 100,
‘item_price’ => 50,
]
]
);
This code works fine for all the other API call I do in the code, like creating a person or a deal, it’s just messing up when trying to add a product to a deal. When using this code for the api call, I get this error:
Server error: POST https://manufy2.pipedrive.com/v1/deals/{{id}}/products?api_token={{api_token}}
resulted in a 500 Internal Server Error
response:
{“success”:false,“error”:“Something went wrong with the request, please check your request and try again!”,“error_info”: (truncated…)
The funny thing is, when I fill in an incorrect product_id, like 1000000, it’ll return:
Client error: POST https://manufy2.pipedrive.com/v1/deals/{{id}}/products?api_token={{api_token}}
resulted in a 400 Bad Request
response:
{“success”:false,“error”:“Product(s) 1 not found.”,“error_info”:"Please check developers.pipedrive.com for more informat (truncated…)
Anyone having this issue? Or is it something I’m not seeing after staring at it for hours.
Thanks in advance.