From 416984d08381b910e7de96f237a4fefae862f181 Mon Sep 17 00:00:00 2001 From: hunterlong Date: Mon, 18 May 2020 13:50:09 -0700 Subject: [PATCH] postman API tests for different databases --- .github/workflows/dev.yml | 7 +- .github/workflows/master.yml | 28 +- dev/postman.json | 1456 ++++++++++++++++++++++++++++++--- dev/postman_env_mysql.json | 49 ++ dev/postman_env_postgres.json | 49 ++ dev/postman_env_sqlite.json | 49 ++ dev/postman_environment.json | 21 - 7 files changed, 1511 insertions(+), 148 deletions(-) create mode 100644 dev/postman_env_mysql.json create mode 100644 dev/postman_env_postgres.json create mode 100644 dev/postman_env_sqlite.json delete mode 100644 dev/postman_environment.json diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 519d640a..d4607ff5 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -160,8 +160,7 @@ jobs: - name: Postman Tests uses: matt-ball/newman-action@master with: - postmanApiKey: ${{ secrets.POSTMAN_API }} - collection: 1898229-94807b85-ef65-4370-9144-b1a74e04cb0e - environment: ./dev/postman_environment.json + collection: ./dev/postman.json + environment: ./dev/postman_environment_sqlite.json timeoutRequest: 15000 - delayRequest: 1000 + delayRequest: 500 diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 9d0c9812..6af1b976 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -183,11 +183,7 @@ jobs: with: postmanApiKey: ${{ secrets.POSTMAN_API }} collection: 1898229-3c6a7841-0b39-4878-a3a6-1c76832b7679 - globals: - - values: - endpoint: http://127.0.0.1:8080 - api_key: demosecret123 - db_connection: sqlite + environment: ./dev/postman_env_sqlite.json timeoutRequest: 15000 delayRequest: 500 @@ -242,16 +238,7 @@ jobs: with: postmanApiKey: ${{ secrets.POSTMAN_API }} collection: 1898229-3c6a7841-0b39-4878-a3a6-1c76832b7679 - globals: - - values: - endpoint: http://127.0.0.1:8080 - api_key: demosecret123 - db_connection: mysql - db_host: localhost - db_user: root - db_password: password123 - db_database: statping - db_port: 3306 + environment: ./dev/postman_env_mysql.json timeoutRequest: 15000 delayRequest: 500 @@ -307,16 +294,7 @@ jobs: with: postmanApiKey: ${{ secrets.POSTMAN_API }} collection: 1898229-3c6a7841-0b39-4878-a3a6-1c76832b7679 - globals: - - values: - endpoint: http://127.0.0.1:8080 - api_key: demosecret123 - db_connection: postgres - db_host: localhost - db_user: root - db_password: password123 - db_database: statping - db_port: 5432 + environment: ./dev/postman_env_postgres.json timeoutRequest: 15000 delayRequest: 500 diff --git a/dev/postman.json b/dev/postman.json index 1aa1cb71..453c9b8d 100644 --- a/dev/postman.json +++ b/dev/postman.json @@ -1,8 +1,8 @@ { "info": { - "_postman_id": "94807b85-ef65-4370-9144-b1a74e04cb0e", + "_postman_id": "3c6a7841-0b39-4878-a3a6-1c76832b7679", "name": "Statping", - "description": "The Statping API allows you to programmatically access data on your Statping server.\n\nThe easiest way to get started with the API is by running your own Docker or local instance of the Statping server.\n\n\n\n# Authentication\n\nAn API Key is required to be sent as part of every request to the Statping API, by using the `Authorization` and the API Secret Key as a header.\n\n> If you do not have an API Secret Key, you can find it on the Settings page.\n\nYou can Authenticate by implementing the following...\n- Using the `Authorization` header with API Secret Key\n- Setting `GO_ENV` to `test` to bypass all authentication\n- Adding `?api=` URL Query along with the API Secret Key\n- Being logged into Statping as an admin (using JWT sessions/cookies)\n\n# Environment Variables\nStatping includes many environment variables that can give you more control over your instance. Please view the [Environment Variables Wiki](https://github.com/statping/statping/wiki/Environment-Variables) page to view a complete list. Below are a couple important ones...\n- `STATPING_DIR` - Statping's working directory. By default, this will be set to the current working directory. This path will contain the `config.yml` file, `logs`, and `assets` folder. \n- `SASS` - Absolute path to the `sass` executable. By default it will attempt to find `sass` in your `$PATH`. \n\n# Demo\nYou can checkout the Statping Demo instance at [https://demo.statping.com](https://demo.statping.com). All features are available for you to experiment with. The API Secret Key is `demoapisecret123`. Since this instance is public, it will be reset with sample data **every 90 minutes**.\n", + "description": "The Statping API allows you to programmatically access data on your Statping server.\n\nThe easiest way to get started with the API is by running your own Docker or local instance of the Statping server.\n\n\n\n# Authentication\n\nAn API Key is required to be sent as part of every request to the Statping API, by using the `Authorization` and the API Secret Key as a header.\n\n> If you do not have an API Secret Key, you can find it on the Settings page.\n\nYou can Authenticate by implementing the following...\n- Using the `Authorization` header with API Secret Key\n- Setting `GO_ENV` to `test` to bypass all authentication\n- Adding `?api=` URL Query along with the API Secret Key\n- Being logged into Statping as an admin (using JWT sessions/cookies)\n\n> Authentication will create a cookie named `statping_auth`.\n\n# Environment Variables\nStatping includes many environment variables that can give you more control over your instance. Please view the [Environment Variables Wiki](https://github.com/statping/statping/wiki/Environment-Variables) page to view a complete list. Below are a couple important ones...\n- `STATPING_DIR` - Statping's working directory. By default, this will be set to the current working directory. This path will contain the `config.yml` file, `logs`, and `assets` folder. \n- `SASS` - Absolute path to the `sass` executable. By default it will attempt to find `sass` in your `$PATH`. \n\n# Demo\nYou can checkout the Statping Demo instance at [https://demo.statping.com](https://demo.statping.com). All features are available for you to experiment with. The API Secret Key is `demoapisecret123`. Since this instance is public, it will be reset with sample data **every 90 minutes**.\n", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ @@ -15,7 +15,7 @@ { "listen": "test", "script": { - "id": "08b8f487-2318-44b9-bdb8-f1f1041e9462", + "id": "29b5dc8d-60c1-4f70-853d-49114af6b254", "exec": [ "var tm = Math.round(new Date().getTime()/1000);", "pm.globals.set(\"start_time\", tm-259200);", @@ -32,6 +32,16 @@ ], "type": "text/javascript" } + }, + { + "listen": "prerequest", + "script": { + "id": "e5e9ea08-21d1-48d6-b019-9b4f93e813e5", + "exec": [ + "" + ], + "type": "text/javascript" + } } ], "request": { @@ -64,27 +74,27 @@ }, { "key": "db_user", - "value": "root", + "value": "{{db_user}}", "type": "text" }, { "key": "db_password", - "value": "password123", + "value": "{{db_password}}", "type": "text" }, { "key": "db_database", - "value": "statping", + "value": "{{db_database}}", "type": "text" }, { "key": "db_connection", - "value": "sqlite", + "value": "{{db_connection}}", "type": "text" }, { "key": "db_port", - "value": "3306", + "value": "{{db_port}}", "type": "text" }, { @@ -147,7 +157,7 @@ { "listen": "prerequest", "script": { - "id": "3faca200-30d4-4daf-8edf-059bf6b6fbf0", + "id": "ee74f82f-761a-46ae-a183-044b3d17c416", "type": "text/javascript", "exec": [ "" @@ -157,7 +167,7 @@ { "listen": "test", "script": { - "id": "a72027a1-280f-4ebf-887d-a19e9866d0ab", + "id": "99e1ad44-98bc-431c-bec6-d5b4ea3b94ac", "type": "text/javascript", "exec": [ "" @@ -176,7 +186,7 @@ { "listen": "test", "script": { - "id": "08b8f487-2318-44b9-bdb8-f1f1041e9462", + "id": "fb5b5fcf-86a0-4d22-9f4c-cc6955eb414a", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -186,7 +196,6 @@ " var jsonData = pm.response.json();", " pm.expect(jsonData.name).to.eql(\"Statping Monitoring Sample Data\");", " pm.expect(jsonData.using_cdn).to.eql(false);", - " pm.expect(jsonData.admin).to.eql(false);", "});" ], "type": "text/javascript" @@ -255,13 +264,171 @@ } ] }, + { + "name": "Logs", + "event": [ + { + "listen": "test", + "script": { + "id": "a694b786-796e-4d54-87fc-1848525bba65", + "exec": [ + "pm.test(\"Response is ok\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{api_key}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{endpoint}}/api/logs", + "host": [ + "{{endpoint}}" + ], + "path": [ + "api", + "logs" + ] + }, + "description": "This endpoint will return a list of the last 1,000 logs." + }, + "response": [ + { + "name": "Statping Details", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{endpoint}}/api", + "host": [ + "{{endpoint}}" + ], + "path": [ + "api" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Length", + "value": "398" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Date", + "value": "Sat, 02 May 2020 01:06:09 GMT" + } + ], + "cookie": [], + "body": "{\n \"admin\": false,\n \"allow_reports\": false,\n \"created_at\": \"2020-05-02T01:00:07.885973685Z\",\n \"description\": \"This data is only used to testing\",\n \"domain\": \"http://localhost:8080\",\n \"footer\": null,\n \"logged_in\": false,\n \"migration_id\": 1588381207,\n \"name\": \"Statping Sample Data\",\n \"setup\": true,\n \"started_on\": \"2020-05-02T01:00:14.255837864Z\",\n \"updated_at\": \"2020-05-02T01:00:12.731269305Z\",\n \"using_cdn\": false,\n \"version\": \"0.90.34\"\n}" + } + ] + }, + { + "name": "Logs Last Line", + "event": [ + { + "listen": "test", + "script": { + "id": "21501cae-bea0-4b6a-87cc-32a7f6da0771", + "exec": [ + "pm.test(\"Response is ok\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{api_key}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{endpoint}}/api/logs", + "host": [ + "{{endpoint}}" + ], + "path": [ + "api", + "logs" + ] + }, + "description": "This endpoint will return the last line in the logs." + }, + "response": [ + { + "name": "Statping Details", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{endpoint}}/api", + "host": [ + "{{endpoint}}" + ], + "path": [ + "api" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Length", + "value": "398" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Date", + "value": "Sat, 02 May 2020 01:06:09 GMT" + } + ], + "cookie": [], + "body": "{\n \"admin\": false,\n \"allow_reports\": false,\n \"created_at\": \"2020-05-02T01:00:07.885973685Z\",\n \"description\": \"This data is only used to testing\",\n \"domain\": \"http://localhost:8080\",\n \"footer\": null,\n \"logged_in\": false,\n \"migration_id\": 1588381207,\n \"name\": \"Statping Sample Data\",\n \"setup\": true,\n \"started_on\": \"2020-05-02T01:00:14.255837864Z\",\n \"updated_at\": \"2020-05-02T01:00:12.731269305Z\",\n \"using_cdn\": false,\n \"version\": \"0.90.34\"\n}" + } + ] + }, { "name": "Health Check", "event": [ { "listen": "test", "script": { - "id": "987cc831-4a88-45ea-a9d5-494d86887fc6", + "id": "1259b7bb-a330-4716-ae7c-386f96224a14", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -338,7 +505,7 @@ { "listen": "test", "script": { - "id": "2f977982-ef22-4cee-9c38-89ad4777d3e0", + "id": "04a41c9d-0659-44f8-9efb-d04fff1af6e3", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -406,7 +573,7 @@ { "listen": "test", "script": { - "id": "08b8f487-2318-44b9-bdb8-f1f1041e9462", + "id": "dbabc164-5030-441d-90f7-b29c7fe794df", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -486,7 +653,7 @@ { "listen": "test", "script": { - "id": "08b8f487-2318-44b9-bdb8-f1f1041e9462", + "id": "992ce59d-3cce-43f1-9c3d-895c55a3e0a1", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -566,7 +733,7 @@ { "listen": "test", "script": { - "id": "9b94f2ee-0918-4bc0-84a2-3b148b76126b", + "id": "8ee8bf21-4243-4f15-8a03-2189224360c7", "exec": [ "" ], @@ -636,7 +803,7 @@ { "listen": "prerequest", "script": { - "id": "883519e8-7c7d-49c0-9812-d988d0179907", + "id": "00ffb460-8bfc-4221-af12-b155a34c11fc", "type": "text/javascript", "exec": [ "" @@ -646,14 +813,15 @@ { "listen": "test", "script": { - "id": "7a0738e6-2fc4-45cb-9f1a-1cd57fb76b66", + "id": "ffe44bf8-4bf3-4175-bb4b-3c3910c674c3", "type": "text/javascript", "exec": [ "" ] } } - ] + ], + "protocolProfileBehavior": {} }, { "name": "Services", @@ -664,7 +832,7 @@ { "listen": "test", "script": { - "id": "d87f8a4e-7640-45b8-9d45-4f6e6f2463ee", + "id": "e89a245a-8ee6-4f3b-8cbc-5d7c3bbf687a", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -749,7 +917,7 @@ { "listen": "test", "script": { - "id": "023c5643-6cb1-4cd0-b775-566f232d68f8", + "id": "7c3e8784-0494-4957-ac45-b09c26580b40", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -850,7 +1018,7 @@ { "listen": "test", "script": { - "id": "023c5643-6cb1-4cd0-b775-566f232d68f8", + "id": "860fa275-aed7-481d-967f-11b481df49e0", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -986,7 +1154,7 @@ { "listen": "test", "script": { - "id": "023c5643-6cb1-4cd0-b775-566f232d68f8", + "id": "d89562d5-6742-447a-ae95-1ad044123f70", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -1122,7 +1290,7 @@ { "listen": "test", "script": { - "id": "023c5643-6cb1-4cd0-b775-566f232d68f8", + "id": "e5af74ef-3ae5-45ef-ac0c-30ec1ed006c3", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -1258,7 +1426,7 @@ { "listen": "test", "script": { - "id": "023c5643-6cb1-4cd0-b775-566f232d68f8", + "id": "b21c7e93-24a7-4c0a-90fa-89d3e34f0029", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -1322,7 +1490,7 @@ { "listen": "test", "script": { - "id": "023c5643-6cb1-4cd0-b775-566f232d68f8", + "id": "c6f024c5-f81d-4aca-92e8-b93bf9ac9068", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -1391,7 +1559,7 @@ { "listen": "test", "script": { - "id": "b5a67a19-fd08-40b0-a961-3e9474ab78c6", + "id": "cf487420-5c74-4572-b512-29fe6de72761", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -1494,7 +1662,7 @@ { "listen": "test", "script": { - "id": "d4eb16fe-8495-40e5-9ca3-be20951e5133", + "id": "7f96b2ec-11e5-44ab-b353-c2b4fa034f80", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -1602,7 +1770,7 @@ { "listen": "test", "script": { - "id": "b5a67a19-fd08-40b0-a961-3e9474ab78c6", + "id": "8f497902-ca10-45cb-bb98-96db1604b276", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -1714,7 +1882,7 @@ { "listen": "test", "script": { - "id": "dd4d721d-d874-448b-abc9-59c1afceb58e", + "id": "ea18e56c-382d-42c4-9bc7-477da1d760fe", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -1763,7 +1931,7 @@ { "listen": "test", "script": { - "id": "dd4d721d-d874-448b-abc9-59c1afceb58e", + "id": "c8b61f71-2f28-42a5-9ca1-e80038767fbe", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -1795,7 +1963,10 @@ "header": [], "body": { "mode": "raw", - "raw": "" + "raw": "", + "options": { + "raw": {} + } }, "url": { "raw": "{{endpoint}}/api/services/{{service_id}}", @@ -1870,7 +2041,7 @@ { "listen": "prerequest", "script": { - "id": "4cd2ab82-e60d-45cd-9b74-cb4b5d893f4d", + "id": "2d965d82-4d9e-4c37-a3d2-286c75ae00de", "type": "text/javascript", "exec": [ "" @@ -1880,14 +2051,670 @@ { "listen": "test", "script": { - "id": "c7cb2b6d-289a-4073-b291-202bbec8cb44", + "id": "f3cd55c0-923e-43fa-ab6b-e26df9f20e0a", "type": "text/javascript", "exec": [ "" ] } } - ] + ], + "protocolProfileBehavior": {} + }, + { + "name": "Incidents", + "item": [ + { + "name": "View Service Incidents", + "event": [ + { + "listen": "test", + "script": { + "id": "575ede33-53ac-4e8b-9dbf-3560409b6d1f", + "exec": [ + "pm.test(\"Response is ok\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{api_key}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "url": { + "raw": "{{endpoint}}/api/services/1/incidents", + "host": [ + "{{endpoint}}" + ], + "path": [ + "api", + "services", + "1", + "incidents" + ] + }, + "description": "View all incidents for a single service." + }, + "response": [ + { + "name": "View Service Incidents", + "originalRequest": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "url": { + "raw": "{{endpoint}}/api/services/1/incidents", + "host": [ + "{{endpoint}}" + ], + "path": [ + "api", + "services", + "1", + "incidents" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Date", + "value": "Mon, 04 May 2020 03:13:44 GMT" + }, + { + "key": "Content-Length", + "value": "136" + }, + { + "key": "Connection", + "value": "close" + } + ], + "cookie": [], + "body": "[\n {\n \"id\": 1,\n \"title\": \"Service Downtime\",\n \"service\": 1,\n \"created_at\": \"2020-05-04T03:11:51.752374Z\",\n \"updated_at\": \"2020-05-04T03:11:51.752374Z\"\n }\n]" + } + ] + }, + { + "name": "Create Incident", + "event": [ + { + "listen": "test", + "script": { + "id": "6252ebad-26a9-481d-a233-e097306fc598", + "exec": [ + "pm.test(\"Response is ok\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Incidents JSON\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.status).to.eql(\"success\");", + " pm.expect(jsonData.method).to.eql(\"create\");", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{api_key}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"title\": \"Service Downtime\",\n\t\"description\": \"\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{endpoint}}/api/services/1/incidents", + "host": [ + "{{endpoint}}" + ], + "path": [ + "api", + "services", + "1", + "incidents" + ] + }, + "description": "Create an incident for a service." + }, + "response": [ + { + "name": "Create Incident", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"title\": \"Service Downtime\",\n\t\"description\": \"\",\n\t\"service\": 1\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{endpoint}}/api/services/1/incidents", + "host": [ + "{{endpoint}}" + ], + "path": [ + "api", + "services", + "1", + "incidents" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Date", + "value": "Mon, 04 May 2020 03:11:51 GMT" + }, + { + "key": "Content-Length", + "value": "207" + }, + { + "key": "Connection", + "value": "close" + } + ], + "cookie": [], + "body": "{\n \"status\": \"success\",\n \"type\": \"incident\",\n \"method\": \"create\",\n \"id\": 1,\n \"output\": {\n \"id\": 1,\n \"title\": \"Service Downtime\",\n \"service\": 1,\n \"created_at\": \"2020-05-04T03:11:51.752374Z\",\n \"updated_at\": \"2020-05-04T03:11:51.752374Z\"\n }\n}" + } + ] + }, + { + "name": "Update Service Incident", + "event": [ + { + "listen": "test", + "script": { + "id": "42cd68de-5bd4-4d4e-b687-fa0bafc1d61a", + "exec": [ + "pm.test(\"Response is ok\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{api_key}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"title\": \"Updated Downtime\",\n\t\"description\": \"This is an update for an incident\"\n}" + }, + "url": { + "raw": "{{endpoint}}/api/incidents/1", + "host": [ + "{{endpoint}}" + ], + "path": [ + "api", + "incidents", + "1" + ] + }, + "description": "View all incidents for a single service." + }, + "response": [] + }, + { + "name": "Delete Incident", + "event": [ + { + "listen": "test", + "script": { + "id": "c6735dbe-86e8-4b42-9b04-6fc1fea949df", + "exec": [ + "pm.test(\"Response is ok\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{api_key}}", + "type": "string" + } + ] + }, + "method": "DELETE", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "url": { + "raw": "{{endpoint}}/api/incidents/1", + "host": [ + "{{endpoint}}" + ], + "path": [ + "api", + "incidents", + "1" + ] + }, + "description": "View all incidents for a single service." + }, + "response": [ + { + "name": "Delete Incident", + "originalRequest": { + "method": "DELETE", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "url": { + "raw": "{{endpoint}}/api/incidents/2", + "host": [ + "{{endpoint}}" + ], + "path": [ + "api", + "incidents", + "2" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Date", + "value": "Mon, 04 May 2020 03:31:48 GMT" + }, + { + "key": "Content-Length", + "value": "207" + }, + { + "key": "Connection", + "value": "close" + } + ], + "cookie": [], + "body": "{\n \"status\": \"success\",\n \"type\": \"incident\",\n \"method\": \"delete\",\n \"id\": 2,\n \"output\": {\n \"id\": 2,\n \"title\": \"Service Downtime\",\n \"service\": 1,\n \"created_at\": \"2020-05-04T03:18:24.818629Z\",\n \"updated_at\": \"2020-05-04T03:18:24.818629Z\"\n }\n}" + } + ] + }, + { + "name": "Incident Updates", + "event": [ + { + "listen": "test", + "script": { + "id": "e2e7d38f-efae-44d1-9361-cd301547feb3", + "exec": [ + "pm.test(\"Response is ok\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{api_key}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "url": { + "raw": "{{endpoint}}/api/incidents/2/updates", + "host": [ + "{{endpoint}}" + ], + "path": [ + "api", + "incidents", + "2", + "updates" + ] + }, + "description": "View all incidents for a single service." + }, + "response": [] + }, + { + "name": "Create Incident Update", + "event": [ + { + "listen": "test", + "script": { + "id": "4478e35f-8da6-4f74-9100-0bb92ac6466e", + "exec": [ + "pm.test(\"Response is ok\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{api_key}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"message\": \"Website is loading very slowly, looking into this.\",\n\t\"type\": \"Investigating\"\n}" + }, + "url": { + "raw": "{{endpoint}}/api/incidents/2/updates", + "host": [ + "{{endpoint}}" + ], + "path": [ + "api", + "incidents", + "2", + "updates" + ] + }, + "description": "View all incidents for a single service." + }, + "response": [ + { + "name": "Create Incident Update", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"message\": \"Website is loading very slowly, looking into this.\",\n\t\"type\": \"Investigating\"\n}" + }, + "url": { + "raw": "{{endpoint}}/api/incidents/2/updates", + "host": [ + "{{endpoint}}" + ], + "path": [ + "api", + "incidents", + "2", + "updates" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Date", + "value": "Mon, 04 May 2020 03:20:05 GMT" + }, + { + "key": "Content-Length", + "value": "261" + }, + { + "key": "Connection", + "value": "close" + } + ], + "cookie": [], + "body": "{\n \"status\": \"success\",\n \"type\": \"incident_update\",\n \"method\": \"create\",\n \"id\": 1,\n \"output\": {\n \"id\": 1,\n \"message\": \"Website is loading very slowly, looking into this.\",\n \"type\": \"Investigating\",\n \"created_at\": \"2020-05-04T03:20:05.102435Z\",\n \"updated_at\": \"2020-05-04T03:20:05.102435Z\"\n }\n}" + } + ] + }, + { + "name": "Delete Incident Update", + "event": [ + { + "listen": "test", + "script": { + "id": "4578b229-5a85-4d3c-acdc-360ad50a35f2", + "exec": [ + "pm.test(\"Response is ok\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{api_key}}", + "type": "string" + } + ] + }, + "method": "DELETE", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "url": { + "raw": "{{endpoint}}/api/incidents/2/updates/1", + "host": [ + "{{endpoint}}" + ], + "path": [ + "api", + "incidents", + "2", + "updates", + "1" + ] + }, + "description": "View all incidents for a single service." + }, + "response": [ + { + "name": "Delete Incident Update", + "originalRequest": { + "method": "DELETE", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "url": { + "raw": "{{endpoint}}/api/incidents/2/updates/1", + "host": [ + "{{endpoint}}" + ], + "path": [ + "api", + "incidents", + "2", + "updates", + "1" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Date", + "value": "Mon, 04 May 2020 03:23:00 GMT" + }, + { + "key": "Content-Length", + "value": "261" + }, + { + "key": "Connection", + "value": "close" + } + ], + "cookie": [], + "body": "{\n \"status\": \"success\",\n \"type\": \"incident_update\",\n \"method\": \"delete\",\n \"id\": 1,\n \"output\": {\n \"id\": 1,\n \"message\": \"Website is loading very slowly, looking into this.\",\n \"type\": \"Investigating\",\n \"created_at\": \"2020-05-04T03:20:05.102435Z\",\n \"updated_at\": \"2020-05-04T03:20:05.102435Z\"\n }\n}" + } + ] + } + ], + "protocolProfileBehavior": {} }, { "name": "Groups", @@ -1898,7 +2725,7 @@ { "listen": "test", "script": { - "id": "d87f8a4e-7640-45b8-9d45-4f6e6f2463ee", + "id": "e83ac60d-3683-441e-a78b-d15b6c2b704d", "exec": [ "pm.test(\"View All Groups\", function () {", " var jsonData = pm.response.json();", @@ -1979,7 +2806,7 @@ { "listen": "test", "script": { - "id": "023c5643-6cb1-4cd0-b775-566f232d68f8", + "id": "d2bba501-9674-4143-a51d-33721eb4785f", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -2080,7 +2907,7 @@ { "listen": "test", "script": { - "id": "d4eb16fe-8495-40e5-9ca3-be20951e5133", + "id": "6ea60d3a-b601-41a8-8b5e-734f3946d34c", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -2184,7 +3011,7 @@ { "listen": "test", "script": { - "id": "b5a67a19-fd08-40b0-a961-3e9474ab78c6", + "id": "4efd65bf-6e56-4600-91af-36cb82ffb125", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -2214,7 +3041,10 @@ ], "body": { "mode": "raw", - "raw": "[{\"group\":1,\"order\":1},{\"group\":2,\"order\":2}]" + "raw": "[{\"group\":1,\"order\":1},{\"group\":2,\"order\":2}]", + "options": { + "raw": {} + } }, "url": { "raw": "{{endpoint}}/api/reorder/groups", @@ -2237,7 +3067,7 @@ { "listen": "test", "script": { - "id": "dd4d721d-d874-448b-abc9-59c1afceb58e", + "id": "ec903995-c37b-436a-b554-c9e4ee5ff52a", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -2344,7 +3174,7 @@ { "listen": "prerequest", "script": { - "id": "4cd2ab82-e60d-45cd-9b74-cb4b5d893f4d", + "id": "abe8dbf2-9e63-49b5-b5d3-7a50217c87a3", "type": "text/javascript", "exec": [ "" @@ -2354,7 +3184,7 @@ { "listen": "test", "script": { - "id": "c7cb2b6d-289a-4073-b291-202bbec8cb44", + "id": "de397a38-c190-4928-92f0-393ab85e5342", "type": "text/javascript", "exec": [ "" @@ -2373,7 +3203,7 @@ { "listen": "test", "script": { - "id": "08b8f487-2318-44b9-bdb8-f1f1041e9462", + "id": "eaec5a14-dd31-4e9c-9e30-8999591514c3", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -2505,7 +3335,7 @@ { "listen": "test", "script": { - "id": "f6848835-443c-4dfa-abb9-ddea712cd0d1", + "id": "f858d94a-6534-452b-9197-99c64d7b4009", "exec": [ "" ], @@ -2549,7 +3379,7 @@ { "listen": "test", "script": { - "id": "9a2977fe-9689-4039-bdcb-eaa34abee958", + "id": "20b79651-9175-4a30-98f3-4666ebf9ab05", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -2638,7 +3468,7 @@ { "listen": "test", "script": { - "id": "1913466d-83b2-4d5b-ac48-89c9abdd0c8d", + "id": "fd7e8b36-70c2-4060-bb50-5d87e663dea3", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -2744,7 +3574,7 @@ { "listen": "test", "script": { - "id": "555b7ba4-bb36-4e86-a541-fa5a5008f951", + "id": "925d3cea-fa59-42db-9d4e-154021cfbd37", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -2834,7 +3664,7 @@ { "listen": "prerequest", "script": { - "id": "d23b1822-d1de-4545-9a82-3cf4719a7e82", + "id": "2802ca86-12c2-41ce-947d-e086fcb7c753", "exec": [ "" ], @@ -2844,7 +3674,7 @@ { "listen": "test", "script": { - "id": "b0d22bbd-a428-4df3-8295-b40542bfa21f", + "id": "19f750c7-1df2-4a03-b0f0-b487d80d4917", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -2949,7 +3779,7 @@ { "listen": "test", "script": { - "id": "bd8c3425-a97f-4f8c-b849-71b65dd543ee", + "id": "d94974c7-7c6f-4298-8ab7-6bd7a789020f", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -3050,7 +3880,7 @@ { "listen": "prerequest", "script": { - "id": "9720db1a-bc4c-4e05-94ea-2782aaafb793", + "id": "8cef4ad5-1c96-46e8-8fc9-9e9e044730dc", "type": "text/javascript", "exec": [ "" @@ -3060,7 +3890,7 @@ { "listen": "test", "script": { - "id": "c667ae2d-41f3-4dea-ab62-3b544e2bc8f9", + "id": "872da99f-a57d-4a54-bd5e-18b5529c715f", "type": "text/javascript", "exec": [ "" @@ -3079,7 +3909,7 @@ { "listen": "test", "script": { - "id": "e9105618-6db8-4a57-ae7f-782989842f4a", + "id": "9f3e4a3e-a690-4dcb-897f-fdfa8503d79f", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -3164,7 +3994,7 @@ { "listen": "test", "script": { - "id": "acac30b6-3caa-46c9-89be-1efbadf89f22", + "id": "7a42a113-8bdb-47dd-a914-36bc2aa65aba", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -3252,7 +4082,7 @@ { "listen": "test", "script": { - "id": "d714d71d-4d6a-4b2e-a6ea-16c34dec3041", + "id": "2a8a1a62-57ea-4a7a-9f0a-713ac548c151", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -3291,7 +4121,10 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"slack\",\n \"host\": \"https://hooks.slack.com/services/EXAMPLEIDHERE/BV33WKP0C/MtKw3Kc8BFylTv4pohKqHtXX\",\n \"enabled\": true,\n \"limits\": 55\n}" + "raw": "{\n \"method\": \"slack\",\n \"host\": \"https://hooks.slack.com/services/EXAMPLEIDHERE/BV33WKP0C/MtKw3Kc8BFylTv4pohKqHtXX\",\n \"enabled\": true,\n \"limits\": 55\n}", + "options": { + "raw": {} + } }, "url": { "raw": "{{endpoint}}/api/notifier/slack", @@ -3356,6 +4189,127 @@ "body": "{\n \"status\": \"success\",\n \"type\": \"string\",\n \"method\": \"update\",\n \"output\": \"slack\"\n}" } ] + }, + { + "name": "Test Notifier", + "event": [ + { + "listen": "test", + "script": { + "id": "198374af-ccbc-4e2e-8af2-df58622379d4", + "exec": [ + "pm.test(\"Response is ok\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Test Notifier\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.success).to.eql(false);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{api_key}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"method\": \"slack\",\n \"host\": \"https://hooks.slack.com/services/EXAMPLEIDHERE/BV33WKP0C/MtKw3Kc8BFylTv4pohKqHtXX\",\n \"enabled\": true,\n \"limits\": 55\n}", + "options": { + "raw": {} + } + }, + "url": { + "raw": "{{endpoint}}/api/notifier/slack/test", + "host": [ + "{{endpoint}}" + ], + "path": [ + "api", + "notifier", + "slack", + "test" + ] + }, + "description": "Update a notifier to change it's values." + }, + "response": [ + { + "name": "Test Notifier", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"method\": \"slack\",\n \"host\": \"https://hooks.slack.com/services/EXAMPLEIDHERE/BV33WKP0C/MtKw3Kc8BFylTv4pohKqHtXX\",\n \"enabled\": true,\n \"limits\": 55\n}", + "options": { + "raw": {} + } + }, + "url": { + "raw": "{{endpoint}}/api/notifier/slack/test", + "host": [ + "{{endpoint}}" + ], + "path": [ + "api", + "notifier", + "slack", + "test" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Date", + "value": "Mon, 04 May 2020 03:25:07 GMT" + }, + { + "key": "Connection", + "value": "close" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + } + ], + "cookie": [], + "body": "{\n \"success\": false,\n \"response\": \"There's been a glitch… | Slack

