Hello,
I am integrating a contact form with the Pipedrive API. We are using a token to authenticate. I am trying to send a request to the itemSearch endpoint, but I am getting back a 401 - Unauthorized access. When I run the request on Postman with the same token it works just fine.
I’ve tried also to run the request on other endpoints but I am still getting back the same response.
This is a snippet of the code I am using at the moment:
const searchItem = (searchTerm) => {
const itemSearchAPIUrl = `${baseUrl}/v1/itemSearch?term=${searchTerm}&search_for_related_items=1?api_token=${apiKey}`;
const config = {
method: "get",
url: itemSearchAPIUrl,
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
};