Skip to main content

Version: 2.13.2304

Developing APIs

This guide will instruct you on how to develop high-performance and healthy APIs based on the completed API design document.

Prerequisites

Designing APIs.

Development Process

  1. Scheduling: Scheduling is a key aspect of the API development process. People in your team need to complete and report their work based on the scheduled timeline to ensure timely project delivery.
  2. Development and Self-Testing: The development phase typically involves coding and debugging, while the self-testing phase involves developers testing and validating their own developed APIs to ensure their functionality meets expectations.
  3. Integration Testing: Integration testing is a stage where APIs between different modules are debugged and tested to ensure their interactions and communications are correct and stable.
  4. QA Testing: Also known as quality assurance testing, aims to identify and eliminate defects or vulnerabilities in the API before it is released to end-users.
  5. Product Acceptance: API undergoes comprehensive testing, evaluation, and confirmation to determine if it meets the expected goals and standards.
  6. Deployment: Deploying the API to the production environment, allowing users or clients to access and utilize it.

At this point, we have completed the API development work.

Mocking APIs

We will use Postman's Mock Server and Example to simulate the behavior of the three APIs. Later, we will publish the simulated APIs to the gateway. In a real-world scenario, you would replace them with actual developed APIs.

Create Collection

Log in to Postman and navigate to the shop API created in Designing APIs.

Select Add Collection from definition:

Postman Create Collection

Select Copy to collections:

Postman Copy to collections

Create Mock Server

Create a Mock Server for the shop collection:

Create Mock Server

Create Mock Server 2

After successful creation, click Copy URL button to copy the Mock Server URL. Then navigate to the shop collection Variables, set the value of baseUrl to the Mock Server URL and Save:

Postman Baseurl

Add Examples

In the shop collection, add examples for the three requests and save.

GetProductById

In Path Variables, set the Value for id to 1, then set the response:


{
"id": 1,
"name": "iPhone 13 Pro",
"price": 999.99,
"updated_at": "2023-04-17T05:49:54.029Z",
"created_at": "2023-04-17T05:49:54.029Z"
}

Click Save

Get Product By Id - Example

CreateProduct

Set request body:


{
"name": "iPhone 13 Pro",
"price": 999.99
}

Set response:


{
"id": 1
}

Click Save.

CreateOrder

Set request body:


{
"customer_id":"user_ascx8e21nsd",
"product_id": 1,
"quantity": 1
}

Set response:


{
"order_id": 123
}

Click Save.


API7.ai Logo

API Management for Modern Architectures with Edge, API Gateway, Kubernetes, and Service Mesh.

Product

API7 Cloud

SOC2 Type IIISO 27001HIPAAGDPRRed Herring

Copyright © APISEVEN Ltd. 2019 – 2024. Apache, Apache APISIX, APISIX, and associated open source project names are trademarks of the

Apache Software Foundation