Facebook Marketing API Between Relative Dates - facebook

I know I can retrieve data from the API between two specified dates like so:
https://graph.facebook.com/v2.5/act_xxxxxx/insights?level=ad&fields=ad_name,adset_name,campaign_name,spend,unique_clicks,clicks,impressions,cost_per_unique_click,cpm,ctr&sort=spend_descending&time_range[since]=2016-04-01&time_range[until]=2016-04-16
Is there a way to retrieve the data from the API using relative dates from today? Such as this psuedocode:
https://graph.facebook.com/v2.5/act_xxxxxx/insights?level=ad&fields=ad_name,adset_name,campaign_name,spend,unique_clicks,clicks,impressions,cost_per_unique_click,cpm,ctr&sort=spend_descending&time_range[since]=15 DAYS AGO&time_range[until]=7 DAYS AGO

Yes and no.
We do support a list of date presets
And they are defined in:
https://developers.facebook.com/docs/marketing-api/reference/ad-account/insights/
Or you can check our php SDK:
https://github.com/facebook/facebook-php-ads-sdk/blob/613d89fbe0424d017a5156658b4e324fbfb5be68/src/FacebookAds/Object/Values/AdsInsightsDatePresetValues.php
https://github.com/facebook/facebook-php-ads-sdk/blob/d51193b19d730ae9274d45540986e1ac311b074d/src/FacebookAds/Object/AdsInsights.php#L72
In curl you will just use date_preset parameter instead of since

Related

Using REST to filter Share Point date field

I need to filter the date in wish an item was received in a SharePoint list using REST. I have it partially working, but I have a problem. I'm using a Datepicker to select the date I'm using as filter, but when the date is picked and converted to an acceptable format using toISOString(), I get an "exact" date (e.g. 2018-06-15T00:00:00.000Z). The issue with that is that the Date portion (2018-06-15) matches OK, but not the Time portion, because the datepicker will always give a different time (HH:MM:SS) than the SharePoint list entry.
This is what I'm using:
... $filter=Date_Received eq datetime'2018-05-11T04:00:00.000Z'
I have several items that were entered on 6/15/2018, but I get no values, because the time they were entered was different (e.g. 2018-06-15T05:00:00Z). Is there a way to use something like substringof to filter dates, or does anyone has a workaround?
Thanks in advance.
Dates in SharePoint are stored in GMT. So the times recorded are London times.
Option 1 - Use ranges:
$filter=Date_Received gt datetime'2018-05-10T20:00:00.000Z' and Date_Received lt datetime'2018-05-11T20:00:00.000Z'
If you are not looking for files near midnight then:
$filter=Date_Received gt datetime'2018-05-11T00:00:00.000Z' and Date_Received lt datetime'2018-05-11T23:59:59.000Z'
Option 2 - Use the SharePoint 2010 REST API and date functions:
/sites/yourSite/_vti_bin/listdata.svc/yourList?$filter=year(Date_Received) eq 2018 and month(Date_Received) eq 5 and day(Date_Received) eq 11
This still has an issue for dates around midnight due to GMT.
Option 3 - Use SharePoint 2010 REST API with a calculated column:
Add a Calculated column named Date_Received_Text as: =TEXT(Date_Received,"yyyy-mm-dd")
/sites/yourSite/_vti_bin/listdata.svc/yourList?$filter=Date_Received_Text eq '2018-07-08'
Same midnight issue...
Note: The 2010 API still works in SharePoint Online.

Date format in HTTP GET for test/runs azure DevOps API query

