Hot answers tagged

5

Yes, it can be annoying that the API docs, the javascript SDK, and the settings pages use the terms: "Explicit" "Implicit" "Server side" "Client side" a little interchangeably. (The first 2 are roughly synonymous with the last two.) From the javascript SDK docs: Your application must have the client side OAuth flow enabled, and must not have the ...


3

As of this writing https://api.stackexchange.com does only allow the writing of Comments. See https://api.stackexchange.com/docs/write Starting with version 2.1, the Stack Exchange API provides limited support for writing to sites in the Stack Exchange network. There are a number of constraints imposed to prevent abuse and loss of quality on Stack ...


2

The API filters are kept pretty simple, and there is no way to restrict these answers to just accepted answers. Your app would loop through the items array and return/handle only those where is_accepted is true. Since you appear to be using PHP, the Stack.PHP library may save you time and effort, overall.


2

bug support @Nathan Osman, I have been trying to get authentication working with your library (which is very useful BTW). However, whenever I use the explicit flow I end up with an error on the stack exchange.com/oauth/submit page saying: Cannot return to provided redirect_uri The uri I am attempting to provide is generated using BeginExplicitFlow in ...


2

I've already used the Stack.PHP library in a WordPress plugin and am deploying a second one. They had a class conflict and using class_exists before require_once/stackphp* didn't work. I had to do this at the beginning of the file output_helper.php: if( !class_exists( 'API' ) ): require_once 'api.php'; require_once 'auth.php'; endif; require_once '...


1

Unpack response content with $response->getBody()->getContents(). use GuzzleHttp\Client; Route::get('/approve', function () { header('Location: https://stackexchange.com/oauth?client_id=12345&scope=write_access&redirect_uri=https://mysite.com/approved'); }); Route::get('/approved', function (Request $request) { $client = new Client(); ...


1

Several things: The problem is not HTML entities, it is that the API always returns compressed data. Don't try to use file_get_contents() for that. Use cURL, but note that using cURL with HTTPS is not straightforward. See Using cURL in PHP to access HTTPS (SSL/TLS) protected sites for more information. Those headers do not set how data is fetched from the ...


1

This is probably a dumb question, but: How do you retrieve the body of a post? For example, I have: $questionList = $api->Questions()->SortByActivity()->Exec(); while($question = $questionList->Fetch(TRUE)){ ... } But... how do I get the question body? It doesn't seem to be in the API reponse that I can see. I remember in the v1 API you ...


Only top voted, non community-wiki answers of a minimum length are eligible