Update Json from URL - java

Im using Firebase to get Json from a uri that is
https://resplendent-inferno-1315.firebaseio.com/Sensor.json
When i get data works fine and if i delete is ok ..... im trying to find a way to
update data for example if i have in my url this json
{"Brand":"fat-re32","Temp":16}
and i wont to update Temp in 25 how can i do that ?
I have tried http put method but that produse json i url like these
{"-DELF648645fss68f5-56" :{"Temp":125} , "Brand":"fat-re32","Temp":16}
Can anyone give a sugestion im using java so plz show a ex in Java or a library :)

Related

Beginner to API Json - Attempting to understand URL output

I am using FME to get output from the following: https://coronavirus.data.gov.uk/developers-guide
I am just a beginner and is first time I want to write this up. To generate an Output URL from this with the relevant columns, can anyone explain what I need to get the request URL. I am using GET as the HTTP method
An example of a url i get some data out of is - https://soa.smext.faa.gov/asws/api/airport/status/SFO
But when i try with the links below which i tested does not get any output https://api.coronavirus.data.gov.uk/v1/data?filters=areaType=nation;areaName=england&structure=%7B%22name%22:%22areaName%22%7D
https://api.coronavirus.data.gov.uk//v1/data?filters=areaType=nation;areaName=england&structure={"date":"date","areaName":"areaName","areaCode":"areaCode","newCasesByPublishDate":"2020-07-07","cumCasesByPublishDate":"2020-08-08","newDeathsByDeathDate":"2020-02-06","cumDeathsByDeathDate":"2020-06-09"}
This is a better link for you to try out.
https://api.coronavirus.data.gov.uk/v1/data?filters=areaType=nation;areaName=england&structure={%22date%22:%22date%22,%22areaName%22:%22areaName%22,%22areaCode%22:%22areaCode%22,%22newCasesByPublishDate%22:%22newCasesByPublishDate%22,%22cumCasesByPublishDate%22:%22cumCasesByPublishDate%22,%22newDeaths28DaysByDeathDate%22:%22newDeaths28DaysByDeathDate%22}
Took me a while to suss it out.

Gson parsing a Json file

i am trying to parse the following json file in java with gson:
So , I am trying to retrieve only the issues into a list of Issue. I have the following class to store the issue information:
But i got an error.. I am trying to get with the following but I think that i am so lost with this ( i am learning about this ) and i dont understand the error
any idea of how to do this? thank you so much!
obj.get("issues")
will actually return a List Object, and not an Issue Object. You need to change the second parameter accordingly.

How to edit a Json key from an URL ( Android Studio )

So here's the deal , I already generated this Json URL :
https://api.myjson.com/bins/w7wuz
And I did some code om my app in order to read it. So far so good.
But I'm struggling a bit , trying to edit a key on my Json URL , to see if my app would update the value as well .
I hope I was clear with what I pretend. Thanks guys .
Add a new parameter to your URL then possible otherwise not possible in my view.
Like :
https://api.myjson.com/bins/w7wuz?id=1
https://api.myjson.com/bins/w7wuz?id=2&name=kaushal

JQuery EasyUI TreeGrid Dynamic Data Loading

I'm new to jQuery and am not quite sure how to do the following:
I'm using EasyUI TreeGrid and want to display dynamic data rather than providing static data from a .json file. Currently, the code I'm using is as follows:
$(function(){
$('#test').treegrid({
url:'treegrid_data.json',
and so on. Instead, is there any way I can pass an ArrayList or bean object or something directly?
Thanks in advance.
instead of getting the static json file.. point the url to a page where you are getting a dynamic value.. say dynamic.php
url:'dynamic.php',
....
and do your stuff like mysql connect.. or getting the dynamic datas in dynamic.php and return it as json....
dynamic.php
//do your stuff like getting dynamic datas in array..
$dynamicarray= $yourDynamicDataArray..
echo json_encode($dynamicarray);
this should do...
Figured it out...instead of pointing to a static json file, specify the url as url: 'dynamic.jsp' or url: 'dynamic.java' pointing towards a jsp or servlet respectively(since we are developing a web application). In that page simply get the json string, say, as an attribute and print it using out.println(jsonString). Do not include any HTML tags whatsoever or you won't get the desired output.

google app engine not able to get blob keys in production only

I have hit a snag that i can not seem to solve. My issue is with retrieving the blob key after the app engine has called my service back. I have tried using blobstoreService.getUploads(request) and i have also tried pulling the blob key from the input stream on the request that is called back to me.
the really strange part is that if i go look into the dashboard i see all of my images in the blob store data view.
I get this error no matter how i try to get the blob keys out :
com.google.apphosting.utils.servlet.ParseBlobUploadFilter doFilter:
Could not parse multipart message: javax.mail.internet.ParseException:
Missing ';'
I am really hung up on this one and i could really use a little help.
EDIT more of the code
the fetch of the blob store url
private String fetchUrl()
{
String url = blobstoreService.createUploadUrl("/BS/returnKey");
return url;
}
snippit of the return code where the error occurs
...
if(inUrl.contains("returnKey"))
{
Map<String, List<BlobKey>> blobs = blobstoreService.getUploads(req);
...
so in my dev environment (the development app server packed in with GAE plugin for eclipse), it works fine, but then after i deploy to the app engine, the same code will not work.
I also tried pulling the data out of the Input stream from the request with teh same results (working on the dev , not on the prod).
thanks to everyone for your help!
The issue was that you can not have spaces in the id of the input on the form. I feel like there should be a more obvious error.
In any event i hope that someone finds this useful!

Categories

Resources