GO RESTFUL — #8
Requirements and Specification
Go RESTful Series — Iteration #1
In this article, I’m listing all the requirements of the 1st Iteration of our Go RESTful project. This will allow us to know what to do, what to achieve, and then design and implement properly. I’m drafting an API specification for this iteration too.
It’s going to be like a “mini” planning session, where I receive business requirements from the business owner (in this case is myself), make analysis, and write technical specification. The set of business requirements is effectively small so that it can be considered unchanged and achievable in a reasonable amount of time (2 to 4 weeks).
Requirements
Entities
User
username
:
- Is unique.
- Allows only digits, underscores, dashes, dots and alphabetical letters.
- Begins with an underscore or an alphabetical letter.
- Is at least 1-character in length and at most 32-characters in length.email
:
- Is a valid email.
- Is unique.fullName
:
- Is at least 1-character in length and at most 128-characters in length.bio
:
- Is optional.
- Is at most 256-character length.
Use cases
- List all users.
- Retrieve a user’s information by his username.
- Update a user. Every field is allowed to be changed.
- Delete a user.
Specification
Models
User {
"username": "string",
"email": "string",
"fullName": "string",
"bio": "string" | null
}Error {
"message": "string"
}
APIs
- List users:
GET /users/
# Response: User[]
- Get user:
GET /users/@username
# Response: User
- Create user:
POST /users/
# Body: User
# Response: User
- Update user:
PUT /users/@username
# Body: User
# Response: User
- Delete user:
DELETE /users/@username
# Response: Empty or Error
That’s it! See you in the next article about architectural design.