APIs & Integrations

nthomson6
Participant

API Key not showing up in request paging link

Résolue

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 Votes
1 Solution acceptée
webdew
Solution
Guide | Partenaire solutions Diamond
Guide | Partenaire solutions Diamond

API Key not showing up in request paging link

Résolue

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. 

Voir la solution dans l'envoi d'origine

3 Réponses
webdew
Solution
Guide | Partenaire solutions Diamond
Guide | Partenaire solutions Diamond

API Key not showing up in request paging link

Résolue

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
Participant

API Key not showing up in request paging link

Résolue

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
Équipe de développement de HubSpot
Équipe de développement de HubSpot

API Key not showing up in request paging link

Résolue

@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 Votes