Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP API need change to Restful style? #1

Open
lrita opened this issue Apr 25, 2016 · 3 comments
Open

HTTP API need change to Restful style? #1

lrita opened this issue Apr 25, 2016 · 3 comments

Comments

@lrita
Copy link
Collaborator

lrita commented Apr 25, 2016

HTTP API need change to Restful style?
If do this, maybe graceful.

@icycrystal4
Copy link
Member

Restful style api sounds nice at first glance, in fact it is hard to tell that restful api is better. Anyway, the most important factor to impact what kind of style we use is easy to use, simple to understand.
Our future http api is going to be like:

    curl -X GET "https://$ip:$port/$queue"  // get a message
    curl -X POST -d "msg=hello world!" "https://$ip:$port/$queue" // post a message 

where $ip, $port $queue should replace with actual values.

@lrita
Copy link
Collaborator Author

lrita commented May 9, 2016

Maybe like this?

Create queue:
PUT /queues/$queueName HTTP/1.1
{
    "partitions":16,
    "replications":2
}

Delete queue:
DELETE /queues/$queueName HTTP/1.1

Update queue:
PUT /queues/$queueName?override=true HTTP/1.1
{
    "partitions":16,
    "replications":2
}

List queue:
GET /queues HTTP/1.1
GET /queues?queue=$queueName HTTP/1.1

Add group:
PUT /queues/$queueName/$groupName HTTP/1.1
{
    "read":true,
    "write":true,
    "url":"xxx",
    "ack": false,
    "ips":"xxx,xxx"
}

Delete group:
DELETE /queues/$queueName/$groupName HTTP/1.1

Update group:
PUT /queues/$queueName/$groupName?override=true HTTP/1.1
{
    "read":true,
    "write":true,
    "url":"xxx",
    "ips":"xxx,xxx"
}

List group:
GET /queues?group=$groupName HTTP/1.1


Send message:
POST /msg/$queueName/$groupName HTTP/1.1
{
    "type":"message|ack",
    "ack":"[message ID]",
    "message":"[base64encode data]"
}

Receive message:
GET /msg/$queueName/$groupName HTTP/1.1
GET /msg/$queueName/$groupName?waitseconds=10 HTTP/1.1
{
    "ID":"[message ID]",
    "message:":"[base64encode data]"
}

Monitor:
GET /monitor HTTP/1.1
GET /monitor/$queueName HTTP/1.1
GET /monitor/$queueName/$groupName HTTP/1.1

@icycrystal4
Copy link
Member

the terms of "queue" and "group" make sense within pub/sub context. actually, in most cases, the consumer cannot tell and will be confused by the differences of "queue" and "group". So, it seems easy to understand, reduct the two term to only one: "queue".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants