Facebook does not show thumbnail - facebook

I am using Facebook's Graph API and I am trying to share a link to a page with a embedded swf video using the following CURL request.
curl -i -X POST \
-d "height=405" \
-d "link=https%3A%2F%2Fbit.ly%2F1SptrHN" \
-d "message=Test" \
-d "name=The%20Last%20Witch%20Hunter" \
-d "picture=https%3A%2F%2Fstatic1.webvideocore.net%2Fi%2Fstores%2F2%2Fitems%2Fbg%2F9%2F9c%2F9ce4632ed7b89b5a36638cdd6392914d.jpg" \
-d "source=https%3A%2F%2Fplay.streamingvideoprovider.com%2Fplayer3.swf%3Fclip_id%3Dar7hgx038sw8%26autoStart%3D1%26native_fs%3D1%26noControls%3D%26repeatVideo%3D%26stretch_video%3D%26brandNW%3D1%26start_img%3D1%26start_volume%3D100%26autoHide%3D1%26skinAlpha%3D80%26colorBase%3D%2523202020%26colorIcon%3D%2523FFFFFF%26colorHighlight%3D%2523fcad37%26viewers_limit%3D0%26cc_position%3Dbottom%26cc_positionOffset%3D70%26cc_multiplier%3D0.03%26cc_textColor%3D%2523ffffff%26cc_textOutlineColor%3D%2523000000%26cc_bkgColor%3D%2523000000%26cc_bkgAlpha%3D0.7" \
-d "type=link" \
-d "width=720" \
-d "access_token=CAAEl5c0JLDABAJpu3DJVbndfcmZCrr9xnk5zoWn5Ik9KEwS14autS1ZAc4ceDdzr4eTIqqzH6z8ePvkZA1gOVUZCKrInECJiFaZCgM1Y0JDocgfyyg9BLSpNzLtMZCOhiPpRPkk0URyCRDedQxQEx3yodXKiyzRJq7RKPZAVKrb77mlxA8fuUvRDZCcGgwgdZAuNZCWnLvtDly8wZDZD" \
"https://graph.facebook.com/v2.0/me/feed"
As you can see I am setting the picture and the image is publicly available. However the Graph API Explorer returns the following url for the thumbnail which points to the swf.
https://external.xx.fbcdn.net/safe_image.php?d=AQCRoO4J0CcrVO2M&w=130&h=130&url=https%3A%2F%2Fplay.streamingvideoprovider.com%2Fplayer3.swf%3Fclip_id%3Dar7hgx038sw8%26autoStart%3D1%26native_fs%3D1%26noControls%26repeatVideo%26stretch_video%26brandNW%3D1%26start_img%3D1%26start_volume%3D100%26autoHide%3D1%26skinAlpha%3D80%26colorBase%3D%2523202020%26colorIcon%3D%2523FFFFFF%26colorHighlight%3D%2523fcad37%26viewers_limit%3D0%26cc_position%3Dbottom%26cc_positionOffset%3D70%26cc_multiplier%3D0.03%26cc_textColor%3D%2523ffffff%26cc_textOutlineColor%3D%2523000000%26cc_bkgColor%3D%2523000000%26cc_bkgAlpha%3D0.7&cfs=1
Furthermore sharing the link from the page manually shows the correct thumbnail.
What could be the reason for the wrong thumbnail?

https://developers.facebook.com/docs/graph-api/reference/v2.6/user/feed#publish lists the valid parameters for creating posts via that endpoint. It doesn’t mention source at all.
Although it seems to be a valid parameter for the Feed dialog – you are making a post made via API, and that’s something different.
If you want to share a link with a video, then I’d recommend embedding the video via the Open Graph meta tags – https://developers.facebook.com/docs/sharing/webmasters#video

Related

How to Star a Topic on GitHub with API?

Star a topic can be done on the website. But how to do the same operation via GitHub API v3 or v4? I read through the reference but got no clues.
For the v3 REST API it's documented at Star a repository for the authenticated user
The curl example is:
curl \
-X PUT \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/user/starred/octocat/hello-world
But this doesn't show how to insert your token, so you actually need something more like:
curl \
-X PUT \
-H "Authorization: token $GITHUB_API_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/user/starred/octocat/hello-world
Where GITHUB_API_TOKEN has been previously set like:
GITHUB_API_TOKEN="ghp_16C7e42F292c6912E7710c838347Ae178B4a"
Per comments to this earlier question how to star a repo with github api make sure that the token used has the correct permissions to do the starring, which means having the repo scope (or at least repo_public) enabled.
I'd also love to know how to do this with the v4 GraphQl API.

How to get raw github data using github API

