Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Need you expert help.
The requirement is to pull all chat data from REST API (one time full data dump) and then pull chat on daily basis.The output is spread across 180K pages with each page giving URL to next and previous (except first page which have only 'nex_url' and last page with have only 'prev_url').
So Far I have been able to use the API/URL to extract information from first page first page
tRestClient ->tJavaRow->tJsonExtract->tOracleOut
How do I modify the job to
1) Pull all data for one time data dump, 180k pages
2) Pull data on daily basis for current day or extract data until the timestamp is current day.
Example output from API
Page 1 gives
{
"chats": [
all chat related attributes that needs to imported
],
"count": 179451,
"next_url": "next_url_here"
}
Page2 gives
{
"chats": [
all chat related attributes that needs to imported
],
"count": 179451
"prev_url": "previous_url_here"
"next_url": "next_url_here"
}
Page 3 gives ......next page
@rhall: What I have been told is it should be in the HTTP response header.
It is dynamically generated by the API service so its not stored any where.
If your max pages is kept in the response header, you can use this post I put together a while ago to help you out. The code in the post should just work (in printing out the header information). You will need to manipulate it to get hold of the max pages.
@rhall: No I do not have max value or anything stored. But this is how I am getting the link header value.
if (((Integer)globalMap.get("i"))==null)
{
globalMap.put("has_more", false);
The job runs in iteration but gets into infinite loop. However, when I print value in tJava for i it keeps showing me value incrementing which is correct but result is shown only for first page 1 even though when i becomes 2 or 3 or 4......
Seems my if condition is wrong or something else. Is it something you can advise me on or is there any way I can use any Link Header values to create a loop?
HI @gr44: Your advise is really appreciated as well this in case. Thanks.
This is not stopping because "has_more" is never set to false. This is happening because "i" is never null. So, you need to solve why "i" is not set to null. Where do you set "i" and how do you set it?
@rhall: What I found is has_more is just useless and not doing anything. I think I am going to get rid but not sure how to stop i. Can you please give hint?
@rhall: Also Can you please provide screenshots for what you set in globalmap, tflex and tloop in your example?
I suspect that "i" is never null. You need to look at that I believe
@rhall: Is there any other way I can find what's going to be max/last page in url?
@rhall: Is there a way to access this info from Talend which is present in header?
Link →<https://abc.com/api/v1/courses/513/analytics/student_summaries?page=1&per_page=10>; rel="current",<https://abc.instructure.com/api/v1/courses/513/analytics/student_summaries?page=2&per_page=10>; rel="next",<https://abc.instructure.com/api/v1/courses/513/analytics/student_summaries?page=1&per_page=10>; rel="first",<https://abc.instructure.com/api/v1/courses/513/analytics/student_summaries?page=75&per_page=10>; rel="last"
Yes, there is. I gave you a link about 8 posts above this one. You will need to use Java.