API Test with HTTP(s)
API HTTP tests allow you to send HTTP request(s) to your service or application to verify the response or specified conditions such as "status code, header or body content" that you set when creating the API test
To perform API Test creation with HTTP(s) method, follow the instructions below:
Log in to vMonitor Platform here.
Select the Synthetic test folder .
Select API test.
Select Create an API test.
Enter information including:
Test Information: define basic information, select HTTP method and specify URL to test
Test name: name of the API test
Test type : test protocol, you choose HTTP(s)
Verify ssl: choose whether to check ssl or not (True or False)
Method: select the method that will test your endpoint (Get, Post, Put, Delete)
URL : fill in the service information you want to check, for example https://google.com
After filling in the Test Information, you can choose Run Test or Test Again if you have previously tested, you can see returned information such as status code, header and body.
![](https://docs.vngcloud.vn/~gitbook/image?url=https%3A%2F%2F1985221522-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F7rE7M1L7GYcwQzNGd0aB%252Fuploads%252F5r3K9KtCx6XDL8tLjZbd%252Fimage.png%3Falt%3Dmedia%26token%3D7f420ae8-35fe-4c4c-b6d6-9de730048f53&width=768&dpr=4&quality=100&sign=3cb4edea&sv=1)
Test Assertion
Assertion defines what you expect the API Test result to be, if the returned result meets what you define API Test will show the URL you are testing as successful, and vice versa API Test will show the URL you are testing test is failed. The system will automatically add the Assertion status code for you after you Run the test, you need to define at least one Assertion for the API test. In addition to the Assertion status code that the system automatically adds, you can add any other Assertion that we support as below: Response time, Header, Body, Certificate
![](https://docs.vngcloud.vn/~gitbook/image?url=https%3A%2F%2F1985221522-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F7rE7M1L7GYcwQzNGd0aB%252Fuploads%252FKzCGJFRvh1qdVfj2ZFez%252Fimage.png%3Falt%3Dmedia%26token%3D9399bb73-d501-409f-80f6-01295a07e886&width=768&dpr=4&quality=100&sign=c31b010b&sv=1)
Location
Select the Location that will run HTTP Tests to your URL. HTTP tests can be run from both Public Locations (managed by VNG Cloud) and Private Locations (installed and managed by customers) based on your needs for running tests from outside (internet) or inside the network. your. Public Locations managed by VNG Cloud currently has 2 locations: HCM and Hanoi.
Alarm conditions: Set up alarm conditions to define the cases where you want the test to fail and trigger the alarm.
Interval : how often API Test will test once, default will be 1p
Time of failure : how many consecutive failures will alert
Locations with failure : how many locations fail to warn
For example, when you select Time of failure: 1 and Locations with failure: 2, it will be understood as: you will be warned if the Test fails 1 time in a row from 2 out of 2 locations.
Notifications : you choose notification channels when switching to In-alarm, Up or Undertermine states, the system will notify according to this list.
![](https://docs.vngcloud.vn/~gitbook/image?url=https%3A%2F%2F1985221522-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F7rE7M1L7GYcwQzNGd0aB%252Fuploads%252Fvm7yIW65iZmUxJpKz50q%252Fimage.png%3Falt%3Dmedia%26token%3Dc1f03acd-ffa5-40d2-8c9e-3dda444ca04d&width=768&dpr=4&quality=100&sign=ef122e4e&sv=1)
6. Then press the " Create " button to initialize the API test. After creating, you will see the API test is in Undertermine state, until the next inteval the Test API will be updated to the correct state.
![](https://docs.vngcloud.vn/~gitbook/image?url=https%3A%2F%2F1985221522-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F7rE7M1L7GYcwQzNGd0aB%252Fuploads%252FSrM0NsS11ljODVmLTnqi%252Fimage.png%3Falt%3Dmedia%26token%3D8379bdad-4b5a-404d-a117-aacdc9585ba3&width=768&dpr=4&quality=100&sign=c4903171&sv=1)
API Test has entered the Up state when the URL is working properly
![](https://docs.vngcloud.vn/~gitbook/image?url=https%3A%2F%2F1985221522-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F7rE7M1L7GYcwQzNGd0aB%252Fuploads%252FEbusruGdHr3JyOJ82Ckr%252Fimage.png%3Falt%3Dmedia%26token%3Db87a1fe1-a556-4872-a681-825d5764f6b9&width=768&dpr=4&quality=100&sign=c2272603&sv=1)
You can see details about API Test:
![](https://docs.vngcloud.vn/~gitbook/image?url=https%3A%2F%2F1985221522-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F7rE7M1L7GYcwQzNGd0aB%252Fuploads%252FlbS6cD6xtgRIxSba8rKx%252Fimage.png%3Falt%3Dmedia%26token%3Ddda1bfe7-82ee-4837-b17b-5d2b845a28bc&width=768&dpr=4&quality=100&sign=84615fcf&sv=1)
Last updated