I want to know how to get this data from the GitHub API.
I know I can get this data as raw but is there any way to get this using GitHub API?
Here is the requested file:
https://github.com/graphql-compose/graphql-compose-examples/blob/master/examples/northwind/data/csv/employees.csv
As seen here, try
curl -GLOf -H "Authorization: token ${GITHUB_TOKEN?not set}" \
-H "Accept: application/vnd.github.v4.raw" \
"https://api.github.com/repos/$ORG/$REPO/contents/$FILEPATH" -d ref="$REVISION"
In your case, for a public repository:
curl -GLOf -H "Accept: application/vnd.github.v4.raw" \
"https://api.github.com/repos/graphql-compose/graphql-compose-examples/contents/examples/northwind/data/csv/employees.csv"
I just tested it, and got a file employees.csv with its raw content in it.

How to recover Personal Access Token In Github?

Is there any option to recover Personal Access Token in Github?
Because my app is using the PAT in composer and I don't want to replace it.
You would need to replace it (OAuth Authorizations), since a token cannot be accessed after the generation step.
In a bash shell:
curl https://api.github.com/authorizations \
-X POST \
--user "YourGitHubUsername" \
--data '{"scopes":["gist","repo],"note":"new token"}'
(replace "new token" by something more meaningful)

Is there a kibana rest API to get and set default-route of a space?

I need to programmatically retrieve and set default route of a kibana space. On Kibana application, this can be set at stack management -> Advanced Settings page. I looked at the elasticsearch REST documentation, but could not find a suitable API. Any help is appreciated.
Not sure what version you are referring to. But the documentation link in the original post points to 7.13. And the suggestion below (from https://discuss.elastic.co/t/kibana-7-5-server-defaultroute-parameter/212191/4) works with 7.13:
these advanced settings are stored as a Saved Object of type config. So you can update them using the Saved Object APIs
So here's how I used the API to 'set' and 'retrieve' the defaultRoute in and from my space:
$ curl --user elastic:******* -X PUT "localhost:${ES_KB_PORT}/s/${my_space}/api/saved_objects/config/7.13.2" -H "kbn-xsrf: true" -H "Content-Type: application/json" -d '{"attributes": {"defaultRoute": "/app/dashboards#/view/285828e0-b713-11eb-aba9-211e5623385d"}}'
{"id":"7.13.2","type":"config","updated_at":"2021-08-02T08:53:19.824Z","version":"WzEzOTksMl0=","namespaces":["mz81"],"attributes":{"defaultRoute":"/app/dashboards#/view/285828e0-b713-11eb-aba9-211e5623385d"}}
$ curl --user elastic:******* -X POST "localhost:${ES_KB_PORT}/s/${my_space}/api/saved_objects/_export" -H "kbn-xsrf: true" -H "Content-Type: application/json" -d '{"type": "config"}'
{"attributes":{"buildNum":40943,"defaultRoute":"/app/dashboards#/view/285828e0-b713-11eb-aba9-211e5623385d"},"coreMigrationVersion":"7.13.2","id":"7.13.2","migrationVersion":{"config":"7.13.0"},"references":[],"sort":[1627896123137,107],"type":"config","updated_at":"2021-08-02T09:22:03.137Z","version":"WzE0MDYsMl0="}
{"exportedCount":1,"missingRefCount":0,"missingReferences":[]}

ApiAxle: cannot access stat URL in order to view analytics

I am following the instructions at: http://apiaxle.com/docs/statistics-and-analytics-in-apiaxle/ . Unfortunately currently (May 17, 2014) apiAxle is redirecting me to the endPointserver and I am not getting statist
menelaos:~$ curl 'http://localhost:3000/v/api/test/stats?
granularity=hour&format_timestamp=ISO'
Response:
{"meta":{"version":1,"status_code":404},"results":{"error":
{"type":"ApiUnknown","message":"No api specified (via subdomain)"}}}
I also tried using the subdomain but that didn't work either:
menelaos:~$ curl 'http://test.api.localhost:3000/v/api/test/stats?granularity=hour&format_timestamp=ISO'
Typically you run multiple instances of apiaxle-proxy (which provides access to your endpoints), and a single instances of apiaxle-api (which provides access to statistics, key creation, and other API management functionality).
For example, you might be running the proxy like this:
apiaxle-proxy -f 1 -p 3000 -q
To run the API, you would run something like this:
apiaxle-api -f 1 -p 5000 -q
Note that the API needs to run on a separate port. Also note that it shouldn't be accessible to the outside world as it doesn't have any authentication.
Using the above example, your curl command would look like this:
curl -H 'content-type: application/json' \
-X GET \
'http://localhost:5000/v1/api/test/stats' \
-d '{"granularity":"hour","format_timestamp":"ISO"}'
Note that the parameters need to be sent as JSON.