Hi,
This is a feature request. I'm missing support for placeholders in "params" section of child jobs.
For example this configuration:
{
"parameters": {
"api": {
"baseUrl": "https://graph.facebook.com/v16.0/"
},
"config": {
"outputBucket": "fcb-generic",
"jobs": [
{
"endpoint": "me/accounts",
"params": {
"fields": "name,id,access_token"
},
"dataField": "data",
"children": [
{
"endpoint": "{PAGE_ID}/feed",
"params": {
"fields": "id,created_time,message,full_picture,permalink_url,is_expired,is_hidden,shares",
"access_token": "{PAGE_ACCESS_TOKEN}"
},
"placeholders": {
"PAGE_ID": "id",
"PAGE_ACCESS_TOKEN": "access_token"
},
"dataField": "data"
}
]
}
]
}
}
}
I need to have in params section {PAGE_ACCESS_TOKEN} replaced with the value returned by the parent job. But currently this is not possible, only endpoint supports placeholders.
I made a quick hack with my limited php knowledge that works for me:
diff --git a/src/GenericExtractorJob.php b/src/GenericExtractorJob.php
index 6c2f0cb..47f6af4 100755
--- a/src/GenericExtractorJob.php
+++ b/src/GenericExtractorJob.php
@@ -100,6 +100,15 @@ class GenericExtractorJob
$params['value'],
$this->config->getConfig()['endpoint']
));
+ $new_params = array();
+ foreach ($this->config->getParams() as $key => $val) {
+ $new_params[$key] = (str_replace(
+ "{{$params['placeholder']}}",
+ $params['value'],
+ $val
+ ));
+ }
+ $this->config->setParams($new_params);
}
}
Thanks for considering this feature.
Hi,
This is a feature request. I'm missing support for placeholders in "params" section of child jobs.
For example this configuration:
{ "parameters": { "api": { "baseUrl": "https://graph.facebook.com/v16.0/" }, "config": { "outputBucket": "fcb-generic", "jobs": [ { "endpoint": "me/accounts", "params": { "fields": "name,id,access_token" }, "dataField": "data", "children": [ { "endpoint": "{PAGE_ID}/feed", "params": { "fields": "id,created_time,message,full_picture,permalink_url,is_expired,is_hidden,shares", "access_token": "{PAGE_ACCESS_TOKEN}" }, "placeholders": { "PAGE_ID": "id", "PAGE_ACCESS_TOKEN": "access_token" }, "dataField": "data" } ] } ] } } }I need to have in
paramssection{PAGE_ACCESS_TOKEN}replaced with the value returned by the parent job. But currently this is not possible, onlyendpointsupports placeholders.I made a quick hack with my limited php knowledge that works for me:
Thanks for considering this feature.