facebook api confusion - php

I am coming back to facebook app development after a long time. And I am confused :)
Am I required to use the Graph API or can I still use the REST Api?
Because I am unable to make calls with the old REST api methods.
I am using PHP. Do I need to use the (now) official SDK?
thanks a lot in advance.

You can still use the REST API, but they recommend developers to use the new Graph API. I'd be surprised if Facebook doesn't start phasing out the old API soon, and ultimately deprecate it altogether.
You can make API calls to the old REST API with Facebook's new PHP SDK as well, and unlike the old library it doesn't suck.

Related

QuickBooks Online v3 - REST API and the SDK

I'm having a bit of trouble figuring out how to properly proceed making calls using the Intuit QuickBooks Online API v3. I've looked at the API Explorer, and from my understanding, I can send and receive JSON.
They also provide information about the base URL, the entity, etc: https://developer.intuit.com/docs/api/accounting/Customer
So I'm wondering, am I supposed to be using the QuickBooks SDK that they mention to download? https://developer.intuit.com/docs/0100_accounting
Or would I be able to utilize their API using something like cURL? I don't want to reinvent the wheel of course, but with all the information they provide and no reference to the SDK itself, that's where I started to get a little confused. They basically tell you how to make the calls, but don't reference the SDK in those documents.
Just to provide some extra information, I'm using PHP 5.5 and Laravel.
So I'm wondering, am I supposed to be using the QuickBooks SDK that they mention to download?
If you want to, sure.
Or would I be able to utilize their API using something like cURL?
Again, if you want to, sure. Just be aware that if you use cURL, you'll have to do some OAuth signing of your requests (see the OAuth spec) or find an OAuth lib too.
Here's another open-source alternative if you need something with more examples (disclaimer: I'm the author):
https://github.com/consolibyte/quickbooks-php
Examples:
https://github.com/consolibyte/quickbooks-php/tree/master/docs/partner_platform/example_app_ipp_v3

Best way to build a Shopify App with OAuth

My client would like a twitter feed that just shows her most recent tweet on her Shopify site. She needs it to be more customizable than the current standard widget provided by Twitter is.
There is a Shopify app that someone built for a monthly fee that does this, but I'd like to build it on my own.
I have already built a stand-alone solution with the Twitter API and twitterOAuth PHP library. Since I can't run the PHP on Shopify, I figured I need to build an app.
Just wanted to see if I'm on the right track or if there is a better way to do this. Thanks in advance.
If you can handle Twitter oAuth, then clearly you can handle Shopify oAuth. As per what we can barely call standards, it turns out using oAuth is pretty much the same between all these services. So Shopify oAuth is going to pose no trouble for you. Hence it is relatively easy for you to create an App in PHP in the cloud, that scrapes Twitter, and provides said scraped Tweet to Shopify.

Quickbooks Online API using PHP with Curl Oauth

The documentation for accessing the Quickbooks Online API seems to revolve around creating applications for public use. I'm only interested in developing an app to access my very own Quickbooks file. However, I'm having difficulty authenticating.
I successfully obtain all the necessary codes and can run API calls in the API playground. My preference would be not to use any libraries (including the Quickbooks PHP library as it does not support JSON).
I have spent hours searching but I do not know how to 'sign' the various secrets and codes to obtain the Oauth token needed. Does anyone have working PHP code?
I'd like to simply be able to input in the values and make the API calls via curl.
I have spent hours searching but I do not know how to 'sign' the various secrets and codes to obtain the Oauth token needed.
You sign the code using OAuth. This is a well documented authentication method, with many implementations.
Does anyone have working PHP code?
Sure:
https://github.com/consolibyte/quickbooks-php/blob/master/QuickBooks/IPP/OAuth.php#L77
https://code.google.com/p/oauth-php/
https://php.net/manual/en/book.oauth.php
https://pecl.php.net/package/oauth
https://github.com/Lusitanian/PHPoAuthLib
My preference would be not to use any libraries
OAuth is not a trivial authentication method. You should use a library to sign your requests -- it will save you a lot of time vs. implementing your own OAuth signatures.

Youtube Analytics API Issue?

When reading through the Youtube API, i noticed that the base url for requestions was using version 3 https://www.googleapis.com/youtube/analytics/v3/,
However, when i was using the youtube ANalytics API PHP class, the URL being requested was version 1. https://www.googleapis.com/youtube/analytics/v1/ is this an issue, or is the PHP library just out of date? I really do not want to have to make another one class (reinvent the wheel), but i am skeptical about using outdated code. Thanks.
This is not a problem, the current version for the Analytics API is v1, as you can see in the API explorer.

Why the Facebook PHP SDK is out of date? What is the alternative?

I'm so frustrated right now. I spent so much time trying to debug my application to find out that the official PHP SDK from Facebook is out of date and doesn't look like it's maintained anymore: https://github.com/facebook/facebook-php-sdk
After lodging a bug to Facebook because of an error returned by the API, one of the employee at Facebook respond the following:
THe old REST API does not support use of Page Access Tokens, you need to use the Graph API for such API calls - if you're using an SDK, please ensure it's routing your FQL queries to https://graph.facebook.com/fql?q=X and not https://api.facebook.com/method/fql.query
However in the PHP SDK that Facebook provide it's using the following request:
URL: https://api-read.facebook.com/restserver.php
GET: method=fql.query&return_ssl_resources=1&query=SELECT+comment_info.comment_count%2C+created_time%2C+like_info.like_count%2C+permalink%2C+post_id%2C%0A+share_info.share_count%2C+type%2C+attachment.media%0A+FROM+stream%0A+WHERE+actor_id%3Dxxxxxx%0A+AND+source_id%3Dxxxxxx%0A+ORDER+BY+created_time+DESC%0A+LIMIT+100&callback=&api_key=xxxxxxxxx&format=json-strings&access_token=xxxxx
Anyone bumped into this issue? What SDK are you using instead?
The PHP SDK on Github is still maintained and the official source (see https://developers.facebook.com/docs/reference/php/)
Still, old API (like the REST api) are still supported for backward compatibility concerns. But for new stuff, you need to use the Graph API. If you read the documentation, it is very clear that the Graph API is the way to go (there's no mentions of REST api in the documentation). https://developers.facebook.com/docs/reference/php/facebook-api/
So, I think the issue here is you started of reading some old blog posts without reading the official APIs docs. Honestly, around Facebook stuff, only believe what you can find in the official documentation and on StackOverflow with a good vote rating. Too many bad developers have been trying to bring SEO to their websites writing shitty article on developing Facebook apps.

Categories