android - How can I create a simple api to test my mobile app without having to code the api out on a server? -


i making android , ios app going interact server using api returns appropriate json responses. else on team doing server side work. don't want bother/wait finish server implementation.

is there website out there me create test api whenever call it, return predefined json response?

example: if website called api.com , if create account , call get api.com/my_account/get_key returns {"key": "fgjllpoiunvxaqw"}. hardcode response on website of course.

thanks :)

if just reading data server (e.g. making /get requests) can put .json files on server , read them app.

for example, get_key, call get yourwebsite.com/get_key.json , parse data. way can simulate how app works network delays, useful start adding loaders , error handling ui.

if need post, have php script write file on server, check later it's being posted:

<?php    file_put_contents('testpostuserdata.txt', file_get_contents('php://input')); ?> 

if require more dynamic interaction (get , post data, retrieve data specific user) can use of services available free backendless, kinvey, stackmob, or parse.

finally, have preprocessor #define alternate between fake api , real api

#ifdef fake_api static nsstring * path requestbaseurl = @"http://yourwebsite.com"; #else static nsstring * const requestbaseurl = @"http://realwebserver.com"; #endif 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

keyboard - C++ GetAsyncKeyState alternative -

android - java.net.UnknownHostException(Unable to resolve host “URL”: No address associated with hostname) -