I want to parse the graph Cool service in android. I am unable to parse the data.
here is the URL:
https://api.graph.cool/simple/v1/cj8dyjr0144dk33b7pz
have to parse this service
mutation {
updateLocation(
id:"cjck0maq9q7ovs54z",
lat:"16.11",
long:"81.11"
) {
id,lat,long
}
}
Please, any one has idea about that.Please help to resolve this issue.
please refer the complete document provided by Apollo graphql. it is a GraphQL compliant client that generates Java models from standard GraphQL queries.this link provides a sample application for native android.
click here
Looks like you use a tool to create classes that do the parsing: apollo-codegen
It was mentioned in the docs here: frontend quick start
So very similar to how you work with AIDL in Android.
Related
I am working on a project on android and I want to implement the functionality of my application on an API written in Node JS and use it with HTTP requests.
I am searching for an (open source) HTTP API (CRUD System) that I can use in my android application in order to make HTTP requests to my API (GET, POST, PUT, DELETE).
What are you suggesting me? Which are the best solutions?
Thank you
I recommend OSS "Fuel".
https://github.com/kittinunf/Fuel
I created a sample application of API request using Fuel.
https://github.com/y-okudera/FuelSampleApp
I hope this will be of some help.
I'm new in iOS development. I have a little experience in Android development and wanna to learn iOS development. In Android i use Retrofit library to access API.
And now i want to know kind of library for access API. I want to discuss about API library that have good performance, easy to use, and easy to understand. yeah of course i already try to find it and i get it :
https://medium.com/ios-os-x-development/restkit-tutorial-how-to-fetch-data-from-an-api-into-core-data-9326af750e10
But i need more idea about library for access API, can anyone help me?
Thank you.
you can Alamofire in ios.
Alamofire.request("https://httpbin.org/get").responseJSON { response in
print(response.request) // original URL request
print(response.response) // HTTP URL response
print(response.data) // server data
print(response.result) // result of response serialization
if let JSON = response.result.value {
print("JSON: \(JSON)")
}
}
Even though Alamofire might seem like a good choice for networking, the native URLSession along with the Codable protocol provide the same functionality without adding any dependencies to your project.
let task = URLSession.shared.dataTask(with: url) { data, response, error in
// Handle data, response, and error
}
task.resume()
In iOS, the only library that's ruling on networking is Aalmofire. It simplifies all your networking calls struggles. It provides simple methods to access data from the server. Alamofire is in swift. If you want to create a project in objective C, the same library available in Objective C as AFNetworking.
Below is the example of writing api calls:
let url = ""
let headers = [ "Content-Type" : "application/json"]
let para : Parameters = [ "data" : JSONObject]
Alamofire.request(url, method: .post, parameters: para, encoding: JSONEncoding.default, headers : headers)
.responseJSON { response in
print(response)
print(response.result)
}
Note: As you are a beginner I didn't tell about URLSessions(provided by Apple) which is the perfect way of writing API calls. But it's a very good choice in future.
URLSession built-in possibility
AFNetworking is an Objective-C networking library
Alamofire uses AFNetworking inside but it is written in Swift
SDWebImage image downloader with cache support
I'm trying to connect to:
https://www.amazon.com/ap/signin?openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.assoc_handle=amzn_mturk_worker&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&_encoding=UTF8&openid.mode=checkid_setup&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.pape.max_auth_age=43200&marketplaceId=A384XSLT9ODACQ&clientContext=703ea210dfe6fd07defd5ab30ac8d9&openid.return_to=https%3A%2F%2Fwww.mturk.com%2Fmturk%2Fendsignin
I'm developing on Android using Android Studio with the jsoup library. I'm unable to post data. I'm confused on what library I should be using to work with OpenID. I'm logging into this form and pulling data off the site after login. Here is my post info:
appActionToken:pj2FxGfwLZT6nheliE7BMxwZrTUKEj3D
appAction:SIGNIN
clientContext:ape:NzAzZWEyMTBkZmU2ZmQwN2RlZmQ1YWIzMGFjOGQ5
openid.pape.max_auth_age:ape:NDMyMDA=
openid.return_to:ape:aHR0cHM6Ly93d3cubXR1cmsuY29tL210dXJrL2VuZHNpZ25pbg==
prevRID:ape:S1kyUFNDUkhLVFZSSjRGMjBYUUo=
openid.identity:ape:aHR0cDovL3NwZWNzLm9wZW5pZC5uZXQvYXV0aC8yLjAvaWRlbnRpZmllcl9zZWxlY3Q=
openid.assoc_handle:ape:YW16bl9tdHVya193b3JrZXI=
openid.mode:ape:Y2hlY2tpZF9zZXR1cA==
openid.ns.pape:ape:aHR0cDovL3NwZWNzLm9wZW5pZC5uZXQvZXh0ZW5zaW9ucy9wYXBlLzEuMA==
openid.claimed_id:ape:aHR0cDovL3NwZWNzLm9wZW5pZC5uZXQvYXV0aC8yLjAvaWRlbnRpZmllcl9zZWxlY3Q=
pageId:ape:YW16bl9tdHVya193b3JrZXI=
openid.ns:ape:aHR0cDovL3NwZWNzLm9wZW5pZC5uZXQvYXV0aC8yLjA=
email: -Deleted-
create:0
password: -Deleted-
metadata1:+gLgZV5Fc5cBh44WnOrKTq5ofl6IhGvSbZGHfX7T5PuwmIl0Ep4bclt77iRlLPO1thRNg/9TylDw5H/9UPZnuOcF1OAHaECaWmK9H8pkW0elpz5QgEukM4aP6dPwSliw9Ggy+1/vQCk0MLm2TvkyS8uLslyh2aEw4H7hDmcF6lTgctZVE8B2KENH97L7hp4rcR2NHKMm4tEFdwpmVqv+pmLX5rUBo4p2QNUe3g0dNAifuK3RPXCVSQyQHpUzlBuFZTFK9xspwA2dgcdSZcgQzgzQKik/WEDrn0eP4sAVnO1ZGFUWKFAY55Lzgf6yd6WxCZ15yGTWENf0Km9wnXce+Ev5SMarXPJNQtfqY6tdp5snwFxpB8m/x72AvRgWJACoi5qcyqwO6dxroebIyB9uruApIkUk07AD8bJvhcf92+flN9TY4iXCkIoeSUN5aKp8rJbyhspySgsmQ9guu4964qeQRK0J092/sx1De6VmfGQ3nMrr0+McnC4/wZo2jUhGOr62ow==
Jsoup won't help here because it doesn't parse Javascript. The site you're targetting makes heavy use of Javascript.
Instead, I suggest you to use a tool like ui4j or Selenium.
I found many examples on Stack Overflow and I just don't know where to start since I have a particular prerequisite:
My Delphi Datasnap Rest server is using ZLibCompression and RSA encryption (in TTransportFilterCollection of DSHTTPWebDispatcher). Is there an Android restful API that can handle those? Any sample that already implements that?
I found this thread Android REST client, Sample? as a good starting point, both lightweight and well-formed clients are presented but is it enough for me?
Thanks in advance for any hint, sample or library that you could point me to.
you can use the Android Rest-Client for sending data to a webservice
see my answer in the post Adding body of call to POST using HttpURLConnection
I just used the proxy generator from Danasnap server TDSProxyGenerator component (http://yourserver:port/proxy/java_android.zip) and added this code to my android project...
I had to search for the DSRESTSSLFactory.java file that is not generated by the proxy (but required !!), i found it in a demo from embarcadero, and from that point the communication is entirely handled, all accessible procedures are publicated, and really really simple to use...
I like to raise some questions regrading Yii framework and Android applications. I am going to build a mobile application in Android platform and implementing Yii framework as server side. I like to know how much Yii framework supports Android platform? Are Yii framework web services fully compatible with Android?
And, if can anyone suggest some tutorial or useful information, that will be very useful to me...
Check out this: Yii REST API
You can use JSON / XML to communicate your android application with the php yii framework by building a simple REST API.
In order to do use the REST API this, you need to send HTTP request (Get / Post) from Android application. Then perform your operation based upon the request and send again in JSON formate using php json_encode or XML if you preferred.
You can also perform it using google Gson. it will help you to create JSON from java object.
Refer this: Simple API using Yii
I have done similar recently,
Yii side
you need custom controller sending json array and you can refer Yii REST API
public function actionTest()
{
$commands = Command::model()->findAll();
$cmdlist = array();
if( $commands != '0'){
foreach( $commands as $item )
{
$object = array();
$object ['cmd'] = $item->command;
$object ['command'] = $item->getCommandOptions($item->command);
$object ['number'] = $item->number;
$object ['id'] = $item->id;
$cmdlist[] = $object;
}
$arr['command'] = $cmdlist;
}
header('Content-type: application/json');
echo json_encode($arr);
Yii::app()->end();
}
android side
You need a neat Async Http client with Json parser. I used android-async-http
I have an Android application that is on the market that I am switching to using the Yii framework. I use the http://www.yiiframework.com/extension/restfullyii/ extension. So far it's been great. I had a couple of issues with security and other things but overall the tool is what you will need. All you really care about for yii is having a restful API the rest of the logic should really be handled in your Android application. Also as a response type at this point I would only use json. I tried to implement a Android XML framework and decided to pull back because json did everything I needed to and was easy.