I'm attempting to call the Azure DevOps API to determine the outcome for test runs using the URL, narrowing the results to a single releaseEnvId:
https://dev.azure.com/organisation/project/_apis/test/runs?api-version=5.0&releaseEnvIds=12345&minLastUpdatedDate=2019-05-17T14:00:00.910Z&maxLastUpdatedDate=2019-05-15T14:00:00.910Z
The API request requires two mandatory date-time fields, but the doc at https://learn.microsoft.com/en-us/rest/api/azure/devops/test/runs/query?view=azure-devops-rest-5.0 does not specify the format:
maxLastUpdatedDate
minLastUpdatedDate
The date-time format I am specifying is wrong because the error comes up:
{"$id":"1","innerException":null,"message":"Invalid dates specified.","typeName":"Microsoft.TeamFoundation.TestManagement.WebApi.InvalidPropertyException, Microsoft.TeamFoundation.TestManagement.WebApi","typeKey":"InvalidPropertyException","errorCode":0,"eventId":3000}
As I understand the doc, the min date must be less than 7 days from the max. if I add garbage to the date formats then it produces a proper date parsing error.
The format you provided it's good but in your example the minLastUpdatedate (5/17) it's after the maxLastUpadeDate (5/15) in it should be the opposite. try to replace the values and it should work.
BTW - you specified the date in the full format, the API should works also with date only - 2019-05-15 or with a time - 2019-05-15T14:00:00.

Is there a way to check date dynamically in eloqua?

Context: I am using Microsoft Dynamics (CRM) and Eloqua to send email campaigns. I have a date field in CRM that I want to check against in Eloqua for a specific campaign. This campaign needs to check to see if the date field is <= today's date + 90 days. I am using the campaign UI in Eloqua, not doing anything programmatically at this point.
I have tried using the Compare Custom Object Fields decision in Eloqua by finding the date field, setting the comparator to dynamically on or before, and I want to make the compared value Today + 90 days. I'm not sure how to accomplish this in this type of Decision object because the only options I have to compare the date field to are Yesterday, Today, or Tomorrow. See image below:
I have also tried to use the Compare Date Decision object, but there is no dynamic comparison, just hard-coded date options.
The last thing I tried was a Wait step, but that only waits a hard-coded number of days rather than checking dynamically.
Has anyone run into this issue or know of a solution to this problem?
We were able to find an Eloqua Date App to download that adds a Date Decision step to the program builder which allowed us more flexibility with comparing dates in a custom range.

How to retrieve only the newest rows via the Smartsheet API

I need to be able to retrieve only the newest (most recently modified) rows via the Smartsheet API.
The only way to get a sheet's rows seems to be via the Get Sheet call here: http://www.smartsheet.com/developers/api-documentation#h.4930jur8qsvs
I have a large sheet that is taking this call over 30 seconds to return. What I really need is just a way to get the most recently modified rows since a given timestamp.
Is there a way?
Try this (REST GET operation):
/sheet/{sheetID}?rowsModifiedSince={DATETIME}
DATETIME: Must be in UTC Format. e.x.:
https://api.smartsheet.com/1.1/sheet/##########?rowsModifiedSince=2015-03-26T11:40:00Z
This is an undocumented parameter of Smartsheet API 1.1.
Grabbing rows by modified date is not currently supported by the Smartsheet API at this time.
Just to provide an update of a hard to find correct syntax for version 2.0:
ten_ago = datetime.now() - timedelta(minutes=10)
ten_ago = ten_ago.isoformat()
page = smart.Sheets.get_sheet(sheet, level=2, rows_modified_since=ten_ago, include=object_value)
This will retrieve only the rows that has been modified 10 min ago including smartsheet object values.

Facebook Graph Feed documentation

Where can I find the documentation (parameters that can be given) of the following graph url:
https://graph.facebook.com/<PAGENAME>/feed
I've been searching for hours, but I can't find them.. I'm looking for the parameter to get posts till a certain date..
What you are looking for is Time-based Pagination to navigate through results data using Unix timestamps which point to specific times in a list of data. You can use the until field which as per documentation is
A Unix timestamp or strtotime data value that points to the end of the range of time-based data.
For example, following will give you the posts of User until 10th June 2013
me/feed?until=1370840400