Forum Discussion
Error on API Query
- Anonymous8 years ago
Hi eduardomaia,
According to error message, it seems like you got service related error message.
I think you need to check that api if they had limitations who not allow you send too many requests at same time.
Regards,
Xiaoxin Sheng
All the steps are:
First the following blank query:
(pag as number) as table =>
let
apiUrl = "https://api.spotter.exactsales.com.br/api/v2/listarlead?page=" & Number.ToText(pag),
options = [Headers =[#"token_exact"="mytoken"]],
result = Web.Contents(apiUrl , options),
#"JSON Importado" = Json.Document(result,1252),
#"Convertido em Tabela" = Table.FromList(#"JSON Importado", Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expandido Column1" = Table.ExpandRecordColumn(#"Convertido em Tabela", "Column1", {"id", "Empresa", "DtCadastro", "DtAtualizacao", "Origem", "PreVendedor", "Vendedor", "Etapas"}, {"Column1.id", "Column1.Empresa", "Column1.DtCadastro", "Column1.DtAtualizacao", "Column1.Origem", "Column1.PreVendedor", "Column1.Vendedor", "Column1.Etapas"}),
#"Expandido Column1.Origem" = Table.ExpandRecordColumn(#"Expandido Column1", "Column1.Origem", {"value"}, {"Column1.Origem.value"}),
#"Expandido Column1.PreVendedor" = Table.ExpandRecordColumn(#"Expandido Column1.Origem", "Column1.PreVendedor", {"Nome", "UltimoNome"}, {"Column1.PreVendedor.Nome", "Column1.PreVendedor.UltimoNome"}),
#"Colunas com Nome Mudado" = Table.RenameColumns(#"Expandido Column1.PreVendedor",{{"Column1.id", "ID_EXACT_LEAD"}, {"Column1.Empresa", "NM_COMPANY"}, {"Column1.DtCadastro", "DT_REGISTER"}, {"Column1.DtAtualizacao", "DT_LAST_UPDATE"}, {"Column1.Origem.value", "NM_ORIGIN"}}),
#"Colunas Intercaladas" = Table.CombineColumns(#"Colunas com Nome Mudado",{"Column1.PreVendedor.Nome", "Column1.PreVendedor.UltimoNome"},Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),"NM_SDR"),
#"Expandido Column1.Vendedor" = Table.ExpandRecordColumn(#"Colunas Intercaladas", "Column1.Vendedor", {"Nome", "UltimoNome"}, {"Column1.Vendedor.Nome", "Column1.Vendedor.UltimoNome"}),
#"Colunas Intercaladas1" = Table.CombineColumns(#"Expandido Column1.Vendedor",{"Column1.Vendedor.Nome", "Column1.Vendedor.UltimoNome"},Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),"NM_SALESMAN"),
#"Tipo Alterado" = Table.TransformColumnTypes(#"Colunas Intercaladas1",{{"DT_REGISTER", type datetime}, {"DT_LAST_UPDATE", type datetime}}),
#"Colunas com Nome Mudado1" = Table.RenameColumns(#"Tipo Alterado",{{"Column1.Etapas", "DE_STAGE"}}),
#"Expandido DE_STAGE" = Table.ExpandListColumn(#"Colunas com Nome Mudado1", "DE_STAGE"),
#"Expandido DE_STAGE1" = Table.ExpandRecordColumn(#"Expandido DE_STAGE", "DE_STAGE", {"Etapa", "Qualificacao", "DtAvaliacao"}, {"DE_STAGE.Etapa", "DE_STAGE.Qualificacao", "DE_STAGE.DtAvaliacao"}),
#"Colunas com Nome Mudado2" = Table.RenameColumns(#"Expandido DE_STAGE1",{{"DE_STAGE.Qualificacao", "DE_HEAT"}, {"DE_STAGE.Etapa", "DE_STAGE"}, {"DE_STAGE.DtAvaliacao", "DT_AVALIATION"}}),
#"Tipo Alterado1" = Table.TransformColumnTypes(#"Colunas com Nome Mudado2",{{"DT_AVALIATION", type datetime}})
in
#"Tipo Alterado1"
After that I've created a new table with the range 1 to 20.
When I create the column to vinculate the initial query with the column the API returned with all the correct data.
After pressing apply and close I receive that error.
- Anonymous8 years agoNot applicable
Hi eduardomaia,
According to error message, it seems like you got service related error message.
I think you need to check that api if they had limitations who not allow you send too many requests at same time.
Regards,
Xiaoxin Sheng
- eduardomaia8 years agoFrequent Visitor
Xiaoxin,
Thank you for your reply.
Indeed, I've simulated run the same script on ViperStresser and realized it was on the API.
Anyway, found a possibility and now I'm getting all data in a single page query.
Thanks again.
Regards,Eduardo Maia