Hockey app download via api - hockeyapp

I'd like to ask, if it is possible to download a apk or ipa file using Hockey Api?
I can get the download_url per app_versions api. But that url gives me a html web page as response.
Is there any way to download the App with cUrl and co.
Thanks!

I got this to work by adding ?format=apk to the end of the download_url value retrieved via the HockeyApp API.
Note that I also had to update the first part of the URL from https://rink.hockeyapp.net/apps/ to https://rink.hockeyapp.net/api/2/apps/.

The info I got from HockeyApp:
This is possible by sending the following request:
GET /api/2/apps/APP_ID/app_versions?include_build_urls=true
You need to authorize with your API token and the API token needs to be owned by a developer of the app. The direct download URL is then included as the key "build_url".
And it works.

Using shell command you can download hockey app
BUILD=$1
TOKEN="3a583f6d11164f0498f818a4e06c249e"
APP="ca47e3a4ce8a453cb40d8df4781beee5"
VERSION=$(curl \
-H "X-HockeyAppToken: $TOKEN" \
https://rink.hockeyapp.net/api/2/apps/$APP/app_versions \
| jq --arg BUILD "$BUILD" '.app_versions | .[] | select(.version==$BUILD) | .id')
curl -L -o $BUILD.apk https://rink.hockeyapp.net/api/2/apps/$APP/app_versions/$VERSION?format=apk
echo "!!!DONE!!!"

Related

How can use cURL with Powershell to download from sharepoint using Microsoft Graph

