APIs & Integrations

nthomson6
Participante

API Key not showing up in request paging link

resolver

Hi there, 

 

I'm currently trying to pull companies from hubspot into azure data factory using "hapikey". When I make the initial request I include the "hapikey" but when I receive the request, it doesn't have the "hapikey" in the "paging.next.link".

 

Is there a reason for this? If I include "limit" as an argument it's returned in the next page link but the "hapikey" isn't.

 

Nic

0 Avaliação positiva
1 Solução aceita
webdew
Solução
Orientador(a) | Parceiro Diamante
Orientador(a) | Parceiro Diamante

API Key not showing up in request paging link

resolver

Hi @nthomson6 ,

Actually, you have to save hapikey into db or any where because hapikey not returning on next page link via using api and next page offset id also need to add in database. Function add in cron job for iteration.

I have a php code for this, please have a look.
<?php

$from_hapikey = 'demo';
$no_of_page = 200;
$offset = DB::table('offsets')->where('id',1)->value('offset');
if($offset != 'done'){

$results = DB::table('offsets')->where('id','>',$offset)->paginate($no_of_page);
$offset_update = 0;

$results = // data get from companies api

if(!empty($results)){
$offset_update = // add last page link id here
} else {
DB::table('offsets')->where('id',1)->update(['offset'=>'done']);
}
foreach ($results as $key => $value) {
// sync here.
}
}
?>


Hope this helps!


If we were able to answer your query, kindly help the community by marking it as a solution.

Thanks and Regards. 

Exibir solução no post original

3 Respostas 3
webdew
Solução
Orientador(a) | Parceiro Diamante
Orientador(a) | Parceiro Diamante

API Key not showing up in request paging link

resolver

Hi @nthomson6 ,

Actually, you have to save hapikey into db or any where because hapikey not returning on next page link via using api and next page offset id also need to add in database. Function add in cron job for iteration.

I have a php code for this, please have a look.
<?php

$from_hapikey = 'demo';
$no_of_page = 200;
$offset = DB::table('offsets')->where('id',1)->value('offset');
if($offset != 'done'){

$results = DB::table('offsets')->where('id','>',$offset)->paginate($no_of_page);
$offset_update = 0;

$results = // data get from companies api

if(!empty($results)){
$offset_update = // add last page link id here
} else {
DB::table('offsets')->where('id',1)->update(['offset'=>'done']);
}
foreach ($results as $key => $value) {
// sync here.
}
}
?>


Hope this helps!


If we were able to answer your query, kindly help the community by marking it as a solution.

Thanks and Regards. 

nthomson6
Participante

API Key not showing up in request paging link

resolver

This is an interesting response, I was doing this on azure data factory (frustratingly I use python normally and it's very simple in python), iterating through the "after" parameter in a similar way to how you describe (I think since I'm not great with php) was able to sort it. 

 

Thanks!

dennisedson
Equipe de Produto da HubSpot
Equipe de Produto da HubSpot

API Key not showing up in request paging link

resolver

@nthomson6 

Have you thought about using OAuth as an alternative?  That is what we encourage developers to use

@johnelmer , do you have any suggestions?

0 Avaliação positiva