All Apps and Add-ons

Add-On Builder - How to pull multiple pages from REST endpoint

kmfpo
Explorer

I built a simple TA using the Add-On Builder (v3.0.1) on Splunk 8.0.4.  Once thing I noticed is that the TA only pulls the first page of results and at the bottom of the pulled data are URLs for the existing, next, and last pages.

How do I configure this so that my TA iterates through all the pages?  I thought it would be using the checkpoint settings, but I'm not sure how to set that up.  I am not a developer so this endeavor has been a tough learning experience.  Splunk documentation lacks examples for these things.

The API I am pulling from says I can use page[number] and page[size] but I don't know how to have the TA pull from 1 to last (6 in this case).

Existing Setup

REST URL: 

 

https://api.website.com/${rest_endpoint}?page[number]=${page_number}

 

Event Extraction settings

JSON path

 

$.data

 

Checkpoint settings

Checkpoint parameter name: page_number

Checkpoint field path: $.links.last

Checkpoint initial value: 1

My Data

 

{
	"data":[
		{
			 "id":"52", 
			 "type":"report", 
			"attributes":{
				 "name":"Bonorum", 
				 "description":"Lorem ipsum dolor sit amet.",
				 "created_at":"2019-01-05T01:51:19.000Z" 
			}
		},
		{
			 "id":"7", 
			 "type":"report", 
			"attributes":{
				 "name":"Perspiciatis", 
				 "description":"Quia dolor sit amet.", 
				 "created_at":"2017-01-05T01:51:19.000Z" 
			}
		}
	],
	"links":{
		 "self":"https://api.website.com/reports?page%5Bnumber%5D=1", 
		 "next":"https://api.website.com/reports?page%5Bnumber%5D=2", 
		 "last":"https://api.website.com/reports?page%5Bnumber%5D=6"
	}
}

 

Labels (1)
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...