Downloading Event Logs using the API - flurry

When downloading Event Logs, is it possible to get them using the API instead of downloading them via the Download CSV button on a web browser?
Is there an API for which it is possible among the URLs below?
https://developer.yahoo.com/flurry/docs/api/code/analyticsapi/
Also, if you plan to add it in the future, please let me know when it is scheduled for completion.
I appreciate your assistance.

There is no API for get Event Logs(raw data) as far as I know.
Workaround:
Downloading Event Logs CSV can be done something like
this with some additional touch. That implementation is for previous version.
After Flurry's renovation at 3/27/2017,
Log in via GET /auth/v1/session with credentials
Get 'flurry-auth-token' from GET /auth/v1/authorize
Call GET ../eventLogCsv with 'flurry-auth-token' to download CSV
I'm a user of Flurry. And hope they support this feature via API soon.

As of moment of writing, Flurry now provides Raw Data Download API, so you can retrive your raw event's data on a periodic basis (but within some limitations - time windows must be less than 1 month, data preparation takes some time, etc.)
Simplified workflow is following:
1. Setup
First of all, you must generate a Programmatic Token (discrabed here https://developer.yahoo.com/flurry/docs/api/code/apptoken/, process is straightforward, except that you'll need to create another user with different role in order to use this token)
2. Making the Request
Specify startTime/endTime for desired time window inside request (within other parameters):
curl -X POST https://rawdata.flurry.com/pulse/v1/rawData
-H 'accept: application/vnd.api+json'
-H 'authorization: Bearer ~~YOUR TOKEN~~'
-H 'cache-control: no-cache'
-H 'content-type: application/vnd.api+json'
-d '{"data": {
"type": "rawData",
"attributes": {
"startTime": "1511164800000",
"endTime": "1511251199000",
"outputFormat": "JSON",
"apiKey": "AAAA1111BBBB2222CCCC"
}
}
}'
If your request was successful (requestStatus equals Acknowledged inside response body), save the id value from response.
3. Checking for data preparation status
Depending on complexity of your app and requested time window, data preparation make take about 30 minutes up to a few hours to be prepared.
You can check status by using:
curl -g https://rawdata.flurry.com/pulse/v1/rawData/26?fields[rawData]=requestStatus,s3URI
-H ‘accept: application/vnd.api+json;’
-H ‘authorization: Bearer ~~YOUR TOKEN~~’
-H ‘cache-control: no-cache’
-H ‘content-type: application/vnd.api+json;’
As soon as your data is ready, response will be following:
{
"data":{
"type":"rawData",
"id":"26",
"attributes":{
"requestStatus":"Success",
"s3URI":"https://flurry-rdd.s3.amazonaws.com/downloads/26.JSON.gz?AWSAccessKeyId=AAAA1111BBBB2222CCCC&Expires=1513101235&Signature=h%2FChXRi5QwmvhUrkpwq2nVKf8sc%3D"
}
}
}
Save s3URI for next step.
4. Retrieving Results
Now you can retrieve archived raw data by using s3URI:
curl -O https://flurry-rdd.s3.amazonaws.com/downloads/26.JSON.gz?AWSAccessKeyId=AAAA1111BBBB2222CCCC&Expires=1513039053&Signature=xbKNnTgpv1odAfVgPRLMyck8UnE%3D
Source: https://developer.yahoo.com/flurry/docs/analytics/rdd/

Related

how to create a webhook programmatically to check ADO repository has code push

I have find out this called servicehooks link
But I want to do this programmatically where I have more number of projects and want to check any of that project repository has code push event happened , if yes need to check which files are pushed as a commit.
and based on that push message into my service bus queue.
any sample code for the same? looking for azure function app for above solution.
You can subscribe to code push events using ADO public API: Subscription create API
You want your request to look like this:
curl -H "Content-Type: application/json;api-version=4.0" \
-H "Authorization: Basic $(B64_TOKEN)"
--request POST \
--data {
"publisherId": "tfs",
"eventType": "git.push",
"resourceVersion": "1.0",
"consumerId": "webHooks",
"consumerActionId": "httpRequest",
"consumerInputs": {"url": $(WEBHOOK_URL)}
}
https://dev.azure.com/$(ORGANIZATION)/_apis/hooks/subscriptions
This will subscribe you to all code push on all your repositories of all your projects of your organization.
When you receive a code push notification (see documentation), you can extract the commit ids from the resource object (you might need to fetch the Push object using the API).
Then you can inspect which file are impacted with the Commit API.
If you want to see the file diff, there is also an undocumented API.

Automatically close outdated GitLab merge request

Is there any option to automatically close GitLab merge request after 1 day?
Manually close all the merge requests is not an option since there are many each day.
Thanks in advance
You can create a custom script that uses GitLab API either directly or via client
You'll need to generate private token with Scope: api
Example
Fetch Merge Requests updated before a specific date:
$ PRIVATE_TOKEN=****
$ curl -s -X GET -H "PRIVATE-TOKEN: $PRIVATE_TOKEN" \
"https://gitlab.com/api/v4/merge_requests?state=opened&view=simple&updated_before=2020-02-01T14:09:18.679Z" |\
jq '.[].id'
34520388
33038903
20988416
(put your token instead of ****)
Call Update request for each id in a loop, specifying state_event=close

Not able to publish flow to Node-RED via the HTTP API, but it works when doing it manually

