iglu icon indicating copy to clipboard operation
iglu copied to clipboard

Move away delete and post requests for the keygen service from query param to path

Open BenFradet opened this issue 10 years ago • 6 comments

Relatedly to #60, I think it would be more RESTful to move away from requests like:

/api/apikeys/keygen?vendor_prefix=com.acme

To something like:

/api/apikeys/com.acme

Removing the keygen keyword since it doesn't really make sense anymore (given that we can retrieve/delete/create api keys) and moving away from the vendor_prefix query param in favour of a path based query.

In the same way, we could send GET and DELETE requests to:

/api/apikeys/some-uuid-to-delete-or-retrieve

What do you think @alexanderdean?

BenFradet avatar Sep 01 '14 10:09 BenFradet

I like it, agree

alexanderdean avatar Sep 01 '14 10:09 alexanderdean

Better yet would be to split uuid-based requests from vendor prefix-based requests:

  • On the one hand, you would have:
/api/apikeys/keys/some-uuid

For retrieving the vendor prefix associated with an uuid or deleting this specific key.

  • And on the other hand, there would be requests like this one:
/api/apikeys/vendorprefixes/some.vendor.prefix

To create a pair of api keys, deleting them or retrieving them.

Which is the best approach in your opinion?

BenFradet avatar Sep 01 '14 12:09 BenFradet

What's the relationship in the db between vendor prefixes and keys. Many to one or what?

alexanderdean avatar Sep 01 '14 12:09 alexanderdean

A vendor prefix can have at most two (read and write) api keys and obviously an api key can only have one vendor prefix

BenFradet avatar Sep 01 '14 12:09 BenFradet

Then yes I like the latter approach

alexanderdean avatar Sep 01 '14 12:09 alexanderdean

Ok thanks for your input.

BenFradet avatar Sep 01 '14 12:09 BenFradet