The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Data Stream Errors on Empty Rest Response

Brian G
Tera Contributor

Currently I'm creating a flow that has 2 API steps

 

1. First step there is an API call to pull a list of projects from google cloud

2. For Each project from step 1 a rest call needs to be sent to pull each Project record's Accounts

This step requires pagination to be used so a Datastream is being used for this.

 

I have this partially working, but am running into a rather puzzling issue.

 

if a project has accounts under it the response looks like:

 

{
"accounts": [
{
"name": "projects/prj-infrastructure-global-001/serviceAccounts/sa-grafana-sandbox@prj-infrastructure-global-001.iam.gserviceaccount.com",
"projectId": "prj-infrastructure-global-001",
"uniqueId": "102034640071361008578",
"email": "sa-grafana-sandbox@prj-infrastructure-global-001.iam.gserviceaccount.com",
"displayName": "sa-grafana-sandbox",
"etag": "MDEwMjE5MjA=",
"description": "reads metrics from cloud monitor",
"oauth2ClientId": "102034640071361008578"
},...etc

]

 

However, if a project doesn't have any accounts under it the response body will be empty: {}

 

I have my splitter step configured to look for $.accounts, but this fails with "Could not find path in stream: $.accounts" when i hit project with no accounts and the response is empty.

 

What options do I have to code around a empty response situation like the above?

5 REPLIES 5

Brian G
Tera Contributor

Attaching DS1-9 showing on screen setup of Datasource