I am trying to use the Node-RED API to publish a flow with this command:
curl -ss -X POST \
http://${IP_ADDRESS}:1880/flow \
-H 'content-type: application/json' \
--data-binary "#foo_nodered_flow.json"
(as per API docs here: https://nodered.org/docs/api/admin/methods/post/flow/)
but I get back this message:
{"error":"unexpected_error","message":"Error: duplicate id"}
The flow is more or less:
an MQTT subscriber
a function to transform messages in Javascript
a connection to InfluxDB to store these transformed messages (for this I have installed a custom npm package node-red-contrib-influxdb inside ~/.node-red/ https://flows.nodered.org/node/node-red-contrib-influxdb)
I don't find duplicate IDs in the field id when grepping with grep -nrI id foo_nodered_flow.json.
I was able to publish via HTTP POST a similar flow that was not involving InfluxDB but a simple file writer.
Why I am getting that error in the HTTP response? What's wrong with that flow?
How can I programmatically publish any flow using curl?
The file containing the flow has this structure:
{
"label": "Store redings - panel flow",
"nodes": [ <put here the flow you export from the Node-RED UI> ],
"configs": []
}
Make sure that the list of nodes is being cleaned from the node of type "type": "tab" containing the name of the flow e.g. "label": "Flow 1" (this label must go outside the nodes array as the first field as in the above sample).
I also tried to remove the top level id field and all the z fields which seem to be automatically replaced/fixed. But I still get the same errors.
I know this flow works because when I manually created it, then I was able to see the data flowing and being eventually stored inside InfluxDB.
Also when on the Node-RED UI (at http://${THE_IP_ADDRESS}:1880/) I can click on the "3 lines menu" > Import > Clipboard then paste the JSON description of the nodes of that flow and I am able to import the flow with no errors and then deploy the flow with no errors.
I am using:
node version: 10.14.2
Node-RED version: 0.19.5
node-red-contrib-influxdb version: 0.2.2

Instagram real time API - getting empty data and no POST request in reply

There's been some thread regarding the Instagram's realtime API, and it's remain unclear whether the fault is of Instagram or the developers that are trying to use it.
My issue is with the first subscription request. I think that my request is correct but I keep getting error \"callback_url\". URL must start with \"http://\" or \"https://\""
The request is:
curl -X POST 'httpiptions?client_id=CLIENT_ID&client_secret=CLIENT_SECRET&object=tag&object_id=love&aspect=media&callback_url=http://myurl.com/subscribe'
Moreover, when I'm changing the request type to GET instead of POST I'm getting a successful message 200 with empty data, and Instagram do not invoke a POST request to my callback_url.
So as I see it there're 2 issues:
1) Should the request be POST( doesn't works for me) or GET( did work for me).
2) Why instagram returns empty data and do not POST to the callback_url.
It has to be a POST.
In order to successfully subscribe and receive a response from the POST you do as your subscription request, your callback URL has to do some extra work and that is to also respond to a GET request sent from Instagram, right after you send the subscription request, to verify that you are the real owner of the callbalck URL.
In summary your callback URL, beside receiving POSTs, has to also respond to a GET request and echo back the hub.challenge parameter sent in that GET request.
Review the detailed description of the process in the documentation: http://instagram.com/developer/realtime/
UPDATE:
Now I could reproduce your described error.
The problem is with your CURL call. Your are supposed to send a POST request along with appropriate POST parameters but your call is doing a POST sending parameters as GET in the URL. Actually the API should reject the whole request but it seems it partially processes the parameters.
Change the CURL to:
curl -F 'client_id=CLIENT-ID' \
-F 'client_secret=CLIENT-SECRET' \
-F 'object=user' \
-F 'aspect=media' \
-F 'verify_token=myVerifyToken' \
-F 'callback_url=http://YOUR-CALLBACK/URL' \
https://api.instagram.com/v1/subscriptions/
This does a POST and sends your parameters correctly.

NEST Thermostat API

I am trying to develop an ios app using the newly published NEST api but bit lost with their native documentation.
Question:I could get an access token but do not know the thermostat endpoint to query and update "Away" state
Any pointers will be greatly appreciated ..
I'm presuming you intend to use REST to query and update the away state since you mentioned "endpoint"? If not the other alternative is to use the firebase API. This is documented in the introduction section
To get the away status you'll need to query the structure/s
curl -v -L https://developer-api.nest.com/structures?auth=<AUTH_TOKEN>
The response shows the away state in addition to the thermostats/smoke co alarms in that structure.
{
"g-9y-2xkHpBh1MGkVaqXOGJiKOB9MkoW1hhYyQk2vAunCK8a731jbg": {
"away": "home",
"country_code": "US",
"name": "Home",
"smoke_co_alarms": [
"0NBM7-QfoLwhMldZ2CoIkQ7hRJoe1Jye"
],
"structure_id": "g-9y-2xkHpBh1MGkVaqXOGJiKOB9MkoW1hhYyQk2vAunCK8a731jbg",
"thermostats": [
"GM6Z9JpSKU6_ua8AfD6WRA"
],
"time_zone": "America/Los_Angeles"
}
}
To update the away state you would need to use the PUT http verb:
curl -v -L -X PUT "https://developer-api.nest.com/structures/g-9y-2xkHpBh1MGkVaqXOGJiKOB9MkoW1hhYyQk2vAunCK8a731jbg?auth=<AUTH_TOKEN>" -H "Content-Type: application/json" -d '{"away":"away"}'
Note that the ID used in the path parameter is the structure ID returned in the get response.
Hope that helps
Nagesh

Resources