Pasting the output from web2py console, clearing it is getting the appid as
parameter correctly.
<<snip>>
application.id,application.appname
1,Test

1
application.id,application.appname

1
application.id,application.appname

1
<<snip>>

On Fri, Mar 27, 2015 at 10:04 PM, Saifuddin Rangwala <
saifuddin.rangw...@gmail.com> wrote:

>
> I have following code in my controller that exposes a restful json api. I
> am trying to lookup the application by id which is passed as a parameter to
> this api.
>
> Now if I hit this api using curl twice, both the times I see the expected
> behavior (i.e. application row is fetched from db and a row gets inserted
> in message table).
>
> However, if I hit the same api with same parameter twice using java
> HttpUrlConnection, then first the behavior is as expected, but for
> subsequent requests, it is not able to find any row in application table.
>
> I have run out of ways to debug this issue further. Please suggest if I am
> missing something.
>
>
> <<snip>>
> @request.restful()
> def api():
>     def POST(*args,**vars):
>         if args[0]=='message':
>             application=db(db.application.id==vars['appid']).select()
>             print application
>             print vars['appid']
>             if len(application):
>                 vars['request_tenant'] = application[0]['created_by']
>                 message=db.message.validate_and_insert(**vars)
>                 return dict(message=message)
> <<snip>>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Saifuddin,
---------------------------------------------
Reach me @ +91 9850815274
---------------------------------------------

"The secret to find something is knowing where it is"

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to