This document describes how to utilize the Mock API App provided as a sample as a Mock Server.
Index
What is Mock Server, Mock API?
•
Mock Server is a Simulated Server that can send and receive API responses like a real server, and the API used here is Mock API.
•
When developing Mock Server without a server or client, it can quickly and easily build prototypes by arbitrarily defining an API to communicate between the two.
Using SyncTree Sample Mock API
1) Configuring Simulation JSON Data for Mock API
•
The simulated JSON data, which consists of the following structures, is registered as a value of the variable userList in the 'user list section' of the MockAPI Sample App.
{
"users": [
{
"id": 1,
"name": "Lee",
"role": "developer"
},
{
"id": 2,
"name": "Kim",
"role": "designer"
},
{
"id": 3,
"name": "Park",
"role": "engineer"
}
]
}
JSON
복사
•
It is possible to add or change the contents of JSON Data. However, please note that if you change the key or change the JSON format, the Mock API may not work normally.
{
"users": [
{
"id": 1,
"name": "Lee",
"role": "developer"
},
{
"id": 2,
"name": "Kim",
"role": "designer"
},
{
"id": 3,
"name": "Park",
"role": "engineer"
},
{
"id": 4,
"name": "Kang",
"role": "programmer"
}
]
}
JSON
복사
CASE 1) Add JSON Value
{
"users": [
{
"id": 1,
"name": "Peter",
"role": "painter"
},
{
"id": 2,
"name": "Joseph",
"role": "singer"
},
{
"id": 3,
"name": "Paul",
"role": "dancer"
}
]
}
JSON
복사
CASE 2) Change JSON Value
•
Replace the JSON Data Block as follows.
No. | Description |
1 | Click Make Block and add the changed JSON Data to create a new block. |
2 | Remove existing blocks and connects created blocks. |
Save / Build / Push
•
You must save and build after working on the block to test the block.
•
To use Mock API through end-point, you must push to Production and then release it as API Portal.
Mock API introduction
1) get user list
•
API Document
•
Test Case
2) get user detail
•
API Document
•
Test Case
3) create new user
•
API Document
•
Test Case
4) edit user detail
•
API Document
•
Test Case
5) delete user
•
API Document
•
Test Case