How to get the user location using url path of facebook graph? - php

Right now i can get the user's name,avatar,email of the user but when i try to use this for location https://graph.facebook.com/v2.2/1234567890/location im getting this message
{
"error": {
"message": "Unknown path components: /location",
"type": "OAuthException",
"code": 2500
}
}

resource url for user location is {id}/locations.
https://graph.facebook.com/v2.2/1234567890/locations
unfortunately , locations resource was deprecated in v2.0 or higher.accessing the above url will return
{
"error": {
"message": "(#12) user locations API is deprecated for versions v2.0 and higher",
"type": "OAuthException",
"code": 12
}
}

Related

Create Local post on Google My Business Issue

Attempting to create Google My Business Local Post using My Business API and PHP.
A Local Post is created just fine EXCEPT when adding the mediaItem object to the post body.
Getting the error :
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"errors": [{
"message": "Request contains an invalid argument.",
"domain": "global",
"reason": "badRequest"
}],
"status": "INVALID_ARGUMENT"
}
}
Below is the post object with mediaItem that is being sent to localPosts->create
$new_post = new Google_Service_MyBusiness_LocalPost();
$new_post->setSummary('Hello World');
$new_post->setLanguageCode('en-US');
$media = new Google_Service_MyBusiness_MediaItem();
$media->setMediaFormat("PHOTO");
$media->setSourceUrl("https://www.webyhub.com/img/logo.png");
$new_post->setMedia($media);
You will need to do this on Postman to get the detail validation message as to why the image you used is invalid.
Try Advanced Rest Client (or Postman), make a POST request to https://mybusiness.googleapis.com/v4/accounts/{uuid}/locations/{uuid}/localPosts with
Header: Authorization: Bearer {access_token}.
Body Content Type: application/json
Body:
{
"summary":"test",
"topicType":"STANDARD",
"media":[{"mediaFormat": "PHOTO","sourceUrl": "https://example.com/files/test.jpg"}]
}
Also, Creating Post with video uploading is not currently available. I dont know why but I am also stuck on this matter.

PHP Google API: How do I get clearer debugging information?

I'm using Google API OAuth2 to authentificate my users (and I'm requesting a few scopes such as calendar).
This part is working but when I'm trying to access the calendar, I'm getting the following error output:
An error occured while fetching events: { "error": { "errors": [ {
"domain": "global", "reason": "authError", "message": "Invalid
Credentials", "locationType": "header", "location": "Authorization" }
], "code": 401, "message": "Invalid Credentials" } }
Is there some way to get (extra) debugging info on the server or on google api side ?

google app quickstart.php example how to change sheet

So i have run through the guide of how to read data from a google sheet using their API. All works fine until i want to read from any sheet other than the one given in the example.
https://developers.google.com/sheets/api/quickstart/php
is there something else that i need to change as when I update the spreadsheet id to one of mine i just get the following
Fatal error: Uncaught exception 'Google_Service_Exception' with message '{
"error": {
"code": 400,
"message": "Unable to parse range: Class Data!A2",
"errors": [
{
"message": "Unable to parse range: Class Data!A2",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
Any help would be greatly appreciated.
sorry guys the issue was that i was declaring the range wrong problem now sorted.

Facebook api 2.7 - No Metric Specified

I have been using below request to receive data from facebook api:
143357502355510/feed?fields=insights{name,title}&since=1474732800&until=1477324800&limit=100
but after version 2.6 has been deprecated and I changed sdk version to 2.7 this error is receiving:
"error": {
"message": "Invalid query",
"type": "OAuthException",
"code": 3001,
"error_subcode": 1504028,
"is_transient": false,
"error_user_title": "No Metric Specified",
"error_user_msg": "No metric was specified to be fetched. Please specify one or more metrics to be fetched and try again.",
"fbtrace_id": "XXXXXXXXXXX"
}
anyway to change the request and get the same data as before?
Found the answer here:
check this post
and I changed my request to:
143357502355510/feed?fields=insights.metric(post_impressions_unique,post_impressions){values,title}&since=1474732800&until=1477324800&limit=100

PHP Google Play Subscription API

I am trying to get Google Play API subscription details using PHP and using following url to get purchase data :
https://www.googleapis.com/androidpublisher/v1/applications/[PACKAGE]/subscriptions/[SKU]/purchases/[PURCHASE_TOKEN]?access_token=[ACCESS_TOKEN]
I am getting the following error:
{
"error": {
"errors": [
{
"domain": "androidpublisher",
"reason": "developerDoesNotOwnApplication",
"message": "This developer account does not own the application."
}
],
"code": 401,
"message": "This developer account does not own the application."
}
}
Please help me sort out.
Just providing the URL does not help you get data of any application. How can you think so.? Isnt it insecure.? You have to get proper data by which you can at least prove ownership for the app..

Categories