Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yeah good question.

I think GET would be a reasonable default here, perhaps 123 is a query string parameter.

For update / POST, create / PUT etc. it's less clear cut in my example language of Python since all we have is a callable, we don't have constructs such as "new" to map behaviours to (repurposing "del" isn't possible).

Perhaps there's an extra parameter:

    client.account(id=123, name="something", _method=PUT)
Maybe there's a postfix operation:

    client.account(id=123, name="something").PUT()
Maybe the verbs are seperate:

    from rest import client, PUT
    PUT(client.account(id=123, name="something"))
I think the postfix system probably makes most sense. I'm sure there's other ways i could come up with.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: