-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add API endpoints for /project_metadata #702
Conversation
User can GET or delete a release via /{projectId}/{version} or add/edit a release by POSTing the whole release to /{projectId}. Authentication is via HTTP Basic with a Github API token (as the username and an empty password, just like Github native APIs). All the new endpoints are protected.
I would prefer PUT over POST if we're talking about am including the ID in the URL. POST is usually used for the collective resource, and you usually get back a location header. Not the case with PUT. |
@@ -33,4 +40,87 @@ public Project projectMetadata(@PathVariable("projectId") String projectId) thro | |||
return service.getProject(projectId); | |||
} | |||
|
|||
@RequestMapping(value = "/{projectId}/**", method = GET) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tiny snit, but I kind of prefer it when it reads...
@RequestMapping(method = GET, value = "/{projectId}/**")
That way, it reads like a REST call, GET /whatever.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just the way the existing endpoint was defined. I didn't want to change a convention (I would prefer @GetMapping
anyway).
throw new MetadataNotFoundException("Could not find " + version + " for " + projectId); | ||
} | ||
|
||
@RequestMapping(value = "/{projectId}", method = POST) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See previous comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, since this is coming with the ID, I think PUT is preferred.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're reading it wrong. It's appending or updating a release to an existing project. I think POST is better.
User can GET or delete a release via /{projectId}/{version} or
add/edit a release by POSTing the whole release to /{projectId}.
Authentication is via HTTP Basic with a Github API token (as the
username and an empty password, just like Github native APIs).
All the new endpoints are protected.
Fixes gh-701