From the course: Accelerating Laravel API Development with AI: From Specification to Testing
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Understanding API specifications - Laravel Tutorial
From the course: Accelerating Laravel API Development with AI: From Specification to Testing
Understanding API specifications
- [Instructor] Before you write a single line of code, it's important to understand the API you're building. That starts with the API specification, a blueprint for how your API should behave. There are a ton of ways to capture the spec. I like to start simply: I'll create an API markdown file. For the purpose of this course, I'm going to use a simple idea of a shared task manager that will have things like projects, tasks, users. So one endpoint I would need for a task manager is projects. I'll add a description and a response, and an example of the body. It stands to reason that I might also need more info on a specific project. So, "projects/{id}", "Description: Get project details," "Response: 200 OK," "Body." And a project will also have tasks and a task should also have a status. This is a course about AI. So I'm going to feed my requirements to GitHub Copilot. Note that Copilot has the open file API Markdown as context. "This file is the api endpoints for a simple project…