Request to VTEX API from custom component

Hello VTEX Community!

I will try to send a request to the VTEX API of the fixed prices since a custom component because the product context doesn’t have the fixed prices from a product.

I’m using AXIOS to do the request but it doesn’t works the console send me the error that the apptoken it’s not allowed in the headers but its is… some one tried this kind of integrations in the past?

 const options = {
    headers: {  
        'x-vtex-api-appkey':"vtexappkey-account-id",  
        'x-vtex-api-apptoken':"token",
      }
    }
  
   const getFixesPrices = () => {
     axios
     .get(`https://api.vtex.com/account/pricing/prices/1/fixed`,options)
     .then(response => console.log(response))
   }

1 Like

In the URL:

https://api.vtex.com/{account}/pricing/prices/1/fixed

The {account} path variable should be replaced with your account name:

https://api.vtex.com/mystore/pricing/prices/1/fixed

1 Like

Hey @marconacianceno! Have you checked out this documentation? The client you need may already be implemented on the @vtex/clients package. Check it out on Github:

1 Like