Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: run_saved_Import Filename Parameter

Status Resolved
Add-on / Version DataGrab 4.1.0
Severity
EE Version 6.3.5

Todd Jackson

Oct 18, 2022

With the previous version of Datagrab, I would use run_saved_import a lot using the Filename parameter.

My workflow would be - first create the import I needed for the API for one specific venue.

Then I would later use the venue_id for another venue as a segment variable on a template with the run_saved_import tag. The filename parameter of that run_saved_import tag would be modified by the segment_variable (the venue_id).

However it appears the new version of Datagrab has removed that Filename parameter. Is it possible to get it’s return? It created a lot of functionality - I could change the parameters of the API by using segment variables and without having to recreate the import inside Datagrab.

Cloning the imports would be an option but I do this not only for venues but also for specific performers - I’d be cloning the same import for almost a 1,000 items and if I had to change that import for another reason, I’d have to do that again. Modifying the filename I import seems far more flexible and easier to maintain in the long run.

-Todd

#1

BoldMinded (Brian)

Can you be more specific? You said in a previous version… do you have screenshots of what you’re trying to do? Template code or import configs? I’m not entirely sure I’m following.

The filename option still exists. run_saved_import() just calls run_action(). The template parameter name isn’t there, but it still responds to the GET parameter: some-url.php/?filename=whatever

#2

Todd Jackson

The filename GET value probably will handle this going forward… I’ll have to test it out to be sure, but here’s my outline of how I was handling this with Datagrab 3.0.3

I’m doing this via template code. Essentially I would do this via URL. For example I get events from an API via a URL (I’m changing some stuff to keep my API key and info hidden)

{exp:ajw_datagrab:run_saved_import id="1" filename="https://api.eventsite.com/events.json?apikey=blahblahblah&performerId;={segment_3}"}

Or another example is one like this - I’m getting newly added events for a particular day - today - but just in case something fails I can also check tomorrow or jump ahead for another. I also have a second parameter here. Sometimes APIs only allow you to get the first page of results with a predetermined limit of 50. but if there’s more than 50 I want to grab those too. So I can get the next 50 by adding a second segment that only turns on the page parameter when I need it.

{exp:ajw_datagrab:run_saved_import id="1" filename=https://api.eventsite.com/events.json?apikey=blahblahblah&classificationName=jazz&onsaleDate;={if segment_3 == "today"}{current_time format="%Y-%m-%d"}{if:else}{segment_3}{/if}{if segment_4}&page;={segment_4}{/if}"}

Both run from the same Saved Import but I’m using different filename request that I’m setting via template code and segment variables.

-Todd

#3

BoldMinded (Brian)

Comment has been marked private.

#4

Todd Jackson

Comment has been marked private.

#5

BoldMinded (Brian)

I’m going to resolve this ticket b/c the code was added and it’ll be included in the next release.

#6

Todd Jackson

Comment has been marked private.

#7

Todd Jackson

Comment has been marked private.

#8

Todd Jackson

Comment has been marked private.

#9

BoldMinded (Brian)

Comment has been marked private.

#10

Todd Jackson

This works perfectly. Thank you.

-Todd

#11

BoldMinded (Brian)

Awesome! I’ll go ahead and close this out then 😊

Login to reply