{"id":30628,"date":"2023-10-22T08:13:50","date_gmt":"2023-10-22T16:13:50","guid":{"rendered":"https:\/\/alexrusin.com\/?p=30628"},"modified":"2024-07-14T10:22:50","modified_gmt":"2024-07-14T18:22:50","slug":"rest-api-request-validation","status":"publish","type":"post","link":"https:\/\/blog.alexrusin.com\/rest-api-request-validation\/","title":{"rendered":"REST API Request Validation"},"content":{"rendered":"\n

In this article we will look at how to validate POST requests to the REST API using Joi library<\/a>. Joi lets you describe your data using a simple, intuitive, and readable language. We will also look at how to turn Joi errors into 422 Validation Error API responses.<\/p>\n\n\n\n

Describe REST API Request Shema with Joi<\/h2>\n\n\n\n

We will be validating POST \/v1\/travels<\/code> REST API request in travels API project. You can find the project in this GitHub repository<\/a>. For more in depth explanation, please watch the video below.<\/p>\n\n\n\n

\n