Google Analytics embed API - access_token "REQUEST_DENIED" on other Domain - google-analytics

in my new Company i had to debug an error with the Google Analytics Embed API.
Following i figured out:
We use following API: https://developers.google.com/analytics/devguides/reporting/embed/v1/getting-started
In the Backend we make a Request to the O-Auth Service with the JSON Crediential to use in the frontend the authentication Method: serverAuth.access_token instand of the key or clientId
In the Frontend it worked correctly with one Domain.
For the Request against: maps.googleapis.com/maps/api/js/AuthenticationService.Authenticate?1s&callback=xdc._je5rc5&token=XXXXXX i got the Result:
/**/_xdc_._je5rc5 && _xdc_._je5rc5( [1,null,0] )
And the Second Request:
maps.googleapis.com/maps/api/js/GeocodeService.Search?4sLondon%20UK&7sUK&9sde-DE&callback=xdc._1aw0g9&token=XXXXX1
Return the Right Response: /**/_xdc_._1aw0g9 && _xdc_._1aw0g9( {
"results" : [
{/* Short Version */}
],
"status" : "OK"
}
)
But the same Requests on the same Server with another Domain got an error:
Request: maps.googleapis.com/maps/api/js/AuthenticationService.Authenticate?1s&callback=xdc._bllk9e&token=XXXXXX
Response:
/**/_xdc_._bllk9e && _xdc_._bllk9e( [0,15,0] )
And the Second Request: maps.googleapis.com/maps/api/js/GeocodeService.Search?4sLondon%20UK&7sUK&9sde-DE&callback=xdc._1aw0g9&token=XXXXX
Response:
/**/_xdc_._1aw0g9 && _xdc_._1aw0g9( {
"error_message" : "Geocoding Service: This service requires an API key. For more information on authentication and Google Maps Javascript API services please see: https://developers.google.com/maps/documentation/javascript/get-api-key",
"results" : [],
"status" : "REQUEST_DENIED"
}
)
Maybe some one had an idea what i could do?

Related

LinkedIn API request fails with "Unpermitted fields present in RESOURCE_KEY: Data Processing Exception while processing fields [/memberId]"

I'm trying the following request:
GET https://api.linkedin.com/v2/people/(id:urn:li:person:<person id>)?oauth2_access_token=<token>&projection=(results*(localizedFirstName,vanityName))
But I always get a:
{
"serviceErrorCode": 100,
"message": "Unpermitted fields present in RESOURCE_KEY: Data Processing Exception while processing fields [/memberId]",
"status": 403
}
If I try to do it using the alternative API:
GET https://api.linkedin.com/v2/people?ids=List((id:urn:li:person:<person id>))&oauth2_access_token=<token>&projection=(results*(localizedFirstName,vanityName))
An Internal Server Error is returned:
{
"message": "Internal Server Error",
"status": 500
}
I'm using Google Chrome to perform those requests.
I tried using Postman too.
Headers:
X-Restli-Protocol-Version: 2.0.0
Authorization: Bearer <token>
Got:
{
"serviceErrorCode": 0,
"message": "Syntax exception in path variables",
"status": 400
}
My app permissions are:
r_emailaddress
r_ads
w_organization_social
rw_ads
r_basicprofile
r_liteprofile
r_ads_reporting
r_organization_social
rw_organization_admin
w_member_social
I tried other APIs (socialActivity, ugcPosts) and everything looks fine.
I checked my API usages at https://www.linkedin.com/developers/apps/<id>/usage and people usage is currently 0%.
The tested user profiles are also public.
You should only use the id (instead of the urn). also the fields projection is wrong:
Use:
projection=(localizedFirstName,vanityName)
Instead of:
projection=(results*(localizedFirstName,vanityName))
As example:
curl -H "X-Restli-Protocol-Version: 2.0.0" \
"https://api.linkedin.com/v2/me?oauth2_access_token=<TOKEN>&projection=(id)"
Will return
{
"id": <ID>
}
and use it as:
curl -H "X-Restli-Protocol-Version: 2.0.0" \
"https://api.linkedin.com/v2/people/(id:<ID>)?oauth2_access_token=<TOKEN>&projection=(localizedFirstName,vanityName)"
So:
{
"vanityName": "<VANITY-NAME>",
"localizedFirstName": "<NAME>"
}
Hope this help
id parameter needs only person_id but you are providing urn.Try this https://api.linkedin.com/v2/people/(id:person_id) and don't forgot to include X-RestLi-Protocol-Version:2.0.0 in header while making call.

How to map the API publisher query parameter values to the Backend URL resource path in WSO2 API M

