メインコンテンツまでスキップ

Your First Endpoint

As the first step of our guide, we walk you through how Viron works and handle an OAS document by setting up a simple mock RESTful API server.

注記

It is up to you how the actual RESTful API server is set up as long as the server meets Viron's requirements.

Preparation

As we use Postman's Mock Server function for our guide, you need to create your Postman account before reading on. Here are some links that would help you understand what Postman is:

Creating a Mock Server

Create a mock server from scratch on your account's Postman's workspace page with the initial data below.

value
Request MethodGET
Request URL/oas
Response Code200
Response Bodyblank

Click the Next button at the bottom of the page to proceed to the next setting, Configuration. Input RESTful Administration API Server for Viron in the Mock server name field, leave other fields as they are, and click the Create Mock Server button to confirm.

You will use the URL of the newly created mock server, so click the Copy Mock URL button to copy it.

Endpoint to Return an OAS Document

Click the Collections menu on the left of the page, and you will find an example response under the GET /oas request. Edit the example response body by filling it with the data below, and click the Save button on the top of the page.

Content Type: JSON

Body:

{
"openapi": "3.0.2",
"info":{
"title": "RESTful Administration API Server for Viron",
"version": "mock",
"x-pages": []
},
"paths": {}
}

Response Headers:

keyvalue
access-control-allow-originhttps://viron.plus
access-control-allow-credentialstrue
x-viron-authtypes-path/authentication
access-control-expose-headersx-viron-authtypes-path

The access-control-allow-origin and access-control-allow-credentials are required response headers for Viron and your endpoint to authenticate requests from Viron users.

The x-viron-authtypes-path response header tells Viron users how to get authenticated.

Creating a Request for Authentication

Add a new request with the data below and click the Save button. This request provides Viron users with a way to authenticate.

value
Name/authentication
MethodGET
URL{{url}}/authentication

Then, add an example response under the request with the data below, and click the Save button.

Name: Default

Content Type: JSON

Body:

{
"list": [],
"oas": {
"openapi": "3.0.2",
"info": {
"title": "authentication",
"version": "mock",
"x-pages": []
},
"paths": {}
}
}

Response Headers:

keyvalue
access-control-allow-originhttps://viron.plus
access-control-allow-credentialstrue
x-viron-authtypes-path/authentication
access-control-expose-headersx-viron-authtypes-path
注記

Since the endpoint we are creating is public, we leave the list value an empty array.

Adding the Endpoint on the Viron Dashboard

Visit the Viron dashboard and add the endpoint you have created.

field namevalue
IDmock
URLhttps://xxxxxxxxx.mock.pstmn.io/oas
Groupblank
注記

The base URL for your endpoint is one that you have copied after creating your mock server.

Go on the next step after confirming that your endpoint is on the Viron dashboard.