You are using basic authentication to log in, but your app probably does 
not have basic authentication enabled. See 
http://web2py.com/books/default/chapter/29/09#Access-Control-and-Basic-Authentication
.

Anthony

On Wednesday, May 29, 2013 8:11:30 PM UTC-4, Nam Soo In wrote:
>
> I am trying to build exposed API that is called by another web service in 
> order to insert data.
>
> Here is DB structure.
> Table name: bad_domain
> attributes are :
> domain(string)
> modified_by(string)
> cereated_by(string)
> risk(Boolean)
>
> Here is my code in defauly.py
>
> auth.settings.allow_basic_login = True
>
> @auth.requires_login()
> @request.restful()
> def api():
>     def POST(table_name,**vars):
>         return db[table_name].validate_and_insert(**vars)
>     return locals()
>
>
> Here is my curl 
>
> curl --user [email protected]:1234 
> http://127.0.0.1:8000/test/default/api/bad_domain.json {"content": 
> [{"domain": “www.google.com”,”modified_by”:”test”, "created_by": "test", 
> "risk": True}]}
>
> curl dose not work.
>
> Any idea how to fix curl commend.
>
> I am pretty new to web2py
>
> Thank you.
>
>
>

-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to