Graph API bug - posting links, missing description - facebook

When posting a link on a page using the Graph API, the description is missing.
Might be related to this bug http://bugs.developers.facebook.net/show_bug.cgi?id=14782.
Is this going to be fixed? Now I'm posting as feed/ instead, here the description is shown - but then there is no "share" button.
Any known workaround?

I'm not sure why this is, and really it doesn't make much intuitive sense, but I've had success posting to the PAGE_ID/links feed, rather than identifying the page ID independently and then just posting to graph.facebook.com/links
Thus, I'm posting using:
curl -F 'access_token=ACCESS_TOKEN' \
-F 'link=LINK' \
-F 'name=TITLE' \
-F 'description=DESCRIPTION' \
https://graph.facebook.com/PAGE_ID/links
Rather than:
curl -F 'access_token=ACCESS_TOKEN' \
-F 'link=LINK' \
-F 'name=TITLE' \
-F 'description=DESCRIPTION' \
-F 'id=PAGE_ID' \
https://graph.facebook.com/links
In my testing, the former allows proper formatting of each of the elements, while the latter does not. Both surface the share link. I do not know why this is, but it works.
Hope this helps.

Related

Creation of Paypal encrypted button returns the error 11945 invalid country and locale combination

I am implementing the creation of encrypted Paypal buttons using their Button Manager API. Despite all my efforts I am facing the error 11945 The button country and language code combination specified is invalid..
First I tried to implement the creation of my own button but while tracing this error, I ended up with their tutorial using curl, which fails for me too with the same error. (Note: I had to change the credentials to mine).
To be specific, this code from their tutorial fails with the error 11945:
curl https://api-3t.sandbox.paypal.com/nvp \
-s \
--insecure \
-d USER=<my-user-name> \
-d PWD=<my-password> \
-d SIGNATURE=<my-signature> \
-d VERSION=51.0 \
-d METHOD=BMCreateButton \
-d BUTTONCODE=ENCRYPTED \
-d BUTTONTYPE=CART \
-d BUTTONSUBTYPE=PRODUCTS \
-d BUTTONCOUNTRY=US \
-d L_BUTTONVAR1=item_name%3Dshoehorn \
-d L_BUTTONVAR2=amount%3D1464.46 \
-d L_BUTTONVAR3=tax=%3D21 \
-d L_BUTTONVAR4=item_number%3D123456
I tried to figure out why is that but I haven't found any relevant sources.
Can anyone explain this issue? The country code is set to US, which should be fine.
All help will be appreciated.
Note: I am using the sandbox right now.
Note: Defining locale through lc attribute does not help. I tried en as well as en_US values.
After a discussion with the Paypal support, there is the conclusion.
Short version: It's a bug.
Long version (by moderator MTS_Ciaran):
Thanks, so this looks like a bug on the sandbox from what I can see.
The issue is that the account is CZ and for some reason we're not
allowing the button creation because of that. It doesnt look to be the
same on the live environment so I would suggest using a US account for
testing and once live the CZ account shouldn't be an issue.
I'll
work internally to get the sandbox corrected for this.

Post a comment on Github Pull Request via Command Line

Is there a way I can post a comment on a Github Pull Request via the command line? The ideas is that I want Jenkins to post comments on Pull Requests with a summary of the results of a script.
This is absolutely possible with nothing more than curl.
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
https://api.github.com/repos/octocat/hello-world/issues/42/comments \
-d '{"body":"Hello Github!"}'
Read more about the API in use here https://docs.github.com/en/rest/reference/issues#create-an-issue-comment
NOTE: This assumes you have a Personal Access Token stored in an environment variable named GITHUB_TOKEN
It's not possible without third party extensions.
You may be intrested in this: https://github.com/stephencelis/ghi
Sorry I can't help more!
This is a little late, but this sounds like exactly what you are looking for:
gh pr comment 6 --body "Hi from GitHub CLI"
https://cli.github.com/manual/gh_pr_comment
Simply allows you to add comments to a pr from a given pr number.

How to delete my follower at github?

Is it possible to do?
If yes, could you please provide a curl example?
Removing a follower on Github in fact is possible with this workaround:
Block the user who watches you, as described in the github help.
Then unblock him again.
After that he will not be blocked anymore and he will also no longer follow you.
Wrote to Github support:
Is there any way to delete followers? I know about "Block User" option but it's not exactly what I want. Github API methods are also suitable.
They answered:
No, this isn't currently possible.
So, there is no way for now. Only "Block User".
Manually: go to user profile - in the right corner there is Follow user and right next to it menu with Block user/Report user.
By clicking on Block user, he was removed from my followers.
Here is Github manual to do that.
Could not find an api alternative.
These would be the curl commands, you were looking for:
Block a user1
$ curl \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://api.github.com/user/blocks/USERNAME
Unblock a user2
$ curl \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://api.github.com/user/blocks/USERNAME
1 https://docs.github.com/en/rest/users/blocking#block-a-user
2 https://docs.github.com/en/rest/users/blocking#unblock-a-user

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.

How to post a link with a picture to Facebook using the Graph API?

I have tried two different methods.
The first is to specify the link in the /PROFILE_ID/feed link argument (as described under "publishing" here). The problem is that if I specify anything other than my application URL i get an error saying the URL is invalid.
The second is to use the /PROFILE_ID/links method and specifying a picture URL. The problem is that when it posts it only shows the message and the URL. I've specified values for picture, name and message but none of them show.
How can I Post a link, with a name, message and picture?
Your first approach is the correct one. Is your url starting with http://? What SDK are you using?
As described on this page, the example suggest it should work.
http://developers.facebook.com/docs/reference/api/post
curl -F 'access_token=...' \
-F 'message=Check out this funny article' \
-F 'link=http://www.example.com/article.html' \
-F 'picture=http://www.example.com/article-thumbnail.jpg' \
-F 'name=Article Title' \
-F 'caption=Caption for the link' \
-F 'description=Longer description of the link' \
-F 'actions={"name": "View on Zombo", "link": "http://www.zombo.com"}' \
-F 'privacy={"value": "ALL_FRIENDS"}' \
-F 'targeting= {"countries":"US","regions":"6,53","locales":"6"}' \
https://graph.facebook.com/me/feed
I ended up solving this problem by using the /PROFILE_ID/feed method and then disabling Stream post URL security in my application security settings. Hope this helps someone!