I'm using the ruby gem google-api-client version 0.8.6. I've got the account and oauth stuff all set up. I can query the read only aspects of the analytics api, including listing unsampled reports. However, if I try to insert an unsampled report, I get a 400 error: Field title is required.
I am passing in the title, so either this error message is incorrect, or I don't know what.
Here are the params:
{"accountId"=>xxx,
"webPropertyId"=>"UA-xxx-1",
"profileId"=>"xxx",
"title"=>"Browsers",
"start-date"=>"2014-01-01",
"end-date"=>"2014-01-31",
"metrics"=>"ga:pageviews"}
Here is the URL the gem calls:
https://www.googleapis.com/analytics/v3/management/accounts/xxx/webproperties/UA-xxx-1/profiles/xxx/unsampledReports?dimensions=ga%3Abrowser&end-date=2014-01-31&kind=analytics%23unsampledReport&metrics=ga%3Apageviews&start-date=2014-01-01&title=Browsers
The parameters for this request should be sent in the request body, not as query parameters append to the URL. Based on this error, what's probably happening is Google Analytics is looking at the request body, and the first thing it looks for is a title field. When it doesn't find one (since yours are in the URL), it responds with the error saying a title is required.
As far as I can tell, it looks like this gem is incorrectly implementing these API calls. You may want to try just doing the POST yourself in code.
Update: you can try playing around with this method in the APIs Explorer to get a better sense for how the request should be formatted.
Related
I'm trying to fetch data from a website (https://gesetze.berlin.de/bsbe/search). Using Mozilla, I've taken a look at the network analysis. Usually, I'm just messing around with the parameters of the POST-Request to see how I might influence the response of the server. But when I simply re-send the request (making no changes at all), I'm getting HTTP-response 500. The server answer states as message: security_notAuthenticated.
Can anyone explain that behaviour? The request is done by the same PC, the same browser in the same session, and there is no login function on that website. Pictures shown below.
Picture 1 - Code 200
Picture 2 - Code 500
The response security_notAuthenticated indicates, that your way of repeating the request omits some authentication-related information.
When I repeat the request, using Mozilla Firefox's "Resend" or "Edit and resend" function, the Cookie header is not sent with the request. Although it occurs in the editable header list when using "Edit and resend" it's missing when watching the actual sent request. I'm not sure whether this is a feature or a bug.
When using Firefox's "Use as Fetch in Console" function, the header will automatically be included and you still have the ability to change the headers and the body. The fetch API is a web standard and some introductory material about fetch can be found on MDN.
If you want to do custom requests, in the browser, fetch is a good option.
In other environments and languages you usually use some HTTP client (just search the web for "...your language... http request" or similar, you will find something).
I am making API requests to a url like this to access AdCreatives API:
https://api.linkedin.com/v2/adCreativesV2?ids=List(123,456,789)
(not the exact ids, but you get the idea)
Depending on the IDs used in the call, sometimes this works as expected, and sometimes I get a 400 error code response with the message "Cannot process request involving multiple routing entities"
What does this mean, and how can I fix it?
I assume I can't make a request that includes all of these ids at once, but is there a way to tell which ids are causing the problem? This could help me group similar IDs successfully to make the call.
Have you checked you are using X-Restli-Protocol-Version: 2.0.0 in the header?
For example, for me in python this looks like
headers['X-Restli-Protocol-Version'] = '2.0.0'
r = requests.get(url, headers=headers)
This is mentioned on the docs here
Make sure that your Creatives belong to the same account.
Based on LinkedIn's new error messages documentation, the new error message that will replace the "Cannot process request involving multiple routing entities" message is indicating that the ad account of the Creative_ids is not identical:
Entities should have the same ad account in batch update and batch partial update request.
https://maps.googleapis.com/maps/api/geocode/xml?address=Bahnhofstra%C3%9Fe+12,+37603+Holzminden,+Germany(&)key=myAPIKey
The above URL which returned Google geo-codes 2 days before, today it returned Zero_reuslts status. I tried for different address it was the same case. So I fixed them by adding (&) between key and Address.
I tried same method with premium account, it returns error as "Unable to authenticate the request. Provided 'signature' is not valid for the provided client ID, or the provided 'client' is not valid.."
But if I use the old method URL encoding as draffted below, it gives Zero_results as status.
https://maps.googleapis.com/maps/api/geocode/xml?address=Bahnhofstra%C3%9Fe+12,+37603+Holzminden,+Germanyclient=gme-myClientIDsignature=myCryptKey
I am facing the problem from today, could someone help me to resolve this issue.
Change your call and use the Places API instead of the Geocoding API:
https://maps.googleapis.com/maps/api/place/textsearch/json?key=YOUR_API_KEY&query=Bahnhofstraße+12,+37603+Holzminden,+Germany
I was able to solve the problem this way because I was facing the same problem with ZERO RESULTS errors since yesterday. Seems like Google has changed something in the Geocoding API.
There are 2 issues mixed up here.
ZERO_RESULTS are due to the new forward geocoder in the Geocoder API no longer returning poor result for incomplete or ambiguous requests. The same would happen for badly formatted requests, e.g.:
http://maps.google.com/maps/api/geocode/json?address=Bahnhofstra%C3%9Fe+12,+37603+Holzminden,+Germanykey=YOUR_API_KEY
returns ZERO_RESULTS because it's missing the & character between Germany and key. That's easy to fix:
http://maps.google.com/maps/api/geocode/json?address=Bahnhofstra%C3%9Fe+12,+37603+Holzminden,+Germany&key=YOUR_API_KEY
Once that's fixed, your client id and signature are actually being checked, and if you get the Unable to authenticate the request error it means your request is malformed. See Digital signatures for details on how to correctly sign your requests, and here's a tool that does it well, so you can check your signatures against those generated by it:
https://m4b-url-signer.appspot.com
When I send a one-off document to RightSignature via their API, I'm specifying a callback location in the XML document as specified in RightSignature's schema definition. I then get a signer-link value back from their API for the document. I display the HTML response from the signer-link URL in an iFrame on our website. When our user signs the document in this iFrame, which is rendering the responses from their website, I want their website to post to our callback location.
Can I do this with the RightSignature API and does it make sense?
So far, I'm only getting content in the iFrame that indicates that the signing was successful. The callback location does not seem to be getting called.
I got it solved just now. Basically, i was doing two things wrong first you have to go in RightSignature Account and set it there the CallBack url
Account > Settings > Advanced Settings
But the thing which RS is unable to mention to us that this url can not be of localhost, but it should be of https i mean like Live URL of your site like
https://stagingmysite.azurewebsites.net/User/CallBackFunction
And then in your CallBack just write these two lines and you will receive complete XML which would have the GUID and document status as well.
byte[] data = Request.BinaryRead(Request.TotalBytes);
string callBackXML = System.Text.Encoding.UTF8.GetString(data);
I found the answer with some help from the API team at RightSignature. I was using callback_location but what I really wanted is redirect_location. Their online documentation was difficult to follow and did not clearly point out the difference.
I got this working after a lot of trial and error.
I am trying to get this thing to work for a couple days since it's my first time working with the OAuth system without any luck.
I have been experimenting here: https://developers.google.com/youtube/v3/docs/subscriptions/insert#try-it
With the following settings:
http://i.gyazo.com/5cd28f1194d5dfebee25d07bc0db965e.png
When I execute the code it successfully subscribes to the specified channelIdaccount with the authorized account.
I have tried to copy paste the shown POST URL into my browser without any luck. The plan was just to test it as I would like to implement this in PHP.
Now to my questions:
The {YOUR_API_KEY}, is this where I am supposed to type in the access token? If so, do I need the &mine=true tag at all?
I just realized that there are no ID's in the URL but there is an JSON-object in the request box example. Am I supposed to convert a string to JSON-object and pass it to the $fields= tag?