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

#225 Remove exchange id from http submit urls #243

Closed
wants to merge 1 commit into from

Conversation

diehuxx
Copy link
Contributor

@diehuxx diehuxx commented Feb 21, 2024

Addresses #225

There is no reason to put the exchange id in the URL because the submitted message will always contain the exchange id

@diehuxx diehuxx changed the title Remove exchange id from http submit urls #225 Remove exchange id from http submit urls Feb 21, 2024
@@ -281,7 +281,7 @@ An exchange is a series of linked tbDEX messages between Alice and a PFI for a s
Submits an RFQ (Request For Quote). Alice is asking the PFI to provide a Quote so she can evaluate it.

### Endpoint
`POST /exchanges/:exchange_id`
`POST /exchanges`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this not POST /exchanges/rfq because an RFQ creates an exchange?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was POST /exchanges/rfq originally but we dropped the /rfq in this spec change where we modified the request body of that endpoint to take a callback url in the replyTo field.

I'm not strongly opinionated about keeping or dropping /rfq, but I don't want to flip-flop on it more than twice.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're making an assumption that RFQ is always the first message to kick off an exchange so that's why we dropped the /rfq bit in the previous spec change - however my eye does twitch a little seeing that this is the only endpoint that does not specify the message kind like POST /exchanges/... in the uri.

@@ -371,7 +371,7 @@ True
Submits the Order. Alice wants to accept the Quote and execute the transaction.

### Endpoint
`POST /exchanges/:exchange_id/order`
`POST /exchanges/order`
Copy link
Member

@mistermoe mistermoe Feb 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given that POST /exchanges creates a new exchange using an RFQ without the path pattern followed for subsequent endpoints like this one, would it make sense to use PUT instead of POST given that the exchange already exists?

something feels slightly awkward about the proposed path but maybe i'm the only one feeling that way in which case ignore.

Chad says

The choice between POST and PUT in HTTP is guided by idempotency and resource creation conventions.

POST is used for creating resources or when the operation does not need to be idempotent, meaning the same request can result in different outcomes. It's commonly used for actions like submitting form data.

PUT, on the other hand, is idempotent and used for updating resources where the outcome of multiple identical requests is the same, typically replacing a resource at a specific URL. This distinction helps ensure appropriate behavior and efficiency in web applications and API design.

based on ^ POST makes sense

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, POST seems correct for both POST /exchanges and POST /exchanges/order

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something feels slightly awkward about the proposed path but maybe i'm the only one feeling that way in which case ignore.

I'm def open to other ideas, or if this proposal just doesn't feel right, it's no biggie if we reject this one.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some thoughts here #225

Copy link
Contributor

@phoebe-lew phoebe-lew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, also discussed briefly with @mistermoe and @jiyoontbd that removing /rfq makes sense because of the inclusion of the replyTo field.

POST /exchange/kind for remaining message types also makes sense

@diehuxx
Copy link
Contributor Author

diehuxx commented Mar 12, 2024

Closing since we landed on a different proposal
#225 (comment)

@diehuxx diehuxx closed this Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants