call python cloud endpoint api from android app -
i have created api in cloud endpoint , deployed in app engine. in python. have generated library , have imported in project.its in import
import com.appspot.corner_fresh.fresh_api.freshapi;
how can access methods in api. have methods fresh_api.user.insert
, fresh_api.user.detail
. not detailed documentation of python endpoint.
i tried
final httptransport transport = androidhttp.newcompatibletransport(); jsonfactory jsonfactory = new jacksonfactory(); freshapi.builder builder = new freshapi.builder( transport, jsonfactory, null ); builder.setapplicationname( appname ); freshapi service = builder.build(); try { json response = service.fresh_api.users.list( ).execute(); toast.maketext(getapplicationcontext(), response.tostring(), toast.length_short).show(); } catch (ioexception e) { toast.maketext(getapplicationcontext(), "sexyfghfd", toast.length_short).show(); }
but, first couldn't understand it. then, pass appname in builder.setapplicationname( appname );
also, not recognising methodname in
response = service.fresh_api.users.list( ).execute();
how execute api , response. thanks
for second question, try use:
service.fresh_api().users.list( ).execute();
because fresh_api not attribute, method. if use android studio, can press ctrl + space , see list of available method , operations.
for first question, may refer appengine backend application id. don't have set that. important client key android, , endpoint root url.
Comments
Post a Comment