I am trying to edit a public spreadsheet (key = 0Av4aUydPYoNAdHV2MnRaSFhrY0NSZnNOS28yTlhRTVE) on my google_drive using Java and gdata api, but without success.
I change the url from https://spreadsheets.google.com/feeds/worksheets/key/private/full to https://spreadsheets.google.com/feeds/worksheets/0Av4aUydPYoNAdHV2MnRaSFhrY0NSZnNOS28yTlhRTVE/private/full , but returns:
Exception in thread "main" com.google.gdata.util.InvalidEntryException: Bad Request
What does this mean?
The URL you are using is invalid, the correct one has /private/ instead of /public/, as in:
https://spreadsheets.google.com/feeds/worksheets/0Av4aUydPYoNAdHV2MnRaSFhrY0NSZnNOS28yTlhRTVE/private/full
Related
I am trying to create a OSLCLink using this Java API:
void createOSLCLink(java.lang.String type, java.lang.String purl)
ex: cellElement.createOSLCLink("TRACE", purl );
The problem is I cannot find any solution to get the "purl" - URL of the remote element.
Thank you.
I'm working on building a weather app using the Open Weather API. The below properly calls the API but for some reason returns null.
JSONObject queryResults = data.optJSONObject("weather");
System.out.println(queryResults.toString());
Here is the API Call
API Call Image
When I put in "coord" or "main" or "clouds" or "sys", it works perfectly I get the results. But for some reason, just with "weather" it returns null. What am I missing? Thanks!
Needed to use JSONArray. Thanks to asfmlr in the comments above.
I'm trying to write a program that checks if a user uploaded a new video. I wanted to make it a backend job that constantly checks a users most recent video and then send a push my users utilizing my application. Is there any documentation or sample code on this matter? I haven't the slightest clue where to start.
The simplest way I found is via RSS feed. Simple to parse. Simple to get it going. Begin checking this out:
https://www.youtube.com/t/rss_feeds
To PARSE the RSS in java, use Rome: https://github.com/rometools/rome
Download YouTube's Java API and then use the code they provide:
String feedUrl = "http://gdata.youtube.com/feeds/api/users/GoogleDevelopers/uploads";
VideoFeed videoFeed = service.getFeed(new URL(feedUrl), VideoFeed.class);
printVideoFeed(videoFeed, true);
This is for version 3, which is the latest they provide.
I am trying to pull a page of user documents on a specific user. I have tried to reach out to Google support to troubleshoot the issue but they did not help in the issue. When I pull this particular user's file list I receive the error :
java.lang.IllegalArgumentException: number field formatted as a JSON string must use the #JsonString annotation [key aperture, field private java.lang.Float com.google.api.services.drive.model.File$ImageMediaMetadata.aperture]
at com.google.api.client.repackaged.com.google.common.base.Preconditions.checkArgument(Preconditions.java:119)
at com.google.api.client.util.Preconditions.checkArgument(Preconditions.java:69)
at com.google.api.client.json.JsonParser.parseValue(JsonParser.java:789)
at com.google.api.client.json.JsonParser.parse(JsonParser.java:438)
at com.google.api.client.json.JsonParser.parseValue(JsonParser.java:745)
at com.google.api.client.json.JsonParser.parse(JsonParser.java:438)
at com.google.api.client.json.JsonParser.parseValue(JsonParser.java:745)
at com.google.api.client.json.JsonParser.parseArray(JsonParser.java:610)
at com.google.api.client.json.JsonParser.parseValue(JsonParser.java:708)
at com.google.api.client.json.JsonParser.parse(JsonParser.java:438)
at com.google.api.client.json.JsonParser.parseValue(JsonParser.java:745)
at com.google.api.client.json.JsonParser.parse(JsonParser.java:358)
at com.google.api.client.json.JsonParser.parse(JsonParser.java:331)
at com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:87)
at com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:81)
at com.google.api.client.http.HttpResponse.parseAs(HttpResponse.java:459)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
To me this looks like a Java Client Library parsing issue but I would like to bring it to the attention of someone in the Drive team to have them look at it.
The code to produce this error is as following :
Files.List request = service.files().list();
FileList files = request.execute();
I have researched this quite heavily but have been unable to find a solution. I have created the simplest unit test to fetch a single entity but am still receiving the "Unable to find converter" exception. I have included the org.restlet.ext.servlet.jar,org.json.jar and org.restlet.ext.net.jar in my class path. I am also able to see the json returned and have been able to print using the cr.get(MediaType.APPLICATION_JSON) method.
ClientResource cr = new ClientResource("http://localhost:8888/r/establishment/29");
Establishment est = cr.get(Establishment.class);
System.out.println("Establishment name is " + est.getName());
I am using restlet-gae-2.1rc6 on GAE vs 1.7.1
You need to register a converter. Example:
Engine.getInstance().getRegisteredConverters().add(new JacksonConverter());
See a question with the same solution but a different problem: Android to gae restlet example doesn't work on the Android side
I found the solution here: https://stackoverflow.com/a/5205993/435605