Is there a way to make this possible? - facebook

Can you let me know when a person 'Likes' my facebook page, I would
give them a 10% discount, but will that person only get the discount
the ONE time? I did a test as a new customer and click 'like' and
ordered. but when I went back it looks like I can re-order as much as I
want for a 10% discount.
this should be ONLY ONE time.
Is there a way to make this possible?

You can check if a person has liked your page, but you cant get a callback when they actually do it. Also there are strict rules on rewarding users for liking your page/app etc so make sure you read the guide fully before implementing something you could be told off for:
https://developers.facebook.com/docs/guides/policy/examples_and_explanations/Rewarding_Users/

Make the coupon codes usable only once in your backend?

Related

how to represent REST API URL for update the number of likes of some post

I am studying REST API.
I'm thinking about how to design the REST API for the following situations.
"If you click the Like button on a post, increase the number of likes on that post."
This corresponds to an UPDATE among CRUD. Right?
Then should I express the URL like this?
POST /post/{post_id}/likes
But there also will be situations like this.
If you press the "Like" button again, Decrease the likes again.'
In that case, would it be appropriate to send a request with this data in the payload?
POST /post/{post_id}/likes
{
countup: False // decrease likes
}
I coudn't think of anything better than this,
but I feel strange that this isn't a very good idea.
I want to design the API to match the convention.
I'd appreciate it if you could give me some better ideas.
If you click the Like button on a post, increase the number of likes
on that post. If you press the "Like" button again, Decrease the likes
again.
Pressing the like button and adding a toggle is an UI thing.
on a post increase the number of likes or decrease the likes
If it would be operations I would do increaseLikesForPost(), decreaseLikesForPost(). What is hidden here that we usually add the session.userid as a parameter to know which user like the post later, not just increasing the number of like, so what really happens here is increaseLikesForPost(actualUser), which does not make much sense in this context. It would be normally just actualUser.like(post) or post.isLikedBy(actualUser). Since we use the API from the viewpoint of the post it is better to use the latter one.
So how do we translate this: post.isLikedBy(actualUser) or this: postIsLikedBy(post, actualUser) to the language of HTTP methods and an URIs?
A possible solution is POST|PUT /api/posts/:postid/likes/:actualuserid and DELETE /api/posts/:postid/likes/:actualuserid. If you don't want to add session related data to the URIs like actualuserid, then it is better to do POST|PUT /api/posts/:postid/like and DELETE /api/posts/:postid/like and get the actualuserid from the Authorzation header.

Preview conversion rate with Binance API

I am working in a small Android App interacting with Binance API. I am trying to make something similar to:
https://www.binance.com/es/convert
That is, I would like to view the rate or price of a conversion and if I am interested in this rate, confirm it. With the end point:
/api/v3/order
I don't see the way of doing it, I just understand that you can place a market order and get the current price but I would like to preview the price proposed and confirm it in a few second in the same way that the above URL does it.
Could you please show me an example on how to do it or give me any clue?
Many thanks,
Joaquin
POST /api/v3/order endpoint is used for placing an real order into your account.
If you wish to get the latest price from the market, this ticket price is more suitable: GET /api/v3/ticker/price

How to find posts of a facebook page within a certain period of time?

I want to import posts of a page between 07-12-2017 and 10-12-2017.
I have converted the dates to unix timestamps.
https://graph.facebook.com/v2.11/ekantipur?fields=posts.until(1512926148).limit(125)&access_token=MyAccessToken
works and so does
https://graph.facebook.com/v2.11/ekantipur?fields=posts.since(1512666948).limit(125)&access_token=MyAccessToken
But since and until together does not work. It only shows a single id.
Is there an another way to accomplish this task? If yes please reply. Thankyou in advance.
Update here is my updated Url with since and until. Its still not working.
123456/posts?since=07-12-2017&until=10-12-2017
Can you update the original post with your combined Since and Until?
I'm assuming that the SINCE is set to 7/17 and the UNTIL is 10/17, correct? It looks that way from the converted numbers, but I try not to assume it isn't something small like that :). No offense intended.
Looking at the graph API, I am using the page id of one I am the admin of and using since and until and it's coming back with posts between 07-12-2017 and 10-12-2017. I'm wondering if it has something to do with the limit in your urls. What if the limit statements are narrowing things down too much?
I'm just putting this into the graph API and getting the results I'm expecting: (no, my page id isn't 123456)
Granted, I'm not calling it in a url, Graph API is pretty forgiving.

Getting Facebook event information from URL

I've been reading some stuff about Facebook API's but as a non-programmer it's kinda hard to understand it all. It's probably a pretty simple question.
My question: is it possible to get all the information like coverphoto, time, description, location etc. from a (random) public Facebook event from just the URL of the event?
So I will have a field 'Insert event URL' on my page. Below that I will have some fields like 'Location' 'Start time' 'End time' which will be automatically filled in when the user inserts the URL of an event.
Please let me know! A link to the source with explanation etc. would also be really nice. (It's for a school project)
Yes you can. Ill try to explain you the simplest possible way to do that.
First of all go to : http://developers.facebook.com/apps and create an app.
Then, save the App access token which is: app_id|app_secret
Your url will be of format: https://www.facebook.com/events/{event-id}. Fetch the event id from this. Quite simple right?
Then you are going to use the facebook's powerful graph api. Just get the contents from : https://graph.facebook.com/{event-id}?access_token={app-access-token}
The list of all possible fields that you can get (only if set in the event of-course): https://developers.facebook.com/docs/graph-api/reference/user/events/#pubfields
That's it!

The app test users are unable to like the page.

I'm developing a facebook application and I need test users to test it.
I know that facebook provides now the possibility to create tests users, but they can't "like" a public page and this prevent me to use them because the "likes" is the only thing I need.
Do you know any solutions?
Thanks in advance.
Adding Like button code is quite simple, so if the goal of your testing is to make sure it will work properly with Facebook, all you need is to generate Like code using FB Reference , and you can be confident it works without testing.
If the goal of your testing is testing something else, based on number of responses, and you need a good representation of numbers (e.g. 10, 100, 1000, ...), you have 2 options:
hook "pseudo like" to some file/db table where you can change it as you want, test with all the numbers you need to test, and then replace with real FB Like
since Like is based on URL, during testing you could test your logic using Like code for some other pages (that already have different number of likes). For example reference page I gave a link to above, has about 65k likes, so I could use code for that page temporarily to test my logic for 65k likes.
After that you still can test a few numbers by using your friends as test subjects of course.
If only there were a website where you could ask all of your friends to help you... a website that included the ability for those friends to "like" whatever it is you are working on... you'd have to ensure that those friends were willing to spare a brief moment of the work day to (gasp) not work and view the website instead...
Sarcasm aside, I think your best bet will be to ask the people on facebook for a few likes just to help you with a project.