There’s been a glitch…

We’re not quite sure what went wrong. You can go back, or try looking on our Help Center if you need a hand.

\\n\\n\\n\\n\",\n \"error\": {}\n}" + } + ] } ], "description": "Statping contains multiple notifiers that will send you a notification whenever a service become offline, or online. You can create your own 3rd party notifier by reading more on the [Notifiers Wiki](https://github.com/statping/statping/wiki/Notifiers) on the Github repo.", @@ -3373,7 +4327,7 @@ { "listen": "prerequest", "script": { - "id": "bd5d8232-7ed7-4607-ab7c-14de85c3a033", + "id": "8f3b2e75-ce23-4294-b5bb-05b1248b9ef3", "type": "text/javascript", "exec": [ "" @@ -3383,7 +4337,7 @@ { "listen": "test", "script": { - "id": "ef420ba0-37dc-4ffc-b38f-a43ccca76606", + "id": "06653dbc-888b-4016-8964-82d25e0273e3", "type": "text/javascript", "exec": [ "" @@ -3402,7 +4356,7 @@ { "listen": "test", "script": { - "id": "3c484d1b-6e77-4084-b844-3ca77dc50108", + "id": "b2374cab-1ce8-4f9e-a2fa-f92477936cd4", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -3480,7 +4434,7 @@ { "listen": "test", "script": { - "id": "12caf74a-61d7-4f6e-89b5-fca2f65464c4", + "id": "66307d95-1833-4786-a29a-40fc05153d09", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -3583,7 +4537,7 @@ { "listen": "test", "script": { - "id": "c30cc333-53f4-4e9a-9c32-958c905ec163", + "id": "7e17e9cb-6750-411a-8a9a-335ece3b3cda", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -3661,7 +4615,7 @@ { "listen": "test", "script": { - "id": "e9dd78cc-0f38-4516-bf82-38dd3451b2e7", + "id": "c89210ce-dfce-4acf-8bf5-f601f53d353e", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -3693,7 +4647,10 @@ ], "body": { "mode": "raw", - "raw": "{\n \"title\": \"Updated Message\",\n \"description\": \"This message was updated\",\n \"start_on\": \"2022-11-17T03:28:16.323797-08:00\",\n \"end_on\": \"2022-11-17T05:13:16.323798-08:00\",\n \"service\": 1,\n \"notify_users\": true,\n \"notify_method\": \"email\",\n \"notify_before\": 3,\n \"notify_before_scale\": \"hour\"\n}" + "raw": "{\n \"title\": \"Updated Message\",\n \"description\": \"This message was updated\",\n \"start_on\": \"2022-11-17T03:28:16.323797-08:00\",\n \"end_on\": \"2022-11-17T05:13:16.323798-08:00\",\n \"service\": 1,\n \"notify_users\": true,\n \"notify_method\": \"email\",\n \"notify_before\": 3,\n \"notify_before_scale\": \"hour\"\n}", + "options": { + "raw": {} + } }, "url": { "raw": "{{endpoint}}/api/messages/{{message_id}}", @@ -3765,7 +4722,7 @@ { "listen": "test", "script": { - "id": "6cb2527f-41c2-4feb-9573-1e4d59efa116", + "id": "61a55ba9-d524-4509-a93f-679b5574182a", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -3864,7 +4821,7 @@ { "listen": "prerequest", "script": { - "id": "8d24599b-f157-475b-9e30-06c1171c85bc", + "id": "b2160e12-ca83-4454-be33-7eac6f32e16b", "type": "text/javascript", "exec": [ "" @@ -3874,7 +4831,7 @@ { "listen": "test", "script": { - "id": "497c2428-fe8a-42c2-bf6f-8f2cdf959771", + "id": "a140fc05-3ec2-40dc-a5c5-93d055242995", "type": "text/javascript", "exec": [ "" @@ -3893,7 +4850,7 @@ { "listen": "test", "script": { - "id": "54bded63-de27-4839-8783-25874c35c3ea", + "id": "e94a6ff9-bbea-4947-9360-6302a29bdddd", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -3972,7 +4929,7 @@ { "listen": "test", "script": { - "id": "af07a95b-1bf5-42c7-bd3f-a32f3ab2a264", + "id": "4d656189-d860-43d5-b9b9-d526c6d52338", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -4015,7 +4972,10 @@ ], "body": { "mode": "raw", - "raw": "{\n \"service_id\": 2,\n \"name\": \"Server Checkin\",\n \"interval\": 900,\n \"grace\": 60\n}" + "raw": "{\n \"service_id\": 2,\n \"name\": \"Server Checkin\",\n \"interval\": 900,\n \"grace\": 60\n}", + "options": { + "raw": {} + } }, "url": { "raw": "{{endpoint}}/api/checkins", @@ -4085,7 +5045,7 @@ { "listen": "test", "script": { - "id": "652a1c5b-5379-43c2-9cd8-ebd8f8dad0f6", + "id": "cb89fcee-0ae4-4496-a159-c214238965ab", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -4161,7 +5121,7 @@ { "listen": "test", "script": { - "id": "93ff6b86-368b-406f-9d75-07338714ebca", + "id": "25998408-3f55-4d42-ac4f-b6163c1fc0a5", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -4242,7 +5202,7 @@ { "listen": "test", "script": { - "id": "d3fdc6b9-d8ca-4634-a735-af8db0f31cef", + "id": "0ddca6d9-b1f9-49db-be8d-75fcab4cab0d", "exec": [ "pm.test(\"Response is ok\", function () {", " pm.response.to.have.status(200);", @@ -4276,7 +5236,10 @@ "header": [], "body": { "mode": "raw", - "raw": "" + "raw": "", + "options": { + "raw": {} + } }, "url": { "raw": "{{endpoint}}/api/checkins/{{checkin_id}}", @@ -4351,7 +5314,7 @@ { "listen": "prerequest", "script": { - "id": "fefe9fc9-8020-41ec-b20f-dd2c5ad951e9", + "id": "d880b73c-1edd-40d7-aac5-6ef0d2e2704b", "type": "text/javascript", "exec": [ "" @@ -4361,7 +5324,7 @@ { "listen": "test", "script": { - "id": "4a611b52-8ec2-4e26-8ed8-51f2729f93a1", + "id": "adf70343-e8f3-4162-8eeb-6fb71784ef57", "type": "text/javascript", "exec": [ "" @@ -4380,11 +5343,9 @@ { "listen": "test", "script": { - "id": "cf003eb2-e18e-46f0-bee2-2a9915525651", + "id": "11f52299-58b7-4a57-9842-252e2d8e139e", "exec": [ - "pm.test(\"Response is ok\", function () {", - " pm.response.to.have.status(200);", - "});" + "" ], "type": "text/javascript" } @@ -4424,11 +5385,9 @@ { "listen": "test", "script": { - "id": "8520bcc3-1176-4eb9-b22e-31169e093568", + "id": "8dace46e-1e0d-4d7c-90f0-c5a29cd2f0c0", "exec": [ - "pm.test(\"Response is ok\", function () {", - " pm.response.to.have.status(200);", - "});" + "" ], "type": "text/javascript" } @@ -4467,11 +5426,9 @@ { "listen": "test", "script": { - "id": "d9665e36-02b4-4c9f-b155-aded33b3936e", + "id": "b18f4b1d-3019-4b96-8203-d1876deab89f", "exec": [ - "pm.test(\"Response is ok\", function () {", - " pm.response.to.have.status(200);", - "});" + "" ], "type": "text/javascript" } @@ -4519,11 +5476,9 @@ { "listen": "test", "script": { - "id": "22213939-d2be-47fb-8c76-b8b4c4956b81", + "id": "5e59d318-3e11-44be-9d78-85398d35e9be", "exec": [ - "pm.test(\"Response is ok\", function () {", - " pm.response.to.have.status(200);", - "});" + "" ], "type": "text/javascript" } @@ -4609,7 +5564,7 @@ { "listen": "prerequest", "script": { - "id": "cb6d709c-85c1-4dc3-9434-04f817db23ea", + "id": "8512f9f2-50af-4c7c-90af-4feb43908ac9", "type": "text/javascript", "exec": [ "" @@ -4619,7 +5574,311 @@ { "listen": "test", "script": { - "id": "88b7bef2-103e-455c-a8f8-bce15c73d6d7", + "id": "f28d8c39-84fa-4e20-9bd9-e8f8a0158919", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "oAuth", + "item": [ + { + "name": "Set Keys", + "event": [ + { + "listen": "test", + "script": { + "id": "3b2cf616-7e7d-4e11-beee-7027e0ed6dd2", + "exec": [ + "pm.test(\"Response is ok\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"update check\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.status).to.eql(\"success\");", + " pm.expect(jsonData.method).to.eql(\"update\");", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{api_key}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"gh_client_id\": \"githubid\",\n \"gh_client_secret\": \"githubsecret\",\n \"google_client_id\": \"googleid\",\n \"google_client_secret\": \"googlesecret\",\n \"oauth_domains\": \"gmail.com,yahoo.com,socialeck.com\",\n \"oauth_providers\": \"local,slack,google,github\",\n \"slack_client_id\": \"936045034737.1044972172659\",\n \"slack_client_secret\": \"05dd514efb382971e538a5561981e54a\",\n \"slack_team\": \"dev\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{endpoint}}/api/oauth", + "host": [ + "{{endpoint}}" + ], + "path": [ + "api", + "oauth" + ] + }, + "description": "This endpoint will return the last line in the logs." + }, + "response": [ + { + "name": "Statping Details", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{endpoint}}/api", + "host": [ + "{{endpoint}}" + ], + "path": [ + "api" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Length", + "value": "398" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Date", + "value": "Sat, 02 May 2020 01:06:09 GMT" + } + ], + "cookie": [], + "body": "{\n \"admin\": false,\n \"allow_reports\": false,\n \"created_at\": \"2020-05-02T01:00:07.885973685Z\",\n \"description\": \"This data is only used to testing\",\n \"domain\": \"http://localhost:8080\",\n \"footer\": null,\n \"logged_in\": false,\n \"migration_id\": 1588381207,\n \"name\": \"Statping Sample Data\",\n \"setup\": true,\n \"started_on\": \"2020-05-02T01:00:14.255837864Z\",\n \"updated_at\": \"2020-05-02T01:00:12.731269305Z\",\n \"using_cdn\": false,\n \"version\": \"0.90.34\"\n}" + } + ] + }, + { + "name": "Get Keys", + "event": [ + { + "listen": "test", + "script": { + "id": "a3dd164d-56dc-43c9-80ae-ad42ced9542f", + "exec": [ + "pm.test(\"Response is ok\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "", + "pm.test(\"correct values\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.gh_client_id).to.eql(\"githubid\");", + " pm.expect(jsonData.gh_client_secret).to.eql(\"githubsecret\");", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{api_key}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{endpoint}}/api/oauth", + "host": [ + "{{endpoint}}" + ], + "path": [ + "api", + "oauth" + ] + }, + "description": "This endpoint will return the last line in the logs." + }, + "response": [ + { + "name": "Statping Details", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{endpoint}}/api", + "host": [ + "{{endpoint}}" + ], + "path": [ + "api" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Length", + "value": "398" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Date", + "value": "Sat, 02 May 2020 01:06:09 GMT" + } + ], + "cookie": [], + "body": "{\n \"admin\": false,\n \"allow_reports\": false,\n \"created_at\": \"2020-05-02T01:00:07.885973685Z\",\n \"description\": \"This data is only used to testing\",\n \"domain\": \"http://localhost:8080\",\n \"footer\": null,\n \"logged_in\": false,\n \"migration_id\": 1588381207,\n \"name\": \"Statping Sample Data\",\n \"setup\": true,\n \"started_on\": \"2020-05-02T01:00:14.255837864Z\",\n \"updated_at\": \"2020-05-02T01:00:12.731269305Z\",\n \"using_cdn\": false,\n \"version\": \"0.90.34\"\n}" + } + ] + }, + { + "name": "Authenticate token", + "event": [ + { + "listen": "test", + "script": { + "id": "2d5f11de-4041-4667-b094-4e1934195649", + "exec": [ + "pm.test(\"Response is ok\", function () {", + " pm.response.to.have.status(500);", + "});", + "", + "pm.test(\"missing values\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.error).to.eql(\"oauth2: server response missing access_token\");", + "});" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "code", + "value": "936045034737.1125195726608.7440bec1a519b713bd3c39c4aaed46f5a4891878c1616d1a6ac2be3bc0cc9867", + "type": "text" + }, + { + "key": "state", + "value": "0", + "type": "text" + } + ] + }, + "url": { + "raw": "{{endpoint}}/oauth/slack", + "host": [ + "{{endpoint}}" + ], + "path": [ + "oauth", + "slack" + ] + }, + "description": "This endpoint will return the last line in the logs." + }, + "response": [ + { + "name": "Statping Details", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{endpoint}}/api", + "host": [ + "{{endpoint}}" + ], + "path": [ + "api" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Length", + "value": "398" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Date", + "value": "Sat, 02 May 2020 01:06:09 GMT" + } + ], + "cookie": [], + "body": "{\n \"admin\": false,\n \"allow_reports\": false,\n \"created_at\": \"2020-05-02T01:00:07.885973685Z\",\n \"description\": \"This data is only used to testing\",\n \"domain\": \"http://localhost:8080\",\n \"footer\": null,\n \"logged_in\": false,\n \"migration_id\": 1588381207,\n \"name\": \"Statping Sample Data\",\n \"setup\": true,\n \"started_on\": \"2020-05-02T01:00:14.255837864Z\",\n \"updated_at\": \"2020-05-02T01:00:12.731269305Z\",\n \"using_cdn\": false,\n \"version\": \"0.90.34\"\n}" + } + ] + } + ], + "description": "You can allow other users to login through other services by using OAuth.\n\n- [Google OAuth](https://developers.google.com/identity/protocols/oauth2)\n- [Slack OAuth](https://api.slack.com/legacy/oauth)\n- [Github OAuth](https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/)\n\n### Redirect URL\nEach OAuth service has a dedicated redirect URL: `/oauth/{provider}`. Replace `{provider}` with google, slack, or github depending on which service you're using.", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "2792fd81-5e3a-434b-8f51-992bea3a2b49", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "467bdaac-344d-451e-a4b4-825aec80ceef", "type": "text/javascript", "exec": [ "" @@ -4644,7 +5903,7 @@ { "listen": "prerequest", "script": { - "id": "e37b4946-9995-4fb5-88a9-39adb191d076", + "id": "a88caffc-d042-4f68-9757-3b5b3e628737", "type": "text/javascript", "exec": [ "" @@ -4654,12 +5913,13 @@ { "listen": "test", "script": { - "id": "8fa9bd45-c197-4751-baa6-c58143156aea", + "id": "dc71e455-8623-429d-890b-0cfc3bb9f8d1", "type": "text/javascript", "exec": [ "" ] } } - ] + ], + "protocolProfileBehavior": {} } \ No newline at end of file diff --git a/dev/postman_env_mysql.json b/dev/postman_env_mysql.json new file mode 100644 index 00000000..02284809 --- /dev/null +++ b/dev/postman_env_mysql.json @@ -0,0 +1,49 @@ +{ + "id": "0ff1dcd6-54f3-44a7-9c18-cc3c8e7df357", + "name": "Local Statping", + "values": [ + { + "key": "endpoint", + "value": "http://0.0.0.0:8585", + "enabled": true + }, + { + "key": "api_key", + "value": "demosecret123", + "enabled": true + }, + { + "key": "db_connection", + "value": "mysql", + "enabled": true + }, + { + "key": "db_host", + "value": "localhost", + "enabled": true + }, + { + "key": "db_user", + "value": "root", + "enabled": true + }, + { + "key": "db_password", + "value": "password123", + "enabled": true + }, + { + "key": "db_database", + "value": "statping", + "enabled": true + }, + { + "key": "db_port", + "value": "3306", + "enabled": true + } + ], + "_postman_variable_scope": "environment", + "_postman_exported_at": "2020-05-18T20:44:05.571Z", + "_postman_exported_using": "Postman/7.24.0" +} diff --git a/dev/postman_env_postgres.json b/dev/postman_env_postgres.json new file mode 100644 index 00000000..6093018b --- /dev/null +++ b/dev/postman_env_postgres.json @@ -0,0 +1,49 @@ +{ + "id": "0ff1dcd6-54f3-44a7-9c18-cc3c8e7df357", + "name": "Local Statping", + "values": [ + { + "key": "endpoint", + "value": "http://0.0.0.0:8585", + "enabled": true + }, + { + "key": "api_key", + "value": "demosecret123", + "enabled": true + }, + { + "key": "db_connection", + "value": "postgres", + "enabled": true + }, + { + "key": "db_host", + "value": "localhost", + "enabled": true + }, + { + "key": "db_user", + "value": "root", + "enabled": true + }, + { + "key": "db_password", + "value": "password123", + "enabled": true + }, + { + "key": "db_database", + "value": "statping", + "enabled": true + }, + { + "key": "db_port", + "value": "5432", + "enabled": true + } + ], + "_postman_variable_scope": "environment", + "_postman_exported_at": "2020-05-18T20:44:05.571Z", + "_postman_exported_using": "Postman/7.24.0" +} diff --git a/dev/postman_env_sqlite.json b/dev/postman_env_sqlite.json new file mode 100644 index 00000000..fcde08b5 --- /dev/null +++ b/dev/postman_env_sqlite.json @@ -0,0 +1,49 @@ +{ + "id": "0ff1dcd6-54f3-44a7-9c18-cc3c8e7df357", + "name": "Local Statping", + "values": [ + { + "key": "endpoint", + "value": "http://0.0.0.0:8585", + "enabled": true + }, + { + "key": "api_key", + "value": "demosecret123", + "enabled": true + }, + { + "key": "db_connection", + "value": "sqlite", + "enabled": true + }, + { + "key": "db_host", + "value": "localhost", + "enabled": true + }, + { + "key": "db_user", + "value": "root", + "enabled": true + }, + { + "key": "db_password", + "value": "password123", + "enabled": true + }, + { + "key": "db_database", + "value": "statping", + "enabled": true + }, + { + "key": "db_port", + "value": "3306", + "enabled": true + } + ], + "_postman_variable_scope": "environment", + "_postman_exported_at": "2020-05-18T20:44:05.571Z", + "_postman_exported_using": "Postman/7.24.0" +} diff --git a/dev/postman_environment.json b/dev/postman_environment.json deleted file mode 100644 index ad4333ca..00000000 --- a/dev/postman_environment.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "id": "0ff1dcd6-54f3-44a7-9c18-cc3c8e7df357", - "name": "Local Statping", - "values": [ - { - "key": "endpoint", - "value": "http://127.0.0.1:8080", - "description": "", - "enabled": true - }, - { - "key": "api_key", - "value": "demosecret123", - "description": "", - "enabled": true - } - ], - "_postman_variable_scope": "environment", - "_postman_exported_at": "2018-11-17T16:55:15.031Z", - "_postman_exported_using": "Postman/6.5.2" -}