I need to map the API publisher query parameter values to backend URL resource path. I have the API publisher URL be like
"https://102.20.10.3:8245/srno/v1.0/studentRecordNo?user_id=test29"
and the Backend URL like
"http://localhost:8280/services/getStudRecNo.HTTPEndpoint/getsrno/{uri.var.user_id}"
When i execute in swagger , i am getting error like below
{
"Fault": {
"Code": "",
"Reason": "DS Code: VALIDATION_ERROR\nNested Exception:-\njavax.xml.stream.XMLStreamException: DS Code: VALIDATION_ERROR\nSource Data Service:-\nName: getStudRecNo\nLocation: \\getStudRecNo.dbs\nDescription: get student unique id\r \r \r \nDefault Namespace: http://ws.wso2.org/dataservice\nCurrent Request Name: _getgetsrno_user_id\nCurrent Params: {user_id={studentRecordNo,test29}}\nNested Exception:-\nScalar type expected\nField Name: user_id\nField Value: {studentRecordNo,test29}\n\n",
"Detail": ""
}
}
Please help me.

LinkedIn API v2 is not returning full profile data

I'm updating my application to use the LinkedIn API V2 and OAuth 2.0,. The changes works as expected retrieving the basic data (r_liteprofile, r_emailaddress)
However, I need retrieve some fields related to full profile (e.g, skills, educations) and others that previously were into the r_basicprofile (positions), but that fields are missing in the linkedIn response. here's the call that I'm using to get the data
https://api.linkedin.com/v2/me?projection=(id,firstName,lastName,educations,skills, positions)&oauth2_access_token=ACCES_TOKEN
And here's the response that I'm getting
{
"firstName" : {
"localized" : {
"es_ES" : "Johan"
},
"preferredLocale" : {
"country" : "ES",
"language" : "es"
}
},
"lastName" : {
"localized" : {
"es_ES" : "Rincon"
},
"preferredLocale" : {
"country" : "ES",
"language" : "es"
}
},
"id" : "MY_LINKED_IN_ID"
}
My linkedIn app currently is working with the old API V1 and already has access to the r_fullprofile, so, with API V1 I'm getting the full profile fields as expected.
I've researched some hours, and the difference with other cases is that my app already has access to full profile (granted from V1)
My questions are:
Am I need request again access to the full profile ?
Am I doing some wrong for the API V2?
Here's the attachment where I'm verifying that I'm requesting the expected scopes
Requesting litle profile, email and full profile
In V2 for using r_fullprofile you have to apply for partner program
after approval only you can use r_fullprofile
Have you tried calling the API with field projection like this:
https://api.linkedin.com/v2/me?fields=id,firstName,lastName,educations,skills,positions
According to the documentation you should request the required fields this way:
https://learn.microsoft.com/en-us/linkedin/shared/api-guide/concepts/projections
Hope it helps!

Using nginx to redirect dynamic request

I have a druid service which runs at my local machine at port 8082 as follows:
Method POST: http://localhost:8082/druid/v2/?pretty
Body:
{
"queryType" : "topN",
"dataSource" : "some_source",
"intervals" : ["2015-09-12/2015-09-13"],
"granularity" : "all",
"dimension" : "page",
"metric" : "edits",
"threshold" : 25,
"filter": {
"type": "and",
"fields": [
{
"type": "selector",
"dimension": "pix_id",
"value": "1234"
}
}
}
Hitting this query gives me a list of records based on the value of the dimension 'pix_id'.
Now, I want to setup an nginx such that the external application should not have any clue about my druid service. I just want the external application to hit the URL:
http://localhost:80/pix_id/98765
This url should dynamically generate a JSON with the above mentioned pix_id and send a request to druid and return the response to the user.
Is it possible to do this in nginx?
Yes you can do this, but rather I would suggest to have a php or python script in between to give the results.
So the setup would be -
Have php page receive the request.
make a curl call from php to the druid, locally.
get the result and pass on the response.
There are multiple benefits of doing this eg. -
You completely mask druid, and not necessarily limited to druid.
You can do more calculations in php before sending the request to druid.
caching at php end.

Commenting on a LinkedIn post using REST API returning 500

I have a linkedin company page.I am trying to post a comment on an already existed post of that page via Linkedin Rest API.
Below are the request details :
HTTP METHOD : POST
URL : https://api.linkedin.com/v2/socialActions/urn:li:activity:{activity-id}/comments
HEADERS : Authorization, Content-Type
BODY :
{"actor": "urn:li:organizationBrand:<org id>",
"message": {
"attributes": [],
"text": "This is a comment"
}}
The above request is throwing me the below error :
{"message": "com.linkedin.restli.client.RestLiResponseException: Response status 500, serviceErrorMessage: Error creating comment",
"status": 500}
The same request works for me for another linkedin company page. Can you please help me on finding what the issue is?

Resources