How to retrieve stats for dynamic templates via Sendgrid API - sendgrid

I'm looking for help on how to retrieve stats for dynamic templates via SG API using curl.
Using https://api.sendgrid.com/v3/templates?generations=dynamic I've been able to get
specific template info but I can't seem to successfully use the dynamic template_id
and version id or subject id to pull stats for each email under the main template_id.
I get success returns for all stats using https://api.sendgrid.com/v3/stats?start_date=2022-05-01
but when I try to add template_id or any other param it's ignored by the API.
Any ideas? Thanks.

In the documentation for the global email statistics API the available query parameters that you can provide are:
limit
offset
aggregated_by - can be "day", "week" or "month"
start_date - as you used in your example
end_date
You cannot filter by the template, version or subject.

Related

Last accessed date of a view in tableau server/tableau using rest api

Is there a way to get the last accessed date of a view in tableau online/server using rest api. I am currently using this
http://my_site/api/3.6/sites/site_id/workbooks/workbook_id/views?includeUsageStatistics=true
but getting usage statics like how many times it was viewed and created date and modified date.
There is a Views method in the rest api. I'm using python and tableauserverclient to get the usage you are looking for. See TSC reference and Direct Rest API for full docs.
import tableauserverclient as TSC
tableau_auth = TSC.TableauAuth('username', 'password')
server = TSC.Server('https://servername')
with server.auth.sign_in(tableau_auth):
all_views, pagination_item = server.views.get()
for x in all_views:
print(x.name, x.total_views)
The output will look like this and I verified directly in Server.
created_at and updated_at are in the WorkbookItem class
I hope that does it for you!

Filter options in smartsheet API or SDK

I am currently exploring the smartsheet API 2.0. I want to filter based on Modified and Created date but I am unable to find any such option in the documentation.
Is there a way out to filter the smartsheet using any custom filter as we have in oData API. e.g
<API URL>?$filter= createdDate ge '10/06/2019' or modified ge '10/06/2019'
You need to create your filters in smartsheet since they can not be created on wire over API.
Then you can call
https://api.smartsheet.com/2.0/sheets/{id}?filterId={ID}&exclude=filteredOutRows
P.S You need to enter id of your filter not the name of the filter.
You can create a sheet filter, and then filter the rows via the API using the include=filters param.
See the docs for more details.
There isn't any way to send a filter query, some alternatives :
You can create a filter on the fly such as described below.
Or you can read all the sheet content and then filter on you own
In c# filtering row would look like this:
var ssclient = new SmartsheetBuilder().SetAccessToken(token).Build();
m.Sheet sheet = ssclient.SheetResources.GetSheet(sheetId, null, null, null, null, null, null, null);
List<m.Row> rowsModifiedToday = sheet.Rows.Where(r => DateTime.ParseExact(r.Cells[columnIndex].Value.ToString(), "dd/MM/yy", null) >= DateTime.Today).ToList();

Magento1.9 Rest Api filters

How to get rest api data filterable by updated_at attribute in Magento1?
I would like my rest API data to be filtered by last updated_at so I have tried something like this:-
http://localhost/mage1/products?page=1&limit=5&filter[0][attribute]=updated_at&filter[0][gteq]=2019-09-01 07:40:30
I have tried the filters shown on devdocs for M1 but didn't succeeded with any proper result. https://prnt.sc/p0lrk9
https://localhost/api/rest/products?filter[0][attribute]=updated_at&filter[0][from][0]=max_date&page=1&limit=100&order=updated_at&dir=asc"
This may help you.It worked for me

How to filter facebook API Campaign data by veiculation date

As of now, my query is:
https://graph.facebook.com/v3.1/my_adact/campaigns?fields=name,insights{spend,reach,impressions,clicks},start_time,end_time&date_preset=this_month&limit=100
How should I make it so I can filter by campaigns that ran this month?}
Thanks!
To see campaign stats for every campaign that was active this month you can use the following query and the insights endpoint:
https://graph.facebook.com/v3.1/act_xxxxxx/insights?date_preset=this_month&level=campaign&fields=campaign_name,campaign_id,spend,impressions,reach,actions,clicks
This will return the insights as defined in the field parameter rolled up to the campaign level as defined by the level parameter and for this_month.

How correctly make REST API request to get complete orders between a date range in Magento 2

I want to get complete orders between a date range using Magento 2 REST Api. So request looks like:
/rest/V1/orders?searchCriteria[filterGroups][0][filters][0][field]=status&searchCriteria[filterGroups][0][filters][0][value]=Complete&searchCriteria[filterGroups][0][filters][0][conditionType]=eq
Now I want get it in specific period. I found that Magento api has "from" and "to" fields but I always confused in searchCriteria filter index. Can anybody complete my request? Thanks
You will get complete orders between a date range by using the conditions from and to.
This API will get you the orders between the two dates:
http://<magento_host>/rest/V1/orders?
searchCriteria[filter_groups][0][filters][0][field]=created_at&
searchCriteria[filter_groups][0][filters][0][condition_type]=from&
searchCriteria[filter_groups][0][filters][0][value]=from_date&
searchCriteria[filter_groups][1][filters][0][field]=created_at&
searchCriteria[filter_groups][1][filters][0][condition_type]=to&
searchCriteria[filter_groups][1][filters][0][value]=to_date
Example:
http://<magento_host>/rest/V1/orders?
searchCriteria[filter_groups][0][filters][0][field]=created_at&
searchCriteria[filter_groups][0][filters][0][condition_type]=from&
searchCriteria[filter_groups][0][filters][0][value]=2016-07-01 00:00:00&
searchCriteria[filter_groups][1][filters][0][field]=created_at&
searchCriteria[filter_groups][1][filters][0][condition_type]=to&
searchCriteria[filter_groups][1][filters][0][value]=2018-07-01 00:00:00
The above API will get you the orders between a by using created_at timestamp.
For an example also see the Magento Docs.