Facebook json url to retrieve event wall feed - javascript

I'm currently trying to pull the wall from this event page: https://www.facebook.com/event.php?eid=139373546157232, but I'm not sure how I go about getting the graph url to use in an ajax request.. I want to get it in json format and I also need the auth token.. This event is not private so should I need a auth token just to read the data?
I have used this url to get the event info: https://graph.facebook.com/139373546157232 but the object has limited data...
Thank you

Events have a number of 'connections' to give you more data:
http://developers.facebook.com/docs/reference/api/event/
Unfortunately it seems you do need an access token to access the interesting parts of the info. However, a public access token from any user should be sufficient if the event is public. Perhaps generate an offline access token as yourself and store it permanently and try using that if you need to query event info in a non-connected-user context.

Related

Not able to fetch json data from a "SINGLE-TYPE" content-type in strapi

I used strapi as my backend for all my data flow, I created single-type content, this single type has different components attached to it. After configuring all the single-types, I tried to fetch the data through rest Api, But I didn't got the json data as a response.
This is my json response
This is my single-type structure
So to get back all the data from the "single-type" the following procedure are:
After creating the single-Type content, Go to the settings of the strapi admin page and then click the Role option.
Click on the public tab.
locate permissions tab and search for the single-type you created and click on the single-type tab.
Then you will find the permissions for that single-type, tick on find option, there are other option too, tick it as per your needs.
After that you will see a api endpoint on the right side of the screen for that particular single-type.
Copy that endpoint.
Use your browsers or any api client like Postman etc to test the api endpoint.
Now the Main Trick comes here
To get the result of the end point you have to type something like this:
http://localhost:1337/api/"your single-type name"?populate=*
This above code will list all the components and all its data inside of it will be displayed in the json response.
NOTE:
If there is any image data or any other media files inside the component it won't be displayed, so to to get that also along with other data you need to type:
http://localhost:1337/api/"your single-type name"?populate[your component name which contains that image data][populate]=*
When you type the api endpoint url your single-type name should be without double quotes
Follow this link : For More Information regarding how to handle the rest api in strapi

Invalid server-key when performing a POST request to FCM?

I'm following this tutorial for push notifications, and I'm stuck at the part where it says
To trigger a push message, make a POST request to this URL.
I generated the public and private keys using this site and placed the public key in the applicationServerKey key before calling registration.pushManager.subscribe, and I get a properly formatted JSON response, but I'm unsure of how exactly to generate the Authorization header for use in the POST request to send a notification. Here's what the JSON response from subscribe looks like:
{
"endpoint":"https://fcm.googleapis.com/fcm/send/asdf:qwer",
"expirationTime":null,
"keys":{"p256dh":"key","auth":"auth"}
}
I surmised that the portion after /send should be placed in the to field, but I'm unsure of how to format the Authorization header. Surely I should need to use the private key in some way, but I'm not sure how.
My assumption is that I need to perform some sort of operation on my private key, the p256dh field, and the auth field, and that result will be placed in the key= field in the POST request, but I cannot find the reference for this.
Do you need to create a Firebase project to do this? I'm unsure of whether or not this is the case.
Yes, all access to Firebase products and services requires the creation of a Firebase project. You can't use arbitrary keys to invoke FCM. You must use a service account that's been granted permission to call the API.

Display visitor_posts facebook graph api

I'm using visitor_post to display page visitor posts.
right now i can get created_time, message, and id in object.
is it possible to display also the user profile picture?
The from field holds the user id, and via Field Expansion syntax you can use that to request the picture property of that:
...?fields=from{picture.type(large)}
Be aware that you will need a page access token to make this request; with any other kind of token you won't get any user details for posts on pages any more.
That of course also means that you should only do this on the server side (which you should for caching purposes anyway), because a page access token should never be exposed in publicly available code such as client-side JavaScript.

How to open a new window and extract a param after user authenticates

I am making a simple web app and the service provider I am using authenticates through the OAuth 1.0 protocol. I would like to know how to extract a param after user signs in from a separate browser window and grants access. I have done this before in Objective-C for an iOS app using an event, but am unaware how to do it using a browser and using JavaScript. I assume I do something similar using an addEventListener() or onClick() type method? Also, can this quickly be achieved using a JQuery method? Details below.
I want to:
Open a separate window to allow the user to sign in.
User will then 'GRANT' access, at that point, the page will reload with the newly appended parameters to the URL.
I then need to extract the params, which are the verifier and token oauth_verifier=verifier&oauth_token=token, from the URL after user signs in.
Something to note:
The service provider does not allow a callback. The user need to pass oauth_callback=oob for the param.
The link below is what I come across often while searching for an answer, however it just describes how to open a new window and point the user to a URL:
How to open a new window and insert html into it using jQuery?
Thank you for your help!
If you open a new window with JavaScript, as described in the link you found, can you then access the location property to read the URL parameters?
var w = window.open();
console.log(w.location);
Maybe you need to check the value every 10 seconds with a setInterval or something, to get the new URL value once it updates after your user signs in.
Hope this helps!
Do not put any authentication information in the URL as it is not protected and can be intercepted.
You can use localStorage to store authentication information and have that be available between different browser windows.

Json parameter casting inheritance web api 2

I am using MS Web API 2 to receive calls from our web page using ajax.
Then I have 2 classes: subscriber and externalSubscriber. Subscriber contains very basic data like a name and id. External subscriber inherits from subscriber and adds basic data like address and email. I have one api method to edit the data of a subscriber defined like this:
public IHttpActionResult PutSubscriber(int id, Subscriber subscriber)
In our page I create a json string using the data provided which leads to it ether being a external or a normal subscriber.
I am able to post to this function using both but with an externalSubscriber object the added data gets lost and trying to cast from subscriber leads to an error.
my question is if anyone has any experience with this issue and if there is another way to fix this besides creating a specific function for putting a external subscriber.
I have got it to work by using the information provided on the following pages:
http://www.newtonsoft.com/json/help/html/SerializeTypeNameHandling.htm
Polymorphism in Web API: Single endpoint possible?
First I set the json setting:
jsonsettings.SerializerSettings.TypeNameHandling = TypeNameHandling.Auto;
then setting the type of the json object before sending with ajax using
jsonObject { '$type' : .Models.ExternalSubscriber, solution.project', ....}
after this I am able to cast the incoming Subscriber to an ExternalSubscriber and access its properties.

Categories

Resources