Invoke REST API and store the json response to snowflake table

I want to invoke the REST API and the API params will be dynamic. params will be start_date and end_date. end_date should be current_timestamp and start_date should be 1 day before. I could use custom connector for static API endpoint, but is it possible to pass those dates to the API endpoint dynamically?

 

If not, I was thinking of writing python script. how can I do this and I was getting this error in python pushdown

 

Python Interpreter Error:

ConnectionError: HTTPSConnectionPool(host='jsonplaceholder.typicode.com', port=443): Max retries exceeded with url: /todos (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0xffff716f5db0>: Failed to resolve 'jsonplaceholder.typicode.com' ([Errno -3] Temporary failure in name resolution)"))

Script failed

 

I want to store the json response in snowflake variant column.

 

Please help answer this issue

Hello,

 

Both the API Extract and API Query offer a way to pass values (your start_date and end_date) dynamically. Because this endpoint seems to offer JSON response, I'd recommend the API Extract method. In the API Extract wizards, you will be able to set query/URI/header parameters. Those parameters will be editable in the API Extract component when you use it in an orchestration.

 

The API Extract will stage your response in a table, the whole response body being in a variant column.

 

Best of luck!

 

Brendan