Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
BIUser22
New Member

Problem with Hotmart API

BIUser22_0-1675831990648.png

Hello guys, this is my code and when i apply, appear this error > unable to authenticate with the credentials provided. Try again

What i can do to solve? 

6 REPLIES 6
Edinei77
New Member

Estou tentando gerar o token e acaba dando este erro abaixo. Aconteceu com alguem?

Erro na consulta ‘’. DataSource.Error: Há suporte para Web.Contents com a opção Content somente durante uma conexão anônima.

ClaudiaRocha
Regular Visitor

Eu fiz praticamente igual a você e deu certo. Veja se os dados não estão errados.

 

Inicialmente não fiz como função, mas ao fazer a request e a paginação, vimos a necessidade de fazer como função. Agora meu desafio está em fazer a atualização funcionar no Power BI Web. getauth hotmart.jpg

 

Você conseguiu puxar algum tipo de tabela com este código? não estou conseguindo

Essa função é só pra gerar o token...

 

Fiz uma segunda função pra gerar as tabelas e outra pra paginação.

 

Segue os nomes que usei pra vc entender a função:

Função para gerar token: getAuth

Função para gerar dados: getSales

Função da paginação: paginationSales

 

Função para gerar a tabela:

 

(optional request as text) =>
let
request = if request is null then
Json.Document(
Web.Contents
("https://developers.hotmart.com/payments/api/v1/sales/history",
[Query = [start_date = "1622505600000"],
Headers =[Authorization = getAuth()]]
)
)
else
Json.Document(
Web.Contents
("https://developers.hotmart.com/payments/api/v1/sales/history",
[Query = [start_date = "1622505600000", page_token=request],
Headers = [Authorization = getAuth()]]
)
)

in
request

 

 

Função para paginação:

 

(optional resource as text , optional results as list) as list =>

let
currentResponse = requestSales(resource),
token = try currentResponse [page_info][next_page_token] otherwise 0,
currentResults = if results is null then {currentResponse[items]} else List.Combine({results, {currentResponse[items]}}),
output = if token = 0 then
currentResults
else
@paginationSales (token, currentResults)
in
output

 

Olá Cláudia, tentei rodar esse código de paginação, mas meu power bi retornou que não reconhece o requestSales. Pode me ajudar?

Refiz o código e ele funcionou, não faço ideia do que aconteceu 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.