While learning how to use Swift and Vapor to create a REST api, while testing this API using postman, I am unable to make an API Post request, the error I receive is:
{
"error": true,
"reason": "Value of type 'String' required for key 'email'."
}
I am using a PostgreSQL database reference the model. I feel something is wrong with my model.
Here is the model I am using:
final class Todo: PostgreSQLModel {
var id: Int?
var email: String
var password: String
var name_first: String
var name_last: String
var username: String
init(id: Int?, email: String, name_first: String, name_last: String, username:String, password: String) {
self.id = id
self.email = email
self.name_first = name_first
self.name_last = name_last
self.username = username
self.password = password
}
}
It turns out I was using postman wrong. I was passing things through the header the body my mistake.