API Key not showing up in request paging link

SOLVE
nthomson6
Participant

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 Upvotes
1 Accepted solution

Accepted Solutions
webdew
Solution
Top Contributor | Diamond Partner

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. 

View solution in original post

3 Replies 3
dennisedson
Community Manager

@nthomson6 

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

@johnelmer , do you have any suggestions?

Thanks,

Dennis




Check out our Community Developer Blog
where we feature our Community driven developer podcast and how to content
0 Upvotes
webdew
Solution
Top Contributor | Diamond Partner

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. 

View solution in original post

nthomson6
Participant

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!