On Saturday, January 7, 2017 at 9:45:15 PM UTC, 黄祥 wrote:
>
> pls try :
> ### Change user with email if username is disabled
> ### Check patterns in
> http://127.0.0.1:8000/application/controller/api/patterns.json
>
> ## curl
> # GET
> curl -X GET --user user:password -i
> http://127.0.0.1:8000
pls try :
### Change user with email if username is disabled
### Check patterns in
http://127.0.0.1:8000/application/controller/api/patterns.json
## curl
# GET
curl -X GET --user user:password -i
http://127.0.0.1:8000/application/controller/api/books.json
# POST
curl -X POST --user user:password
On Saturday, January 7, 2017 at 2:42:31 PM UTC, PK wrote:
>
>
>
> On Thursday, January 5, 2017 at 3:08:46 PM UTC, Leonel Câmara wrote:
>>
>> PK you need to tell the server you're posting JSON in content-type for
>> instance using $.ajax
>>
>> var somedict = {a: 1, b: 2};
>>
>>
>> $.ajax({
>>
>>
On Thursday, January 5, 2017 at 3:08:46 PM UTC, Leonel Câmara wrote:
>
> PK you need to tell the server you're posting JSON in content-type for
> instance using $.ajax
>
> var somedict = {a: 1, b: 2};
>
>
> $.ajax({
>
> type: "POST",
> url: "{{=URL()}}",
> dataType: "json", /* if
PK you need to tell the server you're posting JSON in content-type for
instance using $.ajax
var somedict = {a: 1, b: 2};
$.ajax({
type: "POST",
url: "{{=URL()}}",
dataType: "json", /* if the server is also replying with json*/
contentType: "application/json; charset=UTF-8"
On Wednesday, January 4, 2017 at 10:04:31 PM UTC, Anthony wrote:
>
> On Wednesday, January 4, 2017 at 4:42:28 PM UTC-5, 黄祥 wrote:
>>
>> with
>> return response.json(list_of_records)
>>
>> it return a json format even we request it with *.xml
>> curl http://127.0.0.1:8000/a/default/api/test.xml
>>
On Wednesday, January 4, 2017 at 4:42:28 PM UTC-5, 黄祥 wrote:
>
> with
> return response.json(list_of_records)
>
> it return a json format even we request it with *.xml
> curl http://127.0.0.1:8000/a/default/api/test.xml
> is there a way to have it both json or xml without content variable?
>
You n
with
return response.json(list_of_records)
it return a json format even we request it with *.xml
curl http://127.0.0.1:8000/a/default/api/test.xml
is there a way to have it both json or xml without content variable?
best regards,
stifan
--
Resources:
- http://web2py.com
- http://web2py.com/book
On Wednesday, January 4, 2017 at 4:21:35 PM UTC, Anthony wrote:
>
> Presumably you are relying on the generic.json view. Note, the only way
> for a view to be triggered is for the controller to return a dictionary,
> but of course that means the generic.json view will be converting a
> diction
Presumably you are relying on the generic.json view. Note, the only way for
a view to be triggered is for the controller to return a dictionary, but of
course that means the generic.json view will be converting a dictionary to
JSON -- there is no way to have it receive and convert a list to JSON
tryin to help but no clue, hehe
*python console work as expected*
>>> d = {"content": [{"a": "1", "b": "2", "c": "3"}]}
>>> l = d.values()
>>> l[0]
[{'a': '1', 'c': '3', 'b': '2'}]
*controllers/default.py*
@request.restful()
def api():
response.view = 'generic.' + request.extension
def GET(*args,
11 matches
Mail list logo