Hi everyone,
I come back with a new problem including vue js with the beta:
I saw different problem talking about that, I don’t understand if severless function can help but I still fill strange if I need to use it to go through it.
So the point is :
1- show rows from hubdb using the get method(
https://api.hubapi.com/hubdb/api/v2/tables/)
: ok
2- show a specific row and edit it via get function method: ok
3- update row via put(v2 or v3, or patch(v3) : not work
i’m using axios to call the api, I get the famous message:
Access to XMLHttpRequest at ‘https://api.hubapi.com/hubdb/api/v3/tables/527xxx/rows/540843xxx?hapikey=eefcdea1-xxxx-48bd-bcxx-48xxxxx’ from origin ‘http://hubspot-developers-onhdqe-xxxxxxxx.hs-sites.com’ has been blocked by CORS policy: Method PUT is not allowed by Access-Control-Allow-Methods in preflight response.
I get the same message on v2, v3 put and patch
The code I used to make the call is the following one:
let updateContentUrl = URL.EDIT_INSIGHT + this.insightId + URL.API_KEY;
const headers = {
"Content-Type": "application/json",
"Access-Control-Allow-Credentials": true,
"Access-Control-Allow-Headers": "Origin, X-Requested-With, Content-Type, Accept, Accept-Charset, Accept-Encoding",
"Access-Control-Allow-Methods": "PUT"
};
return axios.put(updateContentUrl, jsonFinal, { headers })
.then( response => (console.log(response)))
.catch(error => console.log(error))
I add one precision, I integrate the vue project as a module and I use it directly inside hubspot. My goal is to access/use the API directly within Hubspot so I can’t aford to use this project outside to fix the problem.
If someone can tell me if I missed something or I need to use an alternative way to update it is welcome.
Thanks for the help you can provide.
Kind regards.
Joan Varnavant