I'm trying to retrieve a view with the (Node)Date Created argument. However I don't seem to be able to get it to work right, when I send it though cURL. Here is my code:
$method = 'views.get';
$hash = hash_hmac('sha256', $timestamp .';'.$domain .';'. $nonce .';'. $method, $api_key);
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_URL, 'http://site.com/services/json');
$date = $_GET['date'];
$data = array(
'method' => '"'. $method .'"',
'hash' => '"'. $hash .'"',
'domain_name' => '"'. $domain .'"',
'domain_time_stamp' => '"'. $timestamp .'"',
'nonce' => '"'. $nonce .'"',
'sessid' => '"'. $sessid .'"',
'view_name' => '"frontpage"',
'args' => '"'. $date .'"'
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$json_result = curl_exec($ch);
I'm guessing its processing args somehow, as it returns [] with that, and when I remove 'args' =>.... it runs with the wildcard setting.
Have you tried using Views datasource? It prints out JSON, and you can still pass an argument to your view.
We have no way of knowing how you configured the date argument in your View, but it is certain that Views lets you configure a date argument:
Here's an example date range in Views.
And you can continue to use CURL to fetch the JSON from your View while using Views datasource as well. Then you could pass the date into the the request as such:
curl_setopt($ch, CURLOPT_URL, 'http://site.com/myjsonview/2011-01-11--2011-03-11');