I am trying to download some files from my SharePoint or OneDrive using the Microsoft graph API. I want to only use cURL (The C:\windows\systems32\curl not invoke-request) and powershell.
I tried using the documentation from Microsoft here:https://learn.microsoft.com/en-us/graph/auth-v2-service#4-get-an-access-token
and here: https://learn.microsoft.com/en-us/graph/api/resources/driveitem?view=graph-rest-1.0#instance-attributes
However the syntax seems to be off and I have been having some trouble.
Here is my starting code (This assumes you have setup an appid in the azure portal and obtained and client_id,client_secret, and tenant id):
curl -d 'client_id'='ENTERCLIENTIDHERE' \
-d 'scope'='https://graph.microsoft.com/.default' \
-d 'client_secret'='ENTERCLIENTSECRETHERE' \
-d 'grant_type'='client_credentials' \
'https://login.microsoftonline.com/ENTERTANTANTHERE/oauth2/v2.0/token'
Here is code that will help you get a request from the Microsoft graph api using a token from your app id information, then it will generate a url for a specific file or folder of your choosing. You can also modify the code to just get yourself a token from the Microsoft graph API using only cURL and Powershell for windows.
#Generating the Token from the microsoft Graph API
$Result = C:\Windows\System32\curl -n -i -H "Host:login.microsoftonline.com" -H "Content-Type:application/x-www-form-urlencoded" -d "client_id=ENTERCLIENTIDHERE&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default&client_secret=ENTERCLIENTSECRETHERE&grant_type=client_credentials" "https://login.microsoftonline.com/ENTERTENANTIDHERE/oauth2/v2.0/token"
$x = $Result[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
$M = $x[16]
$k = $M -split ‘access_token":"’
$Resultk = $k[1]
$ResulO = $Resultk.Substring(0,$Resultk.Length-2)
#Seeing the token in powershell to verify it came up properly
Write-Output $ResulO
#Requesting a download url from your own sharepoint or onedrive
C:\Windows\System32\curl -H "Host:graph.microsoft.com" -H "Authorization:Bearer $ResulO" -H "X-Cookie:token=$ResulO" "https://graph.microsoft.com/v1.0/sites/ENTERSITENAMEORSITEIDHERE/drive/root:/ENTERFILEPATHORFILEHERE?select=id,#microsoft.graph.downloadUrl"

Retrieving Details from GitHub Repos

I'm looking for a way to get both the version number and license details from a repo providing I have the URL for the Repo. I have a way at the moment that doesn't work for all repos I am reviewing but it's basically html scraping.
I assume there is an API example somewhere that pulls these details?
some random examples
https://github.com/Microsoft/Terminal
https://github.com/leoasis/redux-immutable-state-invariant
https://github.com/zeroclipboard/zeroclipboard
What version do you need ? If a package.json file is present, you can use it and get the version in it:
curl -sL https://raw.githubusercontent.com/leoasis/redux-immutable-state-invariant/master/package.json | jq -r '.version'
For the latest release tag name (aka version), use
curl -sL https://api.github.com/repos/Microsoft/Terminal/releases/latest | jq -r '.tag_name'
To retreive the license, use the Github API and go to https://api.github.com/repos/zeroclipboard/zeroclipboard/license, e.g.
curl -sL https://api.github.com/repos/zeroclipboard/zeroclipboard/license | jq -r '.license.name'
`

How should I do with CURL in Facebook Messenger Platform(Chatbot)?

I'm working on Facebook chatbot, and I found some difficulties while reading Facebook's official Messenger Platform tutorial.
The frustrating part is here:
curl -X POST -H "Content-Type: application/json" -d '{
"setting_type":"greeting",
"greeting":{
"text":"Timeless apparel for the masses."
}
}' "https://graph.facebook.com/v2.6/me/thread_settings?access_token=PAGE_ACCESS_TOKEN"
I'm using a Node.js and Heroku. How should I use the code above to make it work?
If you're on OSX you can use the terminal to run the command. On windows you could use Git Bash.
Copy & paste your curl command, replace PAGE_ACCESS_TOKEN with your token from your Facebook Developer App and run it by pressing the enter key.
Hope that helps.

Post to a Facebook user's wall with curl PERL

I'm storing facebook userid's and access tokens. Can I post to a selected user's wall with this information? The following code is found at Facebook's developer reference.
I'm just not sure how to run it with Perl.
curl -F 'access_token=$accessToken' \
-F 'message=Check out this funny article' \
-F 'link=http://www.example.com/article.html' \
https://graph.facebook.com/$facebookid/feed
or this code:
curl -F 'access_token=$accessToken' \
-F 'photo=http://samples.ogp.me/$appID' \
'https://graph.facebook.com/me/$appNameSpace:$objectType'
Why not use the Facebook::Graph module to do what you need? It's a rich wrapper around the facebook API.
You need to perform a HTTP POST request with these form data, see method post in LWP::UserAgent.

Facebook Application: Uploading multiple images in one post to wall

How to upload multiple images in one post via api?
Like here:
http://www.facebook.com/SocialCity?v=wall
I have managed to upload only one image via curl request.
curl
-F "access_token=token_here"
-F "message=message_here"
-F "picture=http://www.example.com/image.jpg"
https://graph.facebook.com/app_id_here/feed
Or it's not possible to post multiple images this way?
Anyone?
Thanks ;)
It's possible by now with the Open Graph however it seems to apply only to user generated fotos:
https://developers.facebook.com/docs/opengraph/usergeneratedphotos/
Multiple photo upload via one Graph API call is not supported. However you can create individual api calls and batch those in one request described here: https://developers.facebook.com/docs/reference/api/batch/
You can now publish multiple images in a single post to your feed or page:
For each photo in the story, upload it unpublished using the {user-id}/photos endpoint with the argument published=false
curl -i -X POST \
-d "url=https%3A%2F%2Fwww.facebook.com%2Fimages%2Ffb_icon_325x325.png" \
-d "caption=test%20photo%20upload" \
-d "published=false" \
-d "access_token=<user_photos_token>" \
"https://graph.facebook.com/v2.6/me/photos"
You'll get an ID for each photo you upload like this:
{
"id": "10153677042736789"
}
Publish a multi-photo story using the {user-id}/feed endpoint and using the ids returned by uploading a photo
curl -i -X POST \
-d "message=Testing%20multi-photo%20post!" \
-d "attached_media%5B0%5D=%7B%22media_fbid%22%3A%221002088839996%22%7D" \
-d "attached_media%5B1%5D=%7B%22media_fbid%22%3A%221002088840149%22%7D" \
-d "access_token=<publish_actions_token>" \
"https://graph.facebook.com/v2.6/me/feed"
Source: Publishing a multi-photo story