Wizcorp / phonegap-facebook-plugin

The official plugin for Facebook in Apache Cordova/PhoneGap
Other
1.91k stars 2k forks source link

post graph-api #1147

Open lichutin opened 9 years ago

lichutin commented 9 years ago

Hello! It's very intresting to know how to send post-api calls via this plugin. Is there some solution?

jrm0695 commented 9 years ago

I also need to call graph API with another method (delete). i'm working on implanting a method choice with graph requests; I'll let you know when i'm done with it

glennkarlsen commented 8 years ago

+1

ghost commented 8 years ago

+2

lunchbag commented 8 years ago

+3

jrm0695 commented 8 years ago

I managed to make a request that uses "delete" method in a request to graph api : simply use a classic jquery ajax request :smile: This request deletes the app from the facebook user. Doing this, the user will see "Do you want to give this informations to this app..." next time he tries to connect

            $.ajax({
                method : 'DELETE', url : "https://graph.facebook.com/" + userID+ "/permissions"
                + "?access_token=" + userAccessToken }); 
jrm0695 commented 8 years ago

I guess it looks pretty the same for a POST query

dantabel commented 8 years ago

I had to clone and add my own functionality. I actually cloned a fork of this repo but here's my code. You can then use FacebookConnectPlugin.apiPost(path, permissions, postData, success, failure) instead of FacebookConnectPlugin.api(path, permissions, success, failure) to POST https://github.com/dantabel/cordova-plugin-facebook4

jnccneto commented 8 years ago

Can you post a file object? for a video upload?

dantabel commented 8 years ago

@jnccneto I haven't tried it but I think so. See Facebook docs for the params and path etc, but I think it just uses a POST, you just need to make sure that the video is encoded as multipart/form-data as stated in the FB docs: https://developers.facebook.com/docs/graph-api/reference/user/videos/#Creating

jnccneto commented 8 years ago

Yes that's the way. I endedp using a FileTransfer() from cordova plugin cordova-plugin-file-transfer