Hi Niphlod,
It's a super simple controller below:
def call():
"""
exposes services. for example:
http://..../[app]/default/call/jsonrpc
decorate with @services.jsonrpc the functions to expose
supports xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv
"""
return service()
@service.jsonrpc
def save_message(message, uid):
db.messages.insert(message=message, uid=uid)
db.commit()
message = {"status":"saved"}
return message
On Wednesday, 7 November 2012 14:38:35 UTC-5, Niphlod wrote:
>
> table is there, curl is there, but how about something you coded in the
> controller ? Without that we can't help you .
>
> On Wednesday, November 7, 2012 7:48:28 PM UTC+1, Mike Anson wrote:
>>
>>
>> Greetings...
>>
>> I have a bash script that uses cURL to send a json packet of data in
>> order to save it in sqlite DB.
>>
>> #!/bin/bash
>> message=$1
>> uid=$2
>> url="https://somehost"
>> curl -v -k -X POST -H "Content-Type: application/json" --data
>> "{\"message\": \"This will prbbly be my lst post.\", \"uid\": \"
>> [email protected]\"}" $url
>>
>> ** message and uid are hardcoded at this point but will take the values
>> dynamically once I see it working.
>>
>> Here is my table defined:
>>
>> db.define_table('messages',
>> Field
>> <https://apps00.cs.lldns.net:8000/examples/global/vars/Field>('uid',
>> 'string'),
>> Field
>> <https://apps00.cs.lldns.net:8000/examples/global/vars/Field>('message',
>> 'text'),
>> Field
>> <https://apps00.cs.lldns.net:8000/examples/global/vars/Field>('status',
>> 'string', default='unsent'),
>> Field
>> <https://apps00.cs.lldns.net:8000/examples/global/vars/Field>('added',
>> 'datetime', default=request
>> <https://apps00.cs.lldns.net:8000/examples/global/vars/request>.now),
>> Field
>> <https://apps00.cs.lldns.net:8000/examples/global/vars/Field>('modified',
>> 'datetime', default=request
>> <https://apps00.cs.lldns.net:8000/examples/global/vars/request>.now))
>>
>> *I've tried many variations of the cURL command and ran in to various
>> errors. The above cURL command gives the error: *<type
>> 'exceptions.KeyError'> 'id'
>>
>> Any help would be greatly appreciated.
>>
>>
--