From 3f2ba91da254687123e1e052ffc66065d2d03d38 Mon Sep 17 00:00:00 2001 From: Derric Gilling Date: Wed, 10 Apr 2024 21:02:46 -0700 Subject: [PATCH] #187408819 Add: Request Payload to Code Templates https://www.pivotaltracker.com/story/show/187408819 The Code templates were all missing the request payload. Add to improve customer experience. Also, cleanup some template items --- .../management-api/_management-api.md | 22462 ++++++++++------ source/index.html.md | 2 +- source/openapi/management-api.json | 5025 ++-- 3 files changed, 16921 insertions(+), 10568 deletions(-) diff --git a/source/includes/management-api/_management-api.md b/source/includes/management-api/_management-api.md index baad5c2..3842ce2 100644 --- a/source/includes/management-api/_management-api.md +++ b/source/includes/management-api/_management-api.md @@ -66,34 +66,49 @@ If you're using the [Moesif secure proxy](https://www.moesif.com/docs/platform/s |create:eth_abi|Create/upload new Ethereum ABI Entries| |delete:users|Delete existing users and associated user metadata| -

Governance

+

Companies

-## createGovernanceRule +## updateCompanies - + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/~/governance/rules \ +curl -X POST https://api.moesif.com/v1/search/~/companies \ + -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + -d '{ + "company_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "session_token": "string", + "company_domain": "string", + "metadata": {} +}' ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = { + "company_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "session_token": "string", + "company_domain": "string", + "metadata": {} +}; const headers = { + 'Content-Type':'application/json', 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/governance/rules', +fetch('https://api.moesif.com/v1/search/~/companies', { method: 'POST', - + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -107,11 +122,19 @@ fetch('https://api.moesif.com/v1/~/governance/rules', ```python import requests headers = { + 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = { + "company_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "session_token": "string", + "company_domain": "string", + "metadata": {} +} -r = requests.post('https://api.moesif.com/v1/~/governance/rules', headers = headers) +r = requests.post('https://api.moesif.com/v1/search/~/companies', headers = headers, json = input_data) print(r.json()) @@ -122,13 +145,24 @@ require 'rest-client' require 'json' headers = { + 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/~/governance/rules', +input_payload = JSON.parse('{ + "company_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "session_token": "string", + "company_domain": "string", + "metadata": {} +}') + +result = RestClient.post 'https://api.moesif.com/v1/search/~/companies', params: { - }, headers: headers + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -140,19 +174,25 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('{ + "company_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "session_token": "string", + "company_domain": "string", + "metadata": {} +}') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('POST','https://api.moesif.com/v1/~/governance/rules', array( + $response = $client->request('POST','https://api.moesif.com/v1/search/~/companies', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -177,12 +217,19 @@ import ( func main() { headers := map[string][]string{ + "Content-Type": []string{"application/json"}, "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/governance/rules", data) + jsonPayload := `{ + "company_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "session_token": "string", + "company_domain": "string", + "metadata": {} +}` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/companies", data) req.Header = headers client := &http.Client{} @@ -220,15 +267,23 @@ public class HttpExample /// Make a dummy request public async Task MakePostRequest() { - string url = "https://api.moesif.com/v1/~/governance/rules"; + string url = "https://api.moesif.com/v1/search/~/companies"; + string json = @"{ + ""company_id"": ""string"", + ""modified_time"": ""2024-04-11T04:01:35.090Z"", + ""session_token"": ""string"", + ""company_domain"": ""string"", + ""metadata"": {} +}"; + var content = JsonConvert.DeserializeObject(json); + await PostAsync(content, url); - await PostAsync(null, url); } /// Performs a POST Request - public async Task PostAsync(undefined content, string url) + public async Task PostAsync(CompanyUpdate content, string url) { //Serialize Object StringContent jsonContent = SerializeObject(content); @@ -240,7 +295,7 @@ public class HttpExample /// Serialize an object to Json - private StringContent SerializeObject(undefined content) + private StringContent SerializeObject(CompanyUpdate content) { //Serialize Object string jsonObject = JsonConvert.SerializeObject(content); @@ -263,12 +318,33 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/governance/rules"); +URL obj = new URL("https://api.moesif.com/v1/search/~/companies"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """{ + "company_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "session_token": "string", + "company_domain": "string", + "metadata": {} +}"""; + +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -279,109 +355,90 @@ System.out.println(response.toString()); ``` -`POST /~/governance/rules` - -*Create New Governance Rules* - -

Parameters

+`POST /search/~/companies` -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|body|body|[GovernanceRuleCreateItem](#schemagovernancerulecreateitem)|false|none| +*Update a Company* -> Example responses +> `POST https://api.moesif.com/v1/search/~/companies` -> 201 Response +> Example Request ```json { - "name": "string", - "priority": 0, - "model": "string", - "state": 0, - "cohorts": [ - {} - ], - "_id": "string", - "variables": [ - { - "name": "string", - "path": "string" - } - ], - "applied_to": "string", - "block": true, - "response": { - "status": 0, - "headers": null, - "body": {}, - "original_encoded_body": "string" - }, - "applied_to_unidentified": true, - "regex_config": [ - { - "conditions": [ - { - "path": "string", - "value": "string" - } - ], - "sample_rate": 0 - } - ], - "created_at": "2019-08-24T14:15:22Z", - "app_id": "string", - "plans": [ - { - "provider": "string", - "plan_id": "string", - "price_ids": [ - "string" - ] - } - ], - "type": "string", - "org_id": "string" + "company_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "session_token": "string", + "company_domain": "string", + "metadata": {} } ``` -

Responses

+

Parameters

+ +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|body|body|[CompanyUpdate](#schemacompanyupdatedto)|true|none| + +> Example responses + +

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|[GovernanceRulesDocument](#schemagovernancerulesdocument)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| + +

Response Schema

-## getGovernanceRules +## batchUpdateCompanies - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/~/governance/rules \ +curl -X POST https://api.moesif.com/v1/search/~/companies/batch \ + -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + -d '[ + { + "company_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "session_token": "string", + "company_domain": "string", + "metadata": {} + } +]' ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = [ + { + "company_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "session_token": "string", + "company_domain": "string", + "metadata": {} + } +]; const headers = { + 'Content-Type':'application/json', 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/governance/rules', +fetch('https://api.moesif.com/v1/search/~/companies/batch', { - method: 'GET', - + method: 'POST', + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -395,11 +452,21 @@ fetch('https://api.moesif.com/v1/~/governance/rules', ```python import requests headers = { + 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = [ + { + "company_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "session_token": "string", + "company_domain": "string", + "metadata": {} + } +] -r = requests.get('https://api.moesif.com/v1/~/governance/rules', headers = headers) +r = requests.post('https://api.moesif.com/v1/search/~/companies/batch', headers = headers, json = input_data) print(r.json()) @@ -410,13 +477,26 @@ require 'rest-client' require 'json' headers = { + 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/~/governance/rules', +input_payload = JSON.parse('[ + { + "company_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "session_token": "string", + "company_domain": "string", + "metadata": {} + } +]') + +result = RestClient.post 'https://api.moesif.com/v1/search/~/companies/batch', params: { - }, headers: headers + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -428,19 +508,27 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('[ + { + "company_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "session_token": "string", + "company_domain": "string", + "metadata": {} + } +]') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('GET','https://api.moesif.com/v1/~/governance/rules', array( + $response = $client->request('POST','https://api.moesif.com/v1/search/~/companies/batch', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -465,12 +553,21 @@ import ( func main() { headers := map[string][]string{ + "Content-Type": []string{"application/json"}, "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/governance/rules", data) + jsonPayload := `[ + { + "company_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "session_token": "string", + "company_domain": "string", + "metadata": {} + } +]` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/companies/batch", data) req.Header = headers client := &http.Client{} @@ -504,26 +601,48 @@ public class HttpExample Client = new HttpClient(); } + /// Make a dummy request - public async Task MakeGetRequest() + public async Task MakePostRequest() { - string url = "https://api.moesif.com/v1/~/governance/rules"; - var result = await GetAsync(url); + string url = "https://api.moesif.com/v1/search/~/companies/batch"; + + string json = @"[ + { + ""company_id"": ""string"", + ""modified_time"": ""2024-04-11T04:01:35.090Z"", + ""session_token"": ""string"", + ""company_domain"": ""string"", + ""metadata"": {} + } +]"; + var content = JsonConvert.DeserializeObject(json); + await PostAsync(content, url); + + } - /// Performs a GET Request - public async Task GetAsync(string url) + /// Performs a POST Request + public async Task PostAsync(CompanyUpdate content, string url) { - //Start the request - HttpResponseMessage response = await Client.GetAsync(url); - - //Validate result - response.EnsureSuccessStatusCode(); + //Serialize Object + StringContent jsonContent = SerializeObject(content); + //Execute POST request + HttpResponseMessage response = await Client.PostAsync(url, jsonContent); } + /// Serialize an object to Json + private StringContent SerializeObject(CompanyUpdate content) + { + //Serialize Object + string jsonObject = JsonConvert.SerializeObject(content); + + //Create Json UTF8 String Content + return new StringContent(jsonObject, Encoding.UTF8, "application/json"); + } /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) @@ -539,12 +658,35 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/governance/rules"); +URL obj = new URL("https://api.moesif.com/v1/search/~/companies/batch"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("GET"); +con.setRequestMethod("POST"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """[ + { + "company_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "session_token": "string", + "company_domain": "string", + "metadata": {} + } +]"""; + +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -555,91 +697,56 @@ System.out.println(response.toString()); ``` -`GET /~/governance/rules` +`POST /search/~/companies/batch` -*Get Governance Rules* +*Update Companies in Batch* -

Parameters

+> `POST https://api.moesif.com/v1/search/~/companies/batch` + +> Example Request + +```json +[ + { + "company_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "session_token": "string", + "company_domain": "string", + "metadata": {} + } +] +``` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| +|body|body|[CompanyUpdate](#schemacompanyupdatedto)|true|none| > Example responses -> 200 Response - -```json -{ - "name": "string", - "priority": 0, - "model": "string", - "state": 0, - "cohorts": [ - {} - ], - "_id": "string", - "variables": [ - { - "name": "string", - "path": "string" - } - ], - "applied_to": "string", - "block": true, - "response": { - "status": 0, - "headers": null, - "body": {}, - "original_encoded_body": "string" - }, - "applied_to_unidentified": true, - "regex_config": [ - { - "conditions": [ - { - "path": "string", - "value": "string" - } - ], - "sample_rate": 0 - } - ], - "created_at": "2019-08-24T14:15:22Z", - "app_id": "string", - "plans": [ - { - "provider": "string", - "plan_id": "string", - "price_ids": [ - "string" - ] - } - ], - "type": "string", - "org_id": "string" -} -``` - -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[GovernanceRulesDocument](#schemagovernancerulesdocument)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| + +

Response Schema

-## updateGovernanceRule +## getCompany - + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/~/governance/rules/{id} \ +curl -X GET https://api.moesif.com/v1/search/~/companies/{id} \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' @@ -653,9 +760,9 @@ const headers = { 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/governance/rules/{id}', +fetch('https://api.moesif.com/v1/search/~/companies/{id}', { - method: 'POST', + method: 'GET', headers: headers }) @@ -674,7 +781,7 @@ headers = { 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.post('https://api.moesif.com/v1/~/governance/rules/{id}', headers = headers) +r = requests.get('https://api.moesif.com/v1/search/~/companies/{id}', headers = headers) print(r.json()) @@ -689,9 +796,10 @@ headers = { 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/~/governance/rules/{id}', +result = RestClient.get 'https://api.moesif.com/v1/search/~/companies/{id}', params: { - }, headers: headers + }, + headers: headers p JSON.parse(result) @@ -709,13 +817,9 @@ $headers = array( $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('POST','https://api.moesif.com/v1/~/governance/rules/{id}', array( + $response = $client->request('GET','https://api.moesif.com/v1/search/~/companies/{id}', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -743,9 +847,9 @@ func main() { "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/governance/rules/{id}", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/search/~/companies/{id}") req.Header = headers client := &http.Client{} @@ -779,38 +883,26 @@ public class HttpExample Client = new HttpClient(); } - /// Make a dummy request - public async Task MakePostRequest() + public async Task MakeGetRequest() { - string url = "https://api.moesif.com/v1/~/governance/rules/{id}"; - - - await PostAsync(null, url); - + string url = "https://api.moesif.com/v1/search/~/companies/{id}"; + var result = await GetAsync(url); } - /// Performs a POST Request - public async Task PostAsync(undefined content, string url) + /// Performs a GET Request + public async Task GetAsync(string url) { - //Serialize Object - StringContent jsonContent = SerializeObject(content); + //Start the request + HttpResponseMessage response = await Client.GetAsync(url); + + //Validate result + response.EnsureSuccessStatusCode(); - //Execute POST request - HttpResponseMessage response = await Client.PostAsync(url, jsonContent); } - /// Serialize an object to Json - private StringContent SerializeObject(undefined content) - { - //Serialize Object - string jsonObject = JsonConvert.SerializeObject(content); - - //Create Json UTF8 String Content - return new StringContent(jsonObject, Encoding.UTF8, "application/json"); - } /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) @@ -826,12 +918,15 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/governance/rules/{id}"); +URL obj = new URL("https://api.moesif.com/v1/search/~/companies/{id}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("POST"); +con.setRequestMethod("GET"); + +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -842,94 +937,42 @@ System.out.println(response.toString()); ``` -`POST /~/governance/rules/{id}` +`GET /search/~/companies/{id}` -*Update a Governance Rule* +*Get a Company* -

Parameters

+> `GET https://api.moesif.com/v1/search/~/companies/{id}` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| |id|path|string|true|none| -|body|body|[GovernanceRuleUpdateItem](#schemagovernanceruleupdateitem)|false|none| > Example responses -> 201 Response - -```json -{ - "name": "string", - "priority": 0, - "model": "string", - "state": 0, - "cohorts": [ - {} - ], - "_id": "string", - "variables": [ - { - "name": "string", - "path": "string" - } - ], - "applied_to": "string", - "block": true, - "response": { - "status": 0, - "headers": null, - "body": {}, - "original_encoded_body": "string" - }, - "applied_to_unidentified": true, - "regex_config": [ - { - "conditions": [ - { - "path": "string", - "value": "string" - } - ], - "sample_rate": 0 - } - ], - "created_at": "2019-08-24T14:15:22Z", - "app_id": "string", - "plans": [ - { - "provider": "string", - "plan_id": "string", - "price_ids": [ - "string" - ] - } - ], - "type": "string", - "org_id": "string" -} -``` - -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|[GovernanceRulesDocument](#schemagovernancerulesdocument)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| + +

Response Schema

-## getGovernanceRule +## deleteCompany - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/~/governance/rules/{id} \ - -H 'Accept: application/json' \ +curl -X DELETE https://api.moesif.com/v1/search/~/companies/{id} \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -938,13 +981,12 @@ curl -X GET https://api.moesif.com/v1/~/governance/rules/{id} \ const fetch = require('node-fetch'); const headers = { - 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/governance/rules/{id}', +fetch('https://api.moesif.com/v1/search/~/companies/{id}', { - method: 'GET', + method: 'DELETE', headers: headers }) @@ -959,11 +1001,10 @@ fetch('https://api.moesif.com/v1/~/governance/rules/{id}', ```python import requests headers = { - 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.get('https://api.moesif.com/v1/~/governance/rules/{id}', headers = headers) +r = requests.delete('https://api.moesif.com/v1/search/~/companies/{id}', headers = headers) print(r.json()) @@ -974,13 +1015,13 @@ require 'rest-client' require 'json' headers = { - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/~/governance/rules/{id}', +result = RestClient.delete 'https://api.moesif.com/v1/search/~/companies/{id}', params: { - }, headers: headers + }, + headers: headers p JSON.parse(result) @@ -992,19 +1033,14 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('GET','https://api.moesif.com/v1/~/governance/rules/{id}', array( + $response = $client->request('DELETE','https://api.moesif.com/v1/search/~/companies/{id}', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -1029,12 +1065,11 @@ import ( func main() { headers := map[string][]string{ - "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/governance/rules/{id}", data) + + + req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/search/~/companies/{id}") req.Header = headers client := &http.Client{} @@ -1068,27 +1103,28 @@ public class HttpExample Client = new HttpClient(); } + + + /// Make a dummy request - public async Task MakeGetRequest() + public async Task MakeDeleteRequest() { - string url = "https://api.moesif.com/v1/~/governance/rules/{id}"; - var result = await GetAsync(url); + int id = 1; + string url = "https://api.moesif.com/v1/search/~/companies/{id}"; + + await DeleteAsync(id, url); } - /// Performs a GET Request - public async Task GetAsync(string url) + /// Performs a DELETE Request + public async Task DeleteAsync(int id, string url) { - //Start the request - HttpResponseMessage response = await Client.GetAsync(url); - - //Validate result - response.EnsureSuccessStatusCode(); + //Execute DELETE request + HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); + //Return response + await DeserializeObject(response); } - - - /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) { @@ -1103,12 +1139,14 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/governance/rules/{id}"); +URL obj = new URL("https://api.moesif.com/v1/search/~/companies/{id}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("GET"); +con.setRequestMethod("DELETE"); + +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -1119,107 +1157,59 @@ System.out.println(response.toString()); ``` -`GET /~/governance/rules/{id}` +`DELETE /search/~/companies/{id}` -*Get a Governance Rule* +*Delete a Company* -

Parameters

+> `DELETE https://api.moesif.com/v1/search/~/companies/{id}` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| |id|path|string|true|none| +|delete_events|query|boolean|false|Delete events associated with the company which can be set to true or false(default)| -> Example responses +

Responses

-> 200 Response - -```json -{ - "name": "string", - "priority": 0, - "model": "string", - "state": 0, - "cohorts": [ - {} - ], - "_id": "string", - "variables": [ - { - "name": "string", - "path": "string" - } - ], - "applied_to": "string", - "block": true, - "response": { - "status": 0, - "headers": null, - "body": {}, - "original_encoded_body": "string" - }, - "applied_to_unidentified": true, - "regex_config": [ - { - "conditions": [ - { - "path": "string", - "value": "string" - } - ], - "sample_rate": 0 - } - ], - "created_at": "2019-08-24T14:15:22Z", - "app_id": "string", - "plans": [ - { - "provider": "string", - "plan_id": "string", - "price_ids": [ - "string" - ] - } - ], - "type": "string", - "org_id": "string" -} -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[GovernanceRulesDocument](#schemagovernancerulesdocument)| +|Status|Meaning|Description|Schema| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| -## deleteGovernanceRule +## countCompanies - + > Code samples ```shell # You can also use wget -curl -X DELETE https://api.moesif.com/v1/~/governance/rules/{id} \ +curl -X POST https://api.moesif.com/v1/search/~/count/companies?app_id=string \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = false; const headers = { + 'Content-Type':'application/json', + 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/governance/rules/{id}', +fetch('https://api.moesif.com/v1/search/~/count/companies?app_id=string', { - method: 'DELETE', - + method: 'POST', + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -1233,10 +1223,16 @@ fetch('https://api.moesif.com/v1/~/governance/rules/{id}', ```python import requests headers = { + 'Content-Type': 'application/json', + 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = false -r = requests.delete('https://api.moesif.com/v1/~/governance/rules/{id}', headers = headers) +r = requests.post('https://api.moesif.com/v1/search/~/count/companies', params={ + 'app_id': 'string' + +}, headers = headers, json = input_data) print(r.json()) @@ -1247,12 +1243,19 @@ require 'rest-client' require 'json' headers = { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.delete 'https://api.moesif.com/v1/~/governance/rules/{id}', +input_payload = JSON.parse('false') + +result = RestClient.post 'https://api.moesif.com/v1/search/~/count/companies', params: { - }, headers: headers + 'app_id' => 'string' + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -1264,18 +1267,19 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Content-Type' => 'application/json', + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('false') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('DELETE','https://api.moesif.com/v1/~/governance/rules/{id}', array( + $response = $client->request('POST','https://api.moesif.com/v1/search/~/count/companies', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -1300,11 +1304,13 @@ import ( func main() { headers := map[string][]string{ + "Content-Type": []string{"application/json"}, + "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/governance/rules/{id}", data) + jsonPayload := `false` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/count/companies", data) req.Header = headers client := &http.Client{} @@ -1339,25 +1345,36 @@ public class HttpExample } - - /// Make a dummy request - public async Task MakeDeleteRequest() + public async Task MakePostRequest() { - int id = 1; - string url = "https://api.moesif.com/v1/~/governance/rules/{id}"; - - await DeleteAsync(id, url); + string url = "https://api.moesif.com/v1/search/~/count/companies"; + + + await PostAsync(null, url); + } - /// Performs a DELETE Request - public async Task DeleteAsync(int id, string url) + /// Performs a POST Request + public async Task PostAsync(undefined content, string url) { - //Execute DELETE request - HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); + //Serialize Object + StringContent jsonContent = SerializeObject(content); - //Return response - await DeserializeObject(response); + //Execute POST request + HttpResponseMessage response = await Client.PostAsync(url, jsonContent); + } + + + + /// Serialize an object to Json + private StringContent SerializeObject(undefined content) + { + //Serialize Object + string jsonObject = JsonConvert.SerializeObject(content); + + //Create Json UTF8 String Content + return new StringContent(jsonObject, Encoding.UTF8, "application/json"); } /// Deserialize object from request response @@ -1374,12 +1391,27 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/governance/rules/{id}"); +URL obj = new URL("https://api.moesif.com/v1/search/~/count/companies?app_id=string"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("DELETE"); +con.setRequestMethod("POST"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """false"""; + +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -1390,53 +1422,71 @@ System.out.println(response.toString()); ``` -`DELETE /~/governance/rules/{id}` +`POST /search/~/count/companies` -*Delete a Governance Rule* +*Count Companies* -

Parameters

+> `POST https://api.moesif.com/v1/search/~/count/companies` + +> Example Request + +```json +false +``` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|id|path|string|true|none| -

Responses

+> Example responses + +

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|204|[No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5)|success|None| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| + +

Response Schema

-

Dashboards

+## searchCompanyMetrics -## updateDashboard + - + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/~/dashboards/{dashId} \ +curl -X POST https://api.moesif.com/v1/search/~/search/companymetrics/companies \ + -H 'Content-Type: application/json' \ + -H 'Accept: 0' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = false; const headers = { + 'Content-Type':'application/json', + 'Accept':'0', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/dashboards/{dashId}', +fetch('https://api.moesif.com/v1/search/~/search/companymetrics/companies', { method: 'POST', - + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -1450,10 +1500,13 @@ fetch('https://api.moesif.com/v1/~/dashboards/{dashId}', ```python import requests headers = { + 'Content-Type': 'application/json', + 'Accept': '0', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = false -r = requests.post('https://api.moesif.com/v1/~/dashboards/{dashId}', headers = headers) +r = requests.post('https://api.moesif.com/v1/search/~/search/companymetrics/companies', headers = headers, json = input_data) print(r.json()) @@ -1464,12 +1517,18 @@ require 'rest-client' require 'json' headers = { + 'Content-Type' => 'application/json', + 'Accept' => '0', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/~/dashboards/{dashId}', +input_payload = JSON.parse('false') + +result = RestClient.post 'https://api.moesif.com/v1/search/~/search/companymetrics/companies', params: { - }, headers: headers + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -1481,18 +1540,19 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Content-Type' => 'application/json', + 'Accept' => '0', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('false') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('POST','https://api.moesif.com/v1/~/dashboards/{dashId}', array( + $response = $client->request('POST','https://api.moesif.com/v1/search/~/search/companymetrics/companies', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -1517,11 +1577,13 @@ import ( func main() { headers := map[string][]string{ + "Content-Type": []string{"application/json"}, + "Accept": []string{"0"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/dashboards/{dashId}", data) + jsonPayload := `false` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/search/companymetrics/companies", data) req.Header = headers client := &http.Client{} @@ -1559,7 +1621,7 @@ public class HttpExample /// Make a dummy request public async Task MakePostRequest() { - string url = "https://api.moesif.com/v1/~/dashboards/{dashId}"; + string url = "https://api.moesif.com/v1/search/~/search/companymetrics/companies"; await PostAsync(null, url); @@ -1602,12 +1664,27 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/dashboards/{dashId}"); +URL obj = new URL("https://api.moesif.com/v1/search/~/search/companymetrics/companies"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Accept",'0'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """false"""; + +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -1618,36 +1695,52 @@ System.out.println(response.toString()); ``` -`POST /~/dashboards/{dashId}` +`POST /search/~/search/companymetrics/companies` -*Update a Dashboard* +*Search CompanyMetrics/Companies* -

Parameters

+> `POST https://api.moesif.com/v1/search/~/search/companymetrics/companies` + +> Example Request + +```json +false +``` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|dashId|path|string|true|none| +|from|query|string(date-time)|false|The start date, which can be absolute such as 2023-07-01T00:00:00Z or relative such as -24h| +|to|query|string(date-time)|false|The end date, which can be absolute such as 2023-07-02T00:00:00Z or relative such as now| -

Responses

+> Example responses + +

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|None| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| + +

Response Schema

-## deleteDashboard +

Subscriptions

- +## getCompanySubscriptions + + > Code samples ```shell # You can also use wget -curl -X DELETE https://api.moesif.com/v1/~/dashboards/{dashId} \ +curl -X GET https://api.moesif.com/v1/search/~/companies/{id}/subscriptions \ + -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -1656,12 +1749,13 @@ curl -X DELETE https://api.moesif.com/v1/~/dashboards/{dashId} \ const fetch = require('node-fetch'); const headers = { + 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/dashboards/{dashId}', +fetch('https://api.moesif.com/v1/search/~/companies/{id}/subscriptions', { - method: 'DELETE', + method: 'GET', headers: headers }) @@ -1676,10 +1770,11 @@ fetch('https://api.moesif.com/v1/~/dashboards/{dashId}', ```python import requests headers = { + 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.delete('https://api.moesif.com/v1/~/dashboards/{dashId}', headers = headers) +r = requests.get('https://api.moesif.com/v1/search/~/companies/{id}/subscriptions', headers = headers) print(r.json()) @@ -1690,12 +1785,14 @@ require 'rest-client' require 'json' headers = { + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.delete 'https://api.moesif.com/v1/~/dashboards/{dashId}', +result = RestClient.get 'https://api.moesif.com/v1/search/~/companies/{id}/subscriptions', params: { - }, headers: headers + }, + headers: headers p JSON.parse(result) @@ -1707,18 +1804,15 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('DELETE','https://api.moesif.com/v1/~/dashboards/{dashId}', array( + $response = $client->request('GET','https://api.moesif.com/v1/search/~/companies/{id}/subscriptions', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -1743,11 +1837,12 @@ import ( func main() { headers := map[string][]string{ + "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/dashboards/{dashId}", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/search/~/companies/{id}/subscriptions") req.Header = headers client := &http.Client{} @@ -1781,28 +1876,27 @@ public class HttpExample Client = new HttpClient(); } - - - /// Make a dummy request - public async Task MakeDeleteRequest() + public async Task MakeGetRequest() { - int id = 1; - string url = "https://api.moesif.com/v1/~/dashboards/{dashId}"; - - await DeleteAsync(id, url); + string url = "https://api.moesif.com/v1/search/~/companies/{id}/subscriptions"; + var result = await GetAsync(url); } - /// Performs a DELETE Request - public async Task DeleteAsync(int id, string url) + /// Performs a GET Request + public async Task GetAsync(string url) { - //Execute DELETE request - HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); + //Start the request + HttpResponseMessage response = await Client.GetAsync(url); + + //Validate result + response.EnsureSuccessStatusCode(); - //Return response - await DeserializeObject(response); } + + + /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) { @@ -1817,12 +1911,15 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/dashboards/{dashId}"); +URL obj = new URL("https://api.moesif.com/v1/search/~/companies/{id}/subscriptions"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("DELETE"); +con.setRequestMethod("GET"); + +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -1833,51 +1930,120 @@ System.out.println(response.toString()); ``` -`DELETE /~/dashboards/{dashId}` +`GET /search/~/companies/{id}/subscriptions` -*Delete a Dashboard* +*Get the Subscriptions of a Company* -

Parameters

+> `GET https://api.moesif.com/v1/search/~/companies/{id}/subscriptions` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|dashId|path|string|true|none| +|id|path|string|true|none| -

Responses

+> Example responses + +

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| +

Response Schema

+ -## cascadeDeleteDashboard +## createSubscription - + > Code samples ```shell # You can also use wget -curl -X DELETE https://api.moesif.com/v1/~/dashboards/{dashId}/cascade \ +curl -X POST https://api.moesif.com/v1/search/~/subscriptions \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + -d '{ + "trial_start": "2024-04-11T04:01:35.090Z", + "company_id": "string", + "start_date": "2024-04-11T04:01:35.090Z", + "collection_method": "string", + "provider": "string", + "items": [ + { + "item_price_id": "string", + "price_id": "string", + "is_metered": true, + "plan_id": "string", + "unit_of_measure": "string", + "status": "string", + "subscription_item_id": "string" + } + ], + "current_period_start": "2024-04-11T04:01:35.090Z", + "company_external_id": "string", + "payment_status": "string", + "cancel_time": "2024-04-11T04:01:35.090Z", + "status": "string", + "trial_end": "2024-04-11T04:01:35.090Z", + "external_id": "string", + "metadata": {}, + "subscription_id": "string", + "version_id": "string", + "current_period_end": "2024-04-11T04:01:35.090Z", + "created": "2024-04-11T04:01:35.090Z" +}' ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = { + "trial_start": "2024-04-11T04:01:35.090Z", + "company_id": "string", + "start_date": "2024-04-11T04:01:35.090Z", + "collection_method": "string", + "provider": "string", + "items": [ + { + "item_price_id": "string", + "price_id": "string", + "is_metered": true, + "plan_id": "string", + "unit_of_measure": "string", + "status": "string", + "subscription_item_id": "string" + } + ], + "current_period_start": "2024-04-11T04:01:35.090Z", + "company_external_id": "string", + "payment_status": "string", + "cancel_time": "2024-04-11T04:01:35.090Z", + "status": "string", + "trial_end": "2024-04-11T04:01:35.090Z", + "external_id": "string", + "metadata": {}, + "subscription_id": "string", + "version_id": "string", + "current_period_end": "2024-04-11T04:01:35.090Z", + "created": "2024-04-11T04:01:35.090Z" +}; const headers = { + 'Content-Type':'application/json', + 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/dashboards/{dashId}/cascade', +fetch('https://api.moesif.com/v1/search/~/subscriptions', { - method: 'DELETE', - + method: 'POST', + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -1891,10 +2057,42 @@ fetch('https://api.moesif.com/v1/~/dashboards/{dashId}/cascade', ```python import requests headers = { + 'Content-Type': 'application/json', + 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = { + "trial_start": "2024-04-11T04:01:35.090Z", + "company_id": "string", + "start_date": "2024-04-11T04:01:35.090Z", + "collection_method": "string", + "provider": "string", + "items": [ + { + "item_price_id": "string", + "price_id": "string", + "is_metered": true, + "plan_id": "string", + "unit_of_measure": "string", + "status": "string", + "subscription_item_id": "string" + } + ], + "current_period_start": "2024-04-11T04:01:35.090Z", + "company_external_id": "string", + "payment_status": "string", + "cancel_time": "2024-04-11T04:01:35.090Z", + "status": "string", + "trial_end": "2024-04-11T04:01:35.090Z", + "external_id": "string", + "metadata": {}, + "subscription_id": "string", + "version_id": "string", + "current_period_end": "2024-04-11T04:01:35.090Z", + "created": "2024-04-11T04:01:35.090Z" +} -r = requests.delete('https://api.moesif.com/v1/~/dashboards/{dashId}/cascade', headers = headers) +r = requests.post('https://api.moesif.com/v1/search/~/subscriptions', headers = headers, json = input_data) print(r.json()) @@ -1905,12 +2103,47 @@ require 'rest-client' require 'json' headers = { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.delete 'https://api.moesif.com/v1/~/dashboards/{dashId}/cascade', +input_payload = JSON.parse('{ + "trial_start": "2024-04-11T04:01:35.090Z", + "company_id": "string", + "start_date": "2024-04-11T04:01:35.090Z", + "collection_method": "string", + "provider": "string", + "items": [ + { + "item_price_id": "string", + "price_id": "string", + "is_metered": true, + "plan_id": "string", + "unit_of_measure": "string", + "status": "string", + "subscription_item_id": "string" + } + ], + "current_period_start": "2024-04-11T04:01:35.090Z", + "company_external_id": "string", + "payment_status": "string", + "cancel_time": "2024-04-11T04:01:35.090Z", + "status": "string", + "trial_end": "2024-04-11T04:01:35.090Z", + "external_id": "string", + "metadata": {}, + "subscription_id": "string", + "version_id": "string", + "current_period_end": "2024-04-11T04:01:35.090Z", + "created": "2024-04-11T04:01:35.090Z" +}') + +result = RestClient.post 'https://api.moesif.com/v1/search/~/subscriptions', params: { - }, headers: headers + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -1922,18 +2155,48 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Content-Type' => 'application/json', + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('{ + "trial_start": "2024-04-11T04:01:35.090Z", + "company_id": "string", + "start_date": "2024-04-11T04:01:35.090Z", + "collection_method": "string", + "provider": "string", + "items": [ + { + "item_price_id": "string", + "price_id": "string", + "is_metered": true, + "plan_id": "string", + "unit_of_measure": "string", + "status": "string", + "subscription_item_id": "string" + } + ], + "current_period_start": "2024-04-11T04:01:35.090Z", + "company_external_id": "string", + "payment_status": "string", + "cancel_time": "2024-04-11T04:01:35.090Z", + "status": "string", + "trial_end": "2024-04-11T04:01:35.090Z", + "external_id": "string", + "metadata": {}, + "subscription_id": "string", + "version_id": "string", + "current_period_end": "2024-04-11T04:01:35.090Z", + "created": "2024-04-11T04:01:35.090Z" +}') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('DELETE','https://api.moesif.com/v1/~/dashboards/{dashId}/cascade', array( + $response = $client->request('POST','https://api.moesif.com/v1/search/~/subscriptions', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -1958,11 +2221,42 @@ import ( func main() { headers := map[string][]string{ + "Content-Type": []string{"application/json"}, + "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/dashboards/{dashId}/cascade", data) + jsonPayload := `{ + "trial_start": "2024-04-11T04:01:35.090Z", + "company_id": "string", + "start_date": "2024-04-11T04:01:35.090Z", + "collection_method": "string", + "provider": "string", + "items": [ + { + "item_price_id": "string", + "price_id": "string", + "is_metered": true, + "plan_id": "string", + "unit_of_measure": "string", + "status": "string", + "subscription_item_id": "string" + } + ], + "current_period_start": "2024-04-11T04:01:35.090Z", + "company_external_id": "string", + "payment_status": "string", + "cancel_time": "2024-04-11T04:01:35.090Z", + "status": "string", + "trial_end": "2024-04-11T04:01:35.090Z", + "external_id": "string", + "metadata": {}, + "subscription_id": "string", + "version_id": "string", + "current_period_end": "2024-04-11T04:01:35.090Z", + "created": "2024-04-11T04:01:35.090Z" +}` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/subscriptions", data) req.Header = headers client := &http.Client{} @@ -1997,25 +2291,67 @@ public class HttpExample } - - /// Make a dummy request - public async Task MakeDeleteRequest() + public async Task MakePostRequest() { - int id = 1; - string url = "https://api.moesif.com/v1/~/dashboards/{dashId}/cascade"; - - await DeleteAsync(id, url); + string url = "https://api.moesif.com/v1/search/~/subscriptions"; + + string json = @"{ + ""trial_start"": ""2024-04-11T04:01:35.090Z"", + ""company_id"": ""string"", + ""start_date"": ""2024-04-11T04:01:35.090Z"", + ""collection_method"": ""string"", + ""provider"": ""string"", + ""items"": [ + { + ""item_price_id"": ""string"", + ""price_id"": ""string"", + ""is_metered"": true, + ""plan_id"": ""string"", + ""unit_of_measure"": ""string"", + ""status"": ""string"", + ""subscription_item_id"": ""string"" + } + ], + ""current_period_start"": ""2024-04-11T04:01:35.090Z"", + ""company_external_id"": ""string"", + ""payment_status"": ""string"", + ""cancel_time"": ""2024-04-11T04:01:35.090Z"", + ""status"": ""string"", + ""trial_end"": ""2024-04-11T04:01:35.090Z"", + ""external_id"": ""string"", + ""metadata"": {}, + ""subscription_id"": ""string"", + ""version_id"": ""string"", + ""current_period_end"": ""2024-04-11T04:01:35.090Z"", + ""created"": ""2024-04-11T04:01:35.090Z"" +}"; + var content = JsonConvert.DeserializeObject(json); + await PostAsync(content, url); + + } - /// Performs a DELETE Request - public async Task DeleteAsync(int id, string url) + /// Performs a POST Request + public async Task PostAsync(AddSubscription content, string url) { - //Execute DELETE request - HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); + //Serialize Object + StringContent jsonContent = SerializeObject(content); - //Return response - await DeserializeObject(response); + //Execute POST request + HttpResponseMessage response = await Client.PostAsync(url, jsonContent); + } + + + + /// Serialize an object to Json + private StringContent SerializeObject(AddSubscription content) + { + //Serialize Object + string jsonObject = JsonConvert.SerializeObject(content); + + //Create Json UTF8 String Content + return new StringContent(jsonObject, Encoding.UTF8, "application/json"); } /// Deserialize object from request response @@ -2032,67 +2368,252 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/dashboards/{dashId}/cascade"); +URL obj = new URL("https://api.moesif.com/v1/search/~/subscriptions"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("DELETE"); -int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); -String inputLine; -StringBuffer response = new StringBuffer(); -while ((inputLine = in.readLine()) != null) { - response.append(inputLine); -} -in.close(); -System.out.println(response.toString()); - -``` - -`DELETE /~/dashboards/{dashId}/cascade` +con.setRequestMethod("POST"); -*Casccade delete a Dashboard* +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); -

Parameters

+// Enable sending a request body +con.setDoOutput(true); -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|dashId|path|string|true|none| +String jsonPayload = """{ + "trial_start": "2024-04-11T04:01:35.090Z", + "company_id": "string", + "start_date": "2024-04-11T04:01:35.090Z", + "collection_method": "string", + "provider": "string", + "items": [ + { + "item_price_id": "string", + "price_id": "string", + "is_metered": true, + "plan_id": "string", + "unit_of_measure": "string", + "status": "string", + "subscription_item_id": "string" + } + ], + "current_period_start": "2024-04-11T04:01:35.090Z", + "company_external_id": "string", + "payment_status": "string", + "cancel_time": "2024-04-11T04:01:35.090Z", + "status": "string", + "trial_end": "2024-04-11T04:01:35.090Z", + "external_id": "string", + "metadata": {}, + "subscription_id": "string", + "version_id": "string", + "current_period_end": "2024-04-11T04:01:35.090Z", + "created": "2024-04-11T04:01:35.090Z" +}"""; -

Responses

+// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} + +int responseCode = con.getResponseCode(); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); +String inputLine; +StringBuffer response = new StringBuffer(); +while ((inputLine = in.readLine()) != null) { + response.append(inputLine); +} +in.close(); +System.out.println(response.toString()); + +``` + +`POST /search/~/subscriptions` + +*Create or Update a Subscription* + +> `POST https://api.moesif.com/v1/search/~/subscriptions` + +> Example Request + +```json +{ + "trial_start": "2024-04-11T04:01:35.090Z", + "company_id": "string", + "start_date": "2024-04-11T04:01:35.090Z", + "collection_method": "string", + "provider": "string", + "items": [ + { + "item_price_id": "string", + "price_id": "string", + "is_metered": true, + "plan_id": "string", + "unit_of_measure": "string", + "status": "string", + "subscription_item_id": "string" + } + ], + "current_period_start": "2024-04-11T04:01:35.090Z", + "company_external_id": "string", + "payment_status": "string", + "cancel_time": "2024-04-11T04:01:35.090Z", + "status": "string", + "trial_end": "2024-04-11T04:01:35.090Z", + "external_id": "string", + "metadata": {}, + "subscription_id": "string", + "version_id": "string", + "current_period_end": "2024-04-11T04:01:35.090Z", + "created": "2024-04-11T04:01:35.090Z" +} +``` + +

Parameters

+ +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|body|body|[AddSubscription](#schemaaddsubscriptiondto)|true|none| + +> Example responses + +> 200 Response + +```json +{ + "trial_start": "2024-04-11T04:01:35.090Z", + "company_id": "string", + "start_date": "2024-04-11T04:01:35.090Z", + "collection_method": "string", + "provider": "string", + "items": [ + { + "item_price_id": "string", + "price_id": "string", + "is_metered": true, + "plan_id": "string", + "unit_of_measure": "string", + "status": "string", + "subscription_item_id": "string" + } + ], + "current_period_start": "2024-04-11T04:01:35.090Z", + "company_external_id": "string", + "payment_status": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "cancel_time": "2024-04-11T04:01:35.090Z", + "status": "string", + "trial_end": "2024-04-11T04:01:35.090Z", + "external_id": "string", + "metadata": {}, + "app_id": "string", + "subscription_id": "string", + "version_id": "string", + "type": "string", + "current_period_end": "2024-04-11T04:01:35.090Z", + "org_id": "string", + "created": "2024-04-11T04:01:35.090Z" +} +``` + +

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[Subscription](#schemasubscriptiondto)| -## deleteDashboards +## batchCreateSubscriptions - + > Code samples ```shell # You can also use wget -curl -X DELETE https://api.moesif.com/v1/~/dashboard/{dashId} \ +curl -X POST https://api.moesif.com/v1/search/~/subscriptions/batch \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + -d '{ + "trial_start": "2024-04-11T04:01:35.090Z", + "company_id": "string", + "start_date": "2024-04-11T04:01:35.090Z", + "collection_method": "string", + "provider": "string", + "items": [ + { + "item_price_id": "string", + "price_id": "string", + "is_metered": true, + "plan_id": "string", + "unit_of_measure": "string", + "status": "string", + "subscription_item_id": "string" + } + ], + "current_period_start": "2024-04-11T04:01:35.090Z", + "company_external_id": "string", + "payment_status": "string", + "cancel_time": "2024-04-11T04:01:35.090Z", + "status": "string", + "trial_end": "2024-04-11T04:01:35.090Z", + "external_id": "string", + "metadata": {}, + "subscription_id": "string", + "version_id": "string", + "current_period_end": "2024-04-11T04:01:35.090Z", + "created": "2024-04-11T04:01:35.090Z" +}' ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = { + "trial_start": "2024-04-11T04:01:35.090Z", + "company_id": "string", + "start_date": "2024-04-11T04:01:35.090Z", + "collection_method": "string", + "provider": "string", + "items": [ + { + "item_price_id": "string", + "price_id": "string", + "is_metered": true, + "plan_id": "string", + "unit_of_measure": "string", + "status": "string", + "subscription_item_id": "string" + } + ], + "current_period_start": "2024-04-11T04:01:35.090Z", + "company_external_id": "string", + "payment_status": "string", + "cancel_time": "2024-04-11T04:01:35.090Z", + "status": "string", + "trial_end": "2024-04-11T04:01:35.090Z", + "external_id": "string", + "metadata": {}, + "subscription_id": "string", + "version_id": "string", + "current_period_end": "2024-04-11T04:01:35.090Z", + "created": "2024-04-11T04:01:35.090Z" +}; const headers = { + 'Content-Type':'application/json', + 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/dashboard/{dashId}', +fetch('https://api.moesif.com/v1/search/~/subscriptions/batch', { - method: 'DELETE', - + method: 'POST', + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -2106,10 +2627,42 @@ fetch('https://api.moesif.com/v1/~/dashboard/{dashId}', ```python import requests headers = { + 'Content-Type': 'application/json', + 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = { + "trial_start": "2024-04-11T04:01:35.090Z", + "company_id": "string", + "start_date": "2024-04-11T04:01:35.090Z", + "collection_method": "string", + "provider": "string", + "items": [ + { + "item_price_id": "string", + "price_id": "string", + "is_metered": true, + "plan_id": "string", + "unit_of_measure": "string", + "status": "string", + "subscription_item_id": "string" + } + ], + "current_period_start": "2024-04-11T04:01:35.090Z", + "company_external_id": "string", + "payment_status": "string", + "cancel_time": "2024-04-11T04:01:35.090Z", + "status": "string", + "trial_end": "2024-04-11T04:01:35.090Z", + "external_id": "string", + "metadata": {}, + "subscription_id": "string", + "version_id": "string", + "current_period_end": "2024-04-11T04:01:35.090Z", + "created": "2024-04-11T04:01:35.090Z" +} -r = requests.delete('https://api.moesif.com/v1/~/dashboard/{dashId}', headers = headers) +r = requests.post('https://api.moesif.com/v1/search/~/subscriptions/batch', headers = headers, json = input_data) print(r.json()) @@ -2120,12 +2673,47 @@ require 'rest-client' require 'json' headers = { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.delete 'https://api.moesif.com/v1/~/dashboard/{dashId}', +input_payload = JSON.parse('{ + "trial_start": "2024-04-11T04:01:35.090Z", + "company_id": "string", + "start_date": "2024-04-11T04:01:35.090Z", + "collection_method": "string", + "provider": "string", + "items": [ + { + "item_price_id": "string", + "price_id": "string", + "is_metered": true, + "plan_id": "string", + "unit_of_measure": "string", + "status": "string", + "subscription_item_id": "string" + } + ], + "current_period_start": "2024-04-11T04:01:35.090Z", + "company_external_id": "string", + "payment_status": "string", + "cancel_time": "2024-04-11T04:01:35.090Z", + "status": "string", + "trial_end": "2024-04-11T04:01:35.090Z", + "external_id": "string", + "metadata": {}, + "subscription_id": "string", + "version_id": "string", + "current_period_end": "2024-04-11T04:01:35.090Z", + "created": "2024-04-11T04:01:35.090Z" +}') + +result = RestClient.post 'https://api.moesif.com/v1/search/~/subscriptions/batch', params: { - }, headers: headers + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -2137,18 +2725,48 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Content-Type' => 'application/json', + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('{ + "trial_start": "2024-04-11T04:01:35.090Z", + "company_id": "string", + "start_date": "2024-04-11T04:01:35.090Z", + "collection_method": "string", + "provider": "string", + "items": [ + { + "item_price_id": "string", + "price_id": "string", + "is_metered": true, + "plan_id": "string", + "unit_of_measure": "string", + "status": "string", + "subscription_item_id": "string" + } + ], + "current_period_start": "2024-04-11T04:01:35.090Z", + "company_external_id": "string", + "payment_status": "string", + "cancel_time": "2024-04-11T04:01:35.090Z", + "status": "string", + "trial_end": "2024-04-11T04:01:35.090Z", + "external_id": "string", + "metadata": {}, + "subscription_id": "string", + "version_id": "string", + "current_period_end": "2024-04-11T04:01:35.090Z", + "created": "2024-04-11T04:01:35.090Z" +}') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('DELETE','https://api.moesif.com/v1/~/dashboard/{dashId}', array( + $response = $client->request('POST','https://api.moesif.com/v1/search/~/subscriptions/batch', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -2173,23 +2791,54 @@ import ( func main() { headers := map[string][]string{ + "Content-Type": []string{"application/json"}, + "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/dashboard/{dashId}", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```csharp -using System; -using System.Collections.Generic; + jsonPayload := `{ + "trial_start": "2024-04-11T04:01:35.090Z", + "company_id": "string", + "start_date": "2024-04-11T04:01:35.090Z", + "collection_method": "string", + "provider": "string", + "items": [ + { + "item_price_id": "string", + "price_id": "string", + "is_metered": true, + "plan_id": "string", + "unit_of_measure": "string", + "status": "string", + "subscription_item_id": "string" + } + ], + "current_period_start": "2024-04-11T04:01:35.090Z", + "company_external_id": "string", + "payment_status": "string", + "cancel_time": "2024-04-11T04:01:35.090Z", + "status": "string", + "trial_end": "2024-04-11T04:01:35.090Z", + "external_id": "string", + "metadata": {}, + "subscription_id": "string", + "version_id": "string", + "current_period_end": "2024-04-11T04:01:35.090Z", + "created": "2024-04-11T04:01:35.090Z" +}` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/subscriptions/batch", data) + req.Header = headers + + client := &http.Client{} + resp, err := client.Do(req) + // ... +} + +``` + +```csharp +using System; +using System.Collections.Generic; using System.Net.Http; using System.Net.Http.Headers; using System.Text; @@ -2212,25 +2861,67 @@ public class HttpExample } - - /// Make a dummy request - public async Task MakeDeleteRequest() + public async Task MakePostRequest() { - int id = 1; - string url = "https://api.moesif.com/v1/~/dashboard/{dashId}"; - - await DeleteAsync(id, url); + string url = "https://api.moesif.com/v1/search/~/subscriptions/batch"; + + string json = @"{ + ""trial_start"": ""2024-04-11T04:01:35.090Z"", + ""company_id"": ""string"", + ""start_date"": ""2024-04-11T04:01:35.090Z"", + ""collection_method"": ""string"", + ""provider"": ""string"", + ""items"": [ + { + ""item_price_id"": ""string"", + ""price_id"": ""string"", + ""is_metered"": true, + ""plan_id"": ""string"", + ""unit_of_measure"": ""string"", + ""status"": ""string"", + ""subscription_item_id"": ""string"" + } + ], + ""current_period_start"": ""2024-04-11T04:01:35.090Z"", + ""company_external_id"": ""string"", + ""payment_status"": ""string"", + ""cancel_time"": ""2024-04-11T04:01:35.090Z"", + ""status"": ""string"", + ""trial_end"": ""2024-04-11T04:01:35.090Z"", + ""external_id"": ""string"", + ""metadata"": {}, + ""subscription_id"": ""string"", + ""version_id"": ""string"", + ""current_period_end"": ""2024-04-11T04:01:35.090Z"", + ""created"": ""2024-04-11T04:01:35.090Z"" +}"; + var content = JsonConvert.DeserializeObject(json); + await PostAsync(content, url); + + } - /// Performs a DELETE Request - public async Task DeleteAsync(int id, string url) + /// Performs a POST Request + public async Task PostAsync(AddSubscription content, string url) { - //Execute DELETE request - HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); + //Serialize Object + StringContent jsonContent = SerializeObject(content); - //Return response - await DeserializeObject(response); + //Execute POST request + HttpResponseMessage response = await Client.PostAsync(url, jsonContent); + } + + + + /// Serialize an object to Json + private StringContent SerializeObject(AddSubscription content) + { + //Serialize Object + string jsonObject = JsonConvert.SerializeObject(content); + + //Create Json UTF8 String Content + return new StringContent(jsonObject, Encoding.UTF8, "application/json"); } /// Deserialize object from request response @@ -2247,12 +2938,56 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/dashboard/{dashId}"); +URL obj = new URL("https://api.moesif.com/v1/search/~/subscriptions/batch"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("DELETE"); +con.setRequestMethod("POST"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """{ + "trial_start": "2024-04-11T04:01:35.090Z", + "company_id": "string", + "start_date": "2024-04-11T04:01:35.090Z", + "collection_method": "string", + "provider": "string", + "items": [ + { + "item_price_id": "string", + "price_id": "string", + "is_metered": true, + "plan_id": "string", + "unit_of_measure": "string", + "status": "string", + "subscription_item_id": "string" + } + ], + "current_period_start": "2024-04-11T04:01:35.090Z", + "company_external_id": "string", + "payment_status": "string", + "cancel_time": "2024-04-11T04:01:35.090Z", + "status": "string", + "trial_end": "2024-04-11T04:01:35.090Z", + "external_id": "string", + "metadata": {}, + "subscription_id": "string", + "version_id": "string", + "current_period_end": "2024-04-11T04:01:35.090Z", + "created": "2024-04-11T04:01:35.090Z" +}"""; + +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -2263,37 +2998,115 @@ System.out.println(response.toString()); ``` -`DELETE /~/dashboard/{dashId}` +`POST /search/~/subscriptions/batch` -*Delete a Dashboard* +*Create or Update Subscriptions in Batch* -

Parameters

+> `POST https://api.moesif.com/v1/search/~/subscriptions/batch` + +> Example Request + +```json +{ + "trial_start": "2024-04-11T04:01:35.090Z", + "company_id": "string", + "start_date": "2024-04-11T04:01:35.090Z", + "collection_method": "string", + "provider": "string", + "items": [ + { + "item_price_id": "string", + "price_id": "string", + "is_metered": true, + "plan_id": "string", + "unit_of_measure": "string", + "status": "string", + "subscription_item_id": "string" + } + ], + "current_period_start": "2024-04-11T04:01:35.090Z", + "company_external_id": "string", + "payment_status": "string", + "cancel_time": "2024-04-11T04:01:35.090Z", + "status": "string", + "trial_end": "2024-04-11T04:01:35.090Z", + "external_id": "string", + "metadata": {}, + "subscription_id": "string", + "version_id": "string", + "current_period_end": "2024-04-11T04:01:35.090Z", + "created": "2024-04-11T04:01:35.090Z" +} +``` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|dashId|path|string|true|none| -|parent_id|query|string|false|none| +|body|body|[AddSubscription](#schemaaddsubscriptiondto)|true|none| -

Responses

+> Example responses + +> 200 Response + +```json +{ + "trial_start": "2024-04-11T04:01:35.090Z", + "company_id": "string", + "start_date": "2024-04-11T04:01:35.090Z", + "collection_method": "string", + "provider": "string", + "items": [ + { + "item_price_id": "string", + "price_id": "string", + "is_metered": true, + "plan_id": "string", + "unit_of_measure": "string", + "status": "string", + "subscription_item_id": "string" + } + ], + "current_period_start": "2024-04-11T04:01:35.090Z", + "company_external_id": "string", + "payment_status": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "cancel_time": "2024-04-11T04:01:35.090Z", + "status": "string", + "trial_end": "2024-04-11T04:01:35.090Z", + "external_id": "string", + "metadata": {}, + "app_id": "string", + "subscription_id": "string", + "version_id": "string", + "type": "string", + "current_period_end": "2024-04-11T04:01:35.090Z", + "org_id": "string", + "created": "2024-04-11T04:01:35.090Z" +} +``` + +

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[Subscription](#schemasubscriptiondto)| -## promoteToProfileView +## getSubscription - + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/~/{appId}/{entity}/promotedashboard/{dashId} \ +curl -X GET https://api.moesif.com/v1/search/~/subscriptions/{id} \ + -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -2302,12 +3115,13 @@ curl -X POST https://api.moesif.com/v1/~/{appId}/{entity}/promotedashboard/{dash const fetch = require('node-fetch'); const headers = { + 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/{appId}/{entity}/promotedashboard/{dashId}', +fetch('https://api.moesif.com/v1/search/~/subscriptions/{id}', { - method: 'POST', + method: 'GET', headers: headers }) @@ -2322,10 +3136,11 @@ fetch('https://api.moesif.com/v1/~/{appId}/{entity}/promotedashboard/{dashId}', ```python import requests headers = { + 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.post('https://api.moesif.com/v1/~/{appId}/{entity}/promotedashboard/{dashId}', headers = headers) +r = requests.get('https://api.moesif.com/v1/search/~/subscriptions/{id}', headers = headers) print(r.json()) @@ -2336,12 +3151,14 @@ require 'rest-client' require 'json' headers = { + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/~/{appId}/{entity}/promotedashboard/{dashId}', +result = RestClient.get 'https://api.moesif.com/v1/search/~/subscriptions/{id}', params: { - }, headers: headers + }, + headers: headers p JSON.parse(result) @@ -2353,18 +3170,15 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('POST','https://api.moesif.com/v1/~/{appId}/{entity}/promotedashboard/{dashId}', array( + $response = $client->request('GET','https://api.moesif.com/v1/search/~/subscriptions/{id}', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -2389,11 +3203,12 @@ import ( func main() { headers := map[string][]string{ + "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/{appId}/{entity}/promotedashboard/{dashId}", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/search/~/subscriptions/{id}") req.Header = headers client := &http.Client{} @@ -2427,38 +3242,26 @@ public class HttpExample Client = new HttpClient(); } - /// Make a dummy request - public async Task MakePostRequest() + public async Task MakeGetRequest() { - string url = "https://api.moesif.com/v1/~/{appId}/{entity}/promotedashboard/{dashId}"; - - - await PostAsync(null, url); - + string url = "https://api.moesif.com/v1/search/~/subscriptions/{id}"; + var result = await GetAsync(url); } - /// Performs a POST Request - public async Task PostAsync(undefined content, string url) + /// Performs a GET Request + public async Task GetAsync(string url) { - //Serialize Object - StringContent jsonContent = SerializeObject(content); + //Start the request + HttpResponseMessage response = await Client.GetAsync(url); + + //Validate result + response.EnsureSuccessStatusCode(); - //Execute POST request - HttpResponseMessage response = await Client.PostAsync(url, jsonContent); } - /// Serialize an object to Json - private StringContent SerializeObject(undefined content) - { - //Serialize Object - string jsonObject = JsonConvert.SerializeObject(content); - - //Create Json UTF8 String Content - return new StringContent(jsonObject, Encoding.UTF8, "application/json"); - } /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) @@ -2474,12 +3277,15 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/{appId}/{entity}/promotedashboard/{dashId}"); +URL obj = new URL("https://api.moesif.com/v1/search/~/subscriptions/{id}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("POST"); +con.setRequestMethod("GET"); + +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -2490,53 +3296,101 @@ System.out.println(response.toString()); ``` -`POST /~/{appId}/{entity}/promotedashboard/{dashId}` +`GET /search/~/subscriptions/{id}` + +*Get a Subscription* -*Select Profile View Dashboard* +> `GET https://api.moesif.com/v1/search/~/subscriptions/{id}` -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|appId|path|string|true|none| -|entity|path|string|true|none| -|dashId|path|string|true|none| - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| - - - -## addACLPermissions +|id|path|string|true|none| - +> Example responses -> Code samples +> 200 Response -```shell -# You can also use wget -curl -X POST https://api.moesif.com/v1/~/dashboards/{id}/policy/acl \ - -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' +```json +{ + "trial_start": "2024-04-11T04:01:35.090Z", + "company_id": "string", + "start_date": "2024-04-11T04:01:35.090Z", + "collection_method": "string", + "provider": "string", + "items": [ + { + "item_price_id": "string", + "price_id": "string", + "is_metered": true, + "plan_id": "string", + "unit_of_measure": "string", + "status": "string", + "subscription_item_id": "string" + } + ], + "current_period_start": "2024-04-11T04:01:35.090Z", + "company_external_id": "string", + "payment_status": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "cancel_time": "2024-04-11T04:01:35.090Z", + "status": "string", + "trial_end": "2024-04-11T04:01:35.090Z", + "external_id": "string", + "metadata": {}, + "app_id": "string", + "subscription_id": "string", + "version_id": "string", + "type": "string", + "current_period_end": "2024-04-11T04:01:35.090Z", + "org_id": "string", + "created": "2024-04-11T04:01:35.090Z" +} +``` + +

Responses

+ +|Status|Meaning|Description|Schema| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[Subscription](#schemasubscriptiondto)| + + + +

Metrics

+ +## countEvents + + + +> Code samples + +```shell +# You can also use wget +curl -X POST https://api.moesif.com/v1/search/~/count/events?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ + -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = false; const headers = { + 'Content-Type':'application/json', + 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/dashboards/{id}/policy/acl', +fetch('https://api.moesif.com/v1/search/~/count/events?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z', { method: 'POST', - + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -2550,10 +3404,16 @@ fetch('https://api.moesif.com/v1/~/dashboards/{id}/policy/acl', ```python import requests headers = { + 'Content-Type': 'application/json', + 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = false -r = requests.post('https://api.moesif.com/v1/~/dashboards/{id}/policy/acl', headers = headers) +r = requests.post('https://api.moesif.com/v1/search/~/count/events', params={ + 'from': '2024-04-11T04:01:35.090Z', 'to': '2024-04-11T04:01:35.090Z' + +}, headers = headers, json = input_data) print(r.json()) @@ -2564,12 +3424,20 @@ require 'rest-client' require 'json' headers = { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/~/dashboards/{id}/policy/acl', +input_payload = JSON.parse('false') + +result = RestClient.post 'https://api.moesif.com/v1/search/~/count/events', params: { - }, headers: headers + 'from' => 'string(date-time)', + 'to' => 'string(date-time)' + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -2581,18 +3449,19 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Content-Type' => 'application/json', + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('false') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('POST','https://api.moesif.com/v1/~/dashboards/{id}/policy/acl', array( + $response = $client->request('POST','https://api.moesif.com/v1/search/~/count/events', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -2617,11 +3486,13 @@ import ( func main() { headers := map[string][]string{ + "Content-Type": []string{"application/json"}, + "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/dashboards/{id}/policy/acl", data) + jsonPayload := `false` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/count/events", data) req.Header = headers client := &http.Client{} @@ -2659,7 +3530,7 @@ public class HttpExample /// Make a dummy request public async Task MakePostRequest() { - string url = "https://api.moesif.com/v1/~/dashboards/{id}/policy/acl"; + string url = "https://api.moesif.com/v1/search/~/count/events"; await PostAsync(null, url); @@ -2702,12 +3573,27 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/dashboards/{id}/policy/acl"); +URL obj = new URL("https://api.moesif.com/v1/search/~/count/events?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """false"""; + +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -2718,38 +3604,51 @@ System.out.println(response.toString()); ``` -`POST /~/dashboards/{id}/policy/acl` +`POST /search/~/count/events` -*Add Dashboards ACL permission* +*Count Events* -

Parameters

+> `POST https://api.moesif.com/v1/search/~/count/events` + +> Example Request + +```json +false +``` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|id|path|string|true|none| -|grantee|query|string|false|none| -|permission|query|string|false|none| +|from|query|string(date-time)|true|The start date, which can be absolute such as 2019-07-01T00:00:00Z or relative such as -24h| +|to|query|string(date-time)|true|The end date, which can be absolute such as 2019-07-02T00:00:00Z or relative such as now| +|track_total_hits|query|boolean|false|none| -

Responses

+> Example responses + +

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| +

Response Schema

+ -## deleteACLPermissions +## getEvent - + > Code samples ```shell # You can also use wget -curl -X DELETE https://api.moesif.com/v1/~/dashboards/{id}/policy/acl?grantee=string \ +curl -X GET https://api.moesif.com/v1/search/~/events/{id}?event_time=2019-08-24T14%3A15%3A22Z \ + -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -2758,12 +3657,13 @@ curl -X DELETE https://api.moesif.com/v1/~/dashboards/{id}/policy/acl?grantee=st const fetch = require('node-fetch'); const headers = { + 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/dashboards/{id}/policy/acl?grantee=string', +fetch('https://api.moesif.com/v1/search/~/events/{id}?event_time=2019-08-24T14%3A15%3A22Z', { - method: 'DELETE', + method: 'GET', headers: headers }) @@ -2778,11 +3678,13 @@ fetch('https://api.moesif.com/v1/~/dashboards/{id}/policy/acl?grantee=string', ```python import requests headers = { + 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.delete('https://api.moesif.com/v1/~/dashboards/{id}/policy/acl', params={ - 'grantee': 'string' +r = requests.get('https://api.moesif.com/v1/search/~/events/{id}', params={ + 'event_time': '2024-04-11T04:01:35.090Z' + }, headers = headers) print(r.json()) @@ -2794,13 +3696,15 @@ require 'rest-client' require 'json' headers = { + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.delete 'https://api.moesif.com/v1/~/dashboards/{id}/policy/acl', +result = RestClient.get 'https://api.moesif.com/v1/search/~/events/{id}', params: { - 'grantee' => 'string' -}, headers: headers + 'event_time' => 'string(date-time)' + }, + headers: headers p JSON.parse(result) @@ -2812,18 +3716,15 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('DELETE','https://api.moesif.com/v1/~/dashboards/{id}/policy/acl', array( + $response = $client->request('GET','https://api.moesif.com/v1/search/~/events/{id}', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -2848,11 +3749,12 @@ import ( func main() { headers := map[string][]string{ + "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/dashboards/{id}/policy/acl", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/search/~/events/{id}") req.Header = headers client := &http.Client{} @@ -2886,28 +3788,27 @@ public class HttpExample Client = new HttpClient(); } - - - /// Make a dummy request - public async Task MakeDeleteRequest() + public async Task MakeGetRequest() { - int id = 1; - string url = "https://api.moesif.com/v1/~/dashboards/{id}/policy/acl"; - - await DeleteAsync(id, url); + string url = "https://api.moesif.com/v1/search/~/events/{id}"; + var result = await GetAsync(url); } - /// Performs a DELETE Request - public async Task DeleteAsync(int id, string url) + /// Performs a GET Request + public async Task GetAsync(string url) { - //Execute DELETE request - HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); + //Start the request + HttpResponseMessage response = await Client.GetAsync(url); + + //Validate result + response.EnsureSuccessStatusCode(); - //Return response - await DeserializeObject(response); } + + + /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) { @@ -2922,12 +3823,15 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/dashboards/{id}/policy/acl?grantee=string"); +URL obj = new URL("https://api.moesif.com/v1/search/~/events/{id}?event_time=2019-08-24T14%3A15%3A22Z"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("DELETE"); +con.setRequestMethod("GET"); + +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -2938,52 +3842,130 @@ System.out.println(response.toString()); ``` -`DELETE /~/dashboards/{id}/policy/acl` +`GET /search/~/events/{id}` -*Delete Dashboards ACL permission* +*Get an Event* -

Parameters

+> `GET https://api.moesif.com/v1/search/~/events/{id}` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| |id|path|string|true|none| -|grantee|query|string|true|none| +|event_time|query|string(date-time)|true|none| -

Responses

+> Example responses + +> 200 Response + +```json +{ + "_id": "AWF5M-FDTqLFD8l5y2f4", + "_source": { + "company_id": "67890", + "duration_ms": 76, + "request": { + "body": "json", + "uri": "https://api.github.com", + "user_agent": { + "patch": "1", + "major": "7", + "minor": "1", + "name": "PostmanRuntime" + }, + "geo_ip": { + "ip": "73.189.235.253", + "region_name": "CA", + "continent_code": "NA", + "location": [ + "[" + ], + "latitude": 37.769, + "timezone": "America/Los_Angeles", + "area_code": 415, + "longitude": -122.393, + "real_region_name": "California", + "dma_code": 807, + "postal_code": "94107", + "city_name": "San Francisco", + "country_code2": "US", + "country_code3": "USA", + "country_name": "United States" + }, + "ip_address": "73.189.235.253", + "verb": "GET", + "route": "/", + "time": "2023-07-09T06:14:58.550", + "headers": {} + }, + "user_id": "123454", + "company": {}, + "response": { + "body": {}, + "transfer_encoding": "json", + "status": 200, + "time": "2023-07-09T06:14:58.626", + "headers": {} + }, + "id": "AWF5M-FDTqLFD8l5y2f4", + "event_type": "api_call", + "session_token": "rdfmnw3fu24309efjc534nb421UZ9-]2JDO[ME", + "metadata": {}, + "app_id": "198:3", + "org_id": "177:3", + "user": {} + }, + "sort": [ + 0 + ] +} +``` + +

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[eventResponse](#schemaeventresponsedto)| -## copyDashboard +## searchEvents - + + + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/~/dashboard/{id}/copy \ +curl -X POST https://api.moesif.com/v1/search/~/search/events?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = false; const headers = { + 'Content-Type':'application/json', + 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/dashboard/{id}/copy', +fetch('https://api.moesif.com/v1/search/~/search/events?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z', { method: 'POST', - + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -2997,10 +3979,16 @@ fetch('https://api.moesif.com/v1/~/dashboard/{id}/copy', ```python import requests headers = { + 'Content-Type': 'application/json', + 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = false -r = requests.post('https://api.moesif.com/v1/~/dashboard/{id}/copy', headers = headers) +r = requests.post('https://api.moesif.com/v1/search/~/search/events', params={ + 'from': '2024-04-11T04:01:35.090Z', 'to': '2024-04-11T04:01:35.090Z' + +}, headers = headers, json = input_data) print(r.json()) @@ -3011,12 +3999,20 @@ require 'rest-client' require 'json' headers = { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/~/dashboard/{id}/copy', +input_payload = JSON.parse('false') + +result = RestClient.post 'https://api.moesif.com/v1/search/~/search/events', params: { - }, headers: headers + 'from' => 'string(date-time)', + 'to' => 'string(date-time)' + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -3028,18 +4024,19 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Content-Type' => 'application/json', + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('false') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('POST','https://api.moesif.com/v1/~/dashboard/{id}/copy', array( + $response = $client->request('POST','https://api.moesif.com/v1/search/~/search/events', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -3064,11 +4061,13 @@ import ( func main() { headers := map[string][]string{ + "Content-Type": []string{"application/json"}, + "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/dashboard/{id}/copy", data) + jsonPayload := `false` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/search/events", data) req.Header = headers client := &http.Client{} @@ -3106,7 +4105,7 @@ public class HttpExample /// Make a dummy request public async Task MakePostRequest() { - string url = "https://api.moesif.com/v1/~/dashboard/{id}/copy"; + string url = "https://api.moesif.com/v1/search/~/search/events"; await PostAsync(null, url); @@ -3149,12 +4148,27 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/dashboard/{id}/copy"); +URL obj = new URL("https://api.moesif.com/v1/search/~/search/events?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """false"""; + +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -3165,51 +4179,106 @@ System.out.println(response.toString()); ``` -`POST /~/dashboard/{id}/copy` +`POST /search/~/search/events` -*Copy Dashboard* +*Search Events* -

Parameters

+> `POST https://api.moesif.com/v1/search/~/search/events` + +> Example Request + +```json +false +``` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|id|path|string|true|none| +|from|query|string(date-time)|true|The start date, which can be absolute such as 2023-07-01T00:00:00Z or relative such as -24h| +|to|query|string(date-time)|true|The end date, which can be absolute such as 2023-07-02T00:00:00Z or relative such as now| -

Responses

+> Example responses + +> 201 Response + +```json +{ + "took": 358, + "timed_out": false, + "hits": { + "total": 947, + "hits": [ + { + "_id": "AWF5M-FDTqLFD8l5y2f4", + "_source": { + "company_id": "[", + "duration_ms": "[", + "request": {}, + "user_id": "[", + "company": {}, + "response": {}, + "id": "[", + "event_type": "[", + "session_token": "[", + "metadata": {}, + "app_id": "[", + "org_id": "[", + "user": {} + }, + "sort": [ + 0 + ] + } + ] + } +} +``` + +

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|None| +|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|[searchEventsResponse](#schemasearcheventsresponsedto)| -## copyAllDashboards +## searchPublicWorkspaces - + + + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/~/dashboards/copy?app_id=string&to_app_id=string \ +curl -X POST https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = false; const headers = { + 'Content-Type':'application/json', + 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/dashboards/copy?app_id=string&to_app_id=string', +fetch('https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z', { method: 'POST', - + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -3223,12 +4292,16 @@ fetch('https://api.moesif.com/v1/~/dashboards/copy?app_id=string&to_app_id=strin ```python import requests headers = { + 'Content-Type': 'application/json', + 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = false -r = requests.post('https://api.moesif.com/v1/~/dashboards/copy', params={ - 'app_id': 'string', 'to_app_id': 'string' -}, headers = headers) +r = requests.post('https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search', params={ + 'from': '2024-04-11T04:01:35.090Z', 'to': '2024-04-11T04:01:35.090Z' + +}, headers = headers, json = input_data) print(r.json()) @@ -3239,14 +4312,20 @@ require 'rest-client' require 'json' headers = { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/~/dashboards/copy', +input_payload = JSON.parse('false') + +result = RestClient.post 'https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search', params: { - 'app_id' => 'string', -'to_app_id' => 'string' -}, headers: headers + 'from' => 'string(date-time)', + 'to' => 'string(date-time)' + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -3258,18 +4337,19 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Content-Type' => 'application/json', + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('false') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('POST','https://api.moesif.com/v1/~/dashboards/copy', array( + $response = $client->request('POST','https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -3294,11 +4374,13 @@ import ( func main() { headers := map[string][]string{ + "Content-Type": []string{"application/json"}, + "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/dashboards/copy", data) + jsonPayload := `false` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search", data) req.Header = headers client := &http.Client{} @@ -3336,7 +4418,7 @@ public class HttpExample /// Make a dummy request public async Task MakePostRequest() { - string url = "https://api.moesif.com/v1/~/dashboards/copy"; + string url = "https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search"; await PostAsync(null, url); @@ -3379,12 +4461,27 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/dashboards/copy?app_id=string&to_app_id=string"); +URL obj = new URL("https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """false"""; + +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -3395,52 +4492,107 @@ System.out.println(response.toString()); ``` -`POST /~/dashboards/copy` +`POST /search/~/workspaces/{workspaceId}/search` -*Copy All Dashboards* +*Search Events in saved public Workspace* -

Parameters

+> `POST https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search` + +> Example Request + +```json +false +``` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| +|from|query|string(date-time)|true|The start date, which can be absolute such as 2023-07-01T00:00:00Z or relative such as -24h| +|to|query|string(date-time)|true|The end date, which can be absolute such as 2023-07-02T00:00:00Z or relative such as now| +|workspaceId|path|string|true|none| +|include_details|query|boolean|false|none| +|take|query|integer(int32)|false|none| -

Responses

+> Example responses + +> 201 Response + +```json +{ + "took": 358, + "timed_out": false, + "hits": { + "total": 947, + "hits": [ + { + "_id": "AWF5M-FDTqLFD8l5y2f4", + "_source": { + "company_id": "[", + "duration_ms": "[", + "request": {}, + "user_id": "[", + "company": {}, + "response": {}, + "id": "[", + "event_type": "[", + "session_token": "[", + "metadata": {}, + "app_id": "[", + "org_id": "[", + "user": {} + }, + "sort": [ + 0 + ] + } + ] + } +} +``` + +

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|None| +|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|[searchEventsResponse](#schemasearcheventsresponsedto)| -## createDashboard +

Users

- +## countUsers + + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/~/dashboards \ +curl -X POST https://api.moesif.com/v1/search/~/count/users?app_id=string \ + -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = false; const headers = { + 'Content-Type':'application/json', 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/dashboards', +fetch('https://api.moesif.com/v1/search/~/count/users?app_id=string', { method: 'POST', - + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -3454,11 +4606,16 @@ fetch('https://api.moesif.com/v1/~/dashboards', ```python import requests headers = { + 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = false -r = requests.post('https://api.moesif.com/v1/~/dashboards', headers = headers) +r = requests.post('https://api.moesif.com/v1/search/~/count/users', params={ + 'app_id': 'string' + +}, headers = headers, json = input_data) print(r.json()) @@ -3469,13 +4626,19 @@ require 'rest-client' require 'json' headers = { + 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/~/dashboards', +input_payload = JSON.parse('false') + +result = RestClient.post 'https://api.moesif.com/v1/search/~/count/users', params: { - }, headers: headers + 'app_id' => 'string' + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -3487,19 +4650,19 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('false') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('POST','https://api.moesif.com/v1/~/dashboards', array( + $response = $client->request('POST','https://api.moesif.com/v1/search/~/count/users', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -3524,12 +4687,13 @@ import ( func main() { headers := map[string][]string{ + "Content-Type": []string{"application/json"}, "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/dashboards", data) + jsonPayload := `false` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/count/users", data) req.Header = headers client := &http.Client{} @@ -3567,7 +4731,7 @@ public class HttpExample /// Make a dummy request public async Task MakePostRequest() { - string url = "https://api.moesif.com/v1/~/dashboards"; + string url = "https://api.moesif.com/v1/search/~/count/users"; await PostAsync(null, url); @@ -3610,12 +4774,27 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/dashboards"); +URL obj = new URL("https://api.moesif.com/v1/search/~/count/users?app_id=string"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """false"""; + +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -3626,90 +4805,71 @@ System.out.println(response.toString()); ``` -`POST /~/dashboards` +`POST /search/~/count/users` -*Create New Dashboard* +*Count Users* -

Parameters

+> `POST https://api.moesif.com/v1/search/~/count/users` + +> Example Request + +```json +false +``` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| > Example responses -> 201 Response - -```json -{ - "parent": "string", - "name": "string", - "_id": "string", - "auth_user_id": "string", - "profile_view_promotion": "string", - "app_id": "string", - "workspace_ids": [ - [ - "string" - ] - ], - "sort_order": 0, - "dashboard_ids": [ - "string" - ], - "policy": { - "acl": [ - { - "grantee": "string", - "permission": "string" - } - ], - "resource": {}, - "api_scopes": [ - "string" - ], - "original_encoded_resource": "string" - }, - "org_id": "string", - "migration": {}, - "created": "2019-08-24T14:15:22Z" -} -``` - -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|[DashboardDocument](#schemadashboarddocument)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| + +

Response Schema

-## getDashboards +## searchUserMetrics - + + + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/~/dashboards \ +curl -X POST https://api.moesif.com/v1/search/~/search/usermetrics/users \ + -H 'Content-Type: application/json' \ + -H 'Accept: 0' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = false; const headers = { + 'Content-Type':'application/json', + 'Accept':'0', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/dashboards', +fetch('https://api.moesif.com/v1/search/~/search/usermetrics/users', { - method: 'GET', - + method: 'POST', + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -3723,10 +4883,13 @@ fetch('https://api.moesif.com/v1/~/dashboards', ```python import requests headers = { + 'Content-Type': 'application/json', + 'Accept': '0', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = false -r = requests.get('https://api.moesif.com/v1/~/dashboards', headers = headers) +r = requests.post('https://api.moesif.com/v1/search/~/search/usermetrics/users', headers = headers, json = input_data) print(r.json()) @@ -3737,12 +4900,18 @@ require 'rest-client' require 'json' headers = { + 'Content-Type' => 'application/json', + 'Accept' => '0', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/~/dashboards', +input_payload = JSON.parse('false') + +result = RestClient.post 'https://api.moesif.com/v1/search/~/search/usermetrics/users', params: { - }, headers: headers + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -3754,18 +4923,19 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Content-Type' => 'application/json', + 'Accept' => '0', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('false') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('GET','https://api.moesif.com/v1/~/dashboards', array( + $response = $client->request('POST','https://api.moesif.com/v1/search/~/search/usermetrics/users', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -3790,11 +4960,13 @@ import ( func main() { headers := map[string][]string{ + "Content-Type": []string{"application/json"}, + "Accept": []string{"0"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/dashboards", data) + jsonPayload := `false` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/search/usermetrics/users", data) req.Header = headers client := &http.Client{} @@ -3828,26 +5000,38 @@ public class HttpExample Client = new HttpClient(); } + /// Make a dummy request - public async Task MakeGetRequest() + public async Task MakePostRequest() { - string url = "https://api.moesif.com/v1/~/dashboards"; - var result = await GetAsync(url); + string url = "https://api.moesif.com/v1/search/~/search/usermetrics/users"; + + + await PostAsync(null, url); + } - /// Performs a GET Request - public async Task GetAsync(string url) + /// Performs a POST Request + public async Task PostAsync(undefined content, string url) { - //Start the request - HttpResponseMessage response = await Client.GetAsync(url); - - //Validate result - response.EnsureSuccessStatusCode(); + //Serialize Object + StringContent jsonContent = SerializeObject(content); + //Execute POST request + HttpResponseMessage response = await Client.PostAsync(url, jsonContent); } + /// Serialize an object to Json + private StringContent SerializeObject(undefined content) + { + //Serialize Object + string jsonObject = JsonConvert.SerializeObject(content); + + //Create Json UTF8 String Content + return new StringContent(jsonObject, Encoding.UTF8, "application/json"); + } /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) @@ -3863,12 +5047,27 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/dashboards"); +URL obj = new URL("https://api.moesif.com/v1/search/~/search/usermetrics/users"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("GET"); +con.setRequestMethod("POST"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Accept",'0'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """false"""; + +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -3879,54 +5078,93 @@ System.out.println(response.toString()); ``` -`GET /~/dashboards` +`POST /search/~/search/usermetrics/users` -*Get a Dashboard* +*Search UserMetrics/Users* -

Parameters

+> `POST https://api.moesif.com/v1/search/~/search/usermetrics/users` + +> Example Request + +```json +false +``` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| +|from|query|string(date-time)|false|The start date, which can be absolute such as 2023-07-01T00:00:00Z or relative such as -24h| +|to|query|string(date-time)|false|The end date, which can be absolute such as 2023-07-02T00:00:00Z or relative such as now| -

Responses

+> Example responses + +

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| +

Response Schema

+ -

Billing Reports

- -## getBillingReports +## updateUsers - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/~/billing/reports \ +curl -X POST https://api.moesif.com/v1/search/~/users \ + -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + -d '{ + "company_id": "string", + "first_name": "string", + "name": "string", + "email": "string", + "photo_url": "string", + "user_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "last_name": "string", + "metadata": {}, + "user_name": "string", + "phone": "string" +}' ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = { + "company_id": "string", + "first_name": "string", + "name": "string", + "email": "string", + "photo_url": "string", + "user_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "last_name": "string", + "metadata": {}, + "user_name": "string", + "phone": "string" +}; const headers = { + 'Content-Type':'application/json', 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/billing/reports', +fetch('https://api.moesif.com/v1/search/~/users', { - method: 'GET', - + method: 'POST', + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -3940,11 +5178,25 @@ fetch('https://api.moesif.com/v1/~/billing/reports', ```python import requests headers = { + 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = { + "company_id": "string", + "first_name": "string", + "name": "string", + "email": "string", + "photo_url": "string", + "user_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "last_name": "string", + "metadata": {}, + "user_name": "string", + "phone": "string" +} -r = requests.get('https://api.moesif.com/v1/~/billing/reports', headers = headers) +r = requests.post('https://api.moesif.com/v1/search/~/users', headers = headers, json = input_data) print(r.json()) @@ -3955,13 +5207,30 @@ require 'rest-client' require 'json' headers = { + 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/~/billing/reports', +input_payload = JSON.parse('{ + "company_id": "string", + "first_name": "string", + "name": "string", + "email": "string", + "photo_url": "string", + "user_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "last_name": "string", + "metadata": {}, + "user_name": "string", + "phone": "string" +}') + +result = RestClient.post 'https://api.moesif.com/v1/search/~/users', params: { - }, headers: headers + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -3973,19 +5242,31 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('{ + "company_id": "string", + "first_name": "string", + "name": "string", + "email": "string", + "photo_url": "string", + "user_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "last_name": "string", + "metadata": {}, + "user_name": "string", + "phone": "string" +}') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('GET','https://api.moesif.com/v1/~/billing/reports', array( + $response = $client->request('POST','https://api.moesif.com/v1/search/~/users', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -4010,12 +5291,25 @@ import ( func main() { headers := map[string][]string{ + "Content-Type": []string{"application/json"}, "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/billing/reports", data) + jsonPayload := `{ + "company_id": "string", + "first_name": "string", + "name": "string", + "email": "string", + "photo_url": "string", + "user_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "last_name": "string", + "metadata": {}, + "user_name": "string", + "phone": "string" +}` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/users", data) req.Header = headers client := &http.Client{} @@ -4049,26 +5343,52 @@ public class HttpExample Client = new HttpClient(); } + /// Make a dummy request - public async Task MakeGetRequest() + public async Task MakePostRequest() { - string url = "https://api.moesif.com/v1/~/billing/reports"; - var result = await GetAsync(url); + string url = "https://api.moesif.com/v1/search/~/users"; + + string json = @"{ + ""company_id"": ""string"", + ""first_name"": ""string"", + ""name"": ""string"", + ""email"": ""string"", + ""photo_url"": ""string"", + ""user_id"": ""string"", + ""modified_time"": ""2024-04-11T04:01:35.090Z"", + ""last_name"": ""string"", + ""metadata"": {}, + ""user_name"": ""string"", + ""phone"": ""string"" +}"; + var content = JsonConvert.DeserializeObject(json); + await PostAsync(content, url); + + } - /// Performs a GET Request - public async Task GetAsync(string url) + /// Performs a POST Request + public async Task PostAsync(UserUpdate content, string url) { - //Start the request - HttpResponseMessage response = await Client.GetAsync(url); - - //Validate result - response.EnsureSuccessStatusCode(); + //Serialize Object + StringContent jsonContent = SerializeObject(content); + //Execute POST request + HttpResponseMessage response = await Client.PostAsync(url, jsonContent); } + /// Serialize an object to Json + private StringContent SerializeObject(UserUpdate content) + { + //Serialize Object + string jsonObject = JsonConvert.SerializeObject(content); + + //Create Json UTF8 String Content + return new StringContent(jsonObject, Encoding.UTF8, "application/json"); + } /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) @@ -4084,12 +5404,39 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/billing/reports"); +URL obj = new URL("https://api.moesif.com/v1/search/~/users"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("GET"); +con.setRequestMethod("POST"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """{ + "company_id": "string", + "first_name": "string", + "name": "string", + "email": "string", + "photo_url": "string", + "user_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "last_name": "string", + "metadata": {}, + "user_name": "string", + "phone": "string" +}"""; + +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -4100,205 +5447,162 @@ System.out.println(response.toString()); ``` -`GET /~/billing/reports` +`POST /search/~/users` -*Get BillingReports* +*Update a User* -Query audit history of billing reports to external billing providers +> `POST https://api.moesif.com/v1/search/~/users` -

Parameters

+> Example Request + +```json +{ + "company_id": "string", + "first_name": "string", + "name": "string", + "email": "string", + "photo_url": "string", + "user_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "last_name": "string", + "metadata": {}, + "user_name": "string", + "phone": "string" +} +``` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|from|query|string(date-time)|false|none| -|to|query|string(date-time)|false|none| -|billing_meter_id|query|string|false|none| -|company_id|query|string|false|none| -|provider|query|string|false|none| -|subscription_id|query|string|false|none| -|success|query|boolean|false|none| -|status_code|query|integer(int32)|false|none| -|error_code|query|string|false|none| -|`type`|query|string|false|none| +|body|body|[UserUpdate](#schemauserupdatedto)|true|none| > Example responses > 200 Response ```json -[ - { - "ending_balance": { - "sequence_id": 0, - "current_balance": 0, - "pending_activity": 0, - "available_balance": 0 +{ + "_id": "123456", + "_source": { + "first_name": "John", + "body": {}, + "name": "John Doe", + "email": "john.doe@gmail.com", + "first_seen_time": "2023-07-27T21:52:58.0990000Z", + "user_agent": { + "name": "Android", + "os_major": "7", + "os": "Android 7.0", + "os_name": "Android", + "os_minor": "0", + "major": "7", + "device": "Samsung SM-G955U", + "minor": "0" }, - "company_id": "string", - "success": true, - "provider": "string", - "report_version": 0, - "usage_end_time": "2019-08-24T14:15:22Z", - "usage": { - "invoice": { - "period_start": "2019-08-24T14:15:22Z", - "period_end": "2019-08-24T14:15:22Z", - "id": "string" + "geo_ip": { + "ip": "107.200.85.196", + "region_name": "South Carolina", + "continent_code": "NA", + "location": { + "lon": -79.85489654541016, + "lat": 32.822898864746094 }, - "aggregator": "string" - }, - "_id": "string", - "meter_usage": 0, - "last_success_time": "2019-08-24T14:15:22Z", - "beginning_balance": { - "sequence_id": 0, - "current_balance": 0, - "pending_activity": 0, - "available_balance": 0 + "latitude": 32.822898864746094, + "timezone": "America/New_York", + "longitude": -79.85489654541016, + "dma_code": 519, + "postal_code": "29464", + "region_code": "SC", + "city_name": "Mt. Pleasant", + "country_code2": "US", + "country_code3": "US", + "country_name": "United States" }, - "billing_meter_id": "string", - "amount": 0, - "usage_start_time": "2019-08-24T14:15:22Z", - "status": "string", - "provider_requests": [ - { - "success": true, - "status_code": 0, - "job_id": "string", - "error_message": "string", - "error_code": "string", - "request_time": "2019-08-24T14:15:22Z" - } - ], - "currency": "string", - "report_total_usage": 0, - "channel_requests": [ - { - "channel_id": "string", - "channel_name": "string", - "provider_requests": [ - { - "success": true, - "status_code": 0, - "job_id": "string", - "error_message": "string", - "error_code": "string", - "request_time": "2019-08-24T14:15:22Z" - } - ] - } - ], - "created_at": "2019-08-24T14:15:22Z", - "app_id": "string", - "subscription_id": "string", - "subscription_period_start": "2019-08-24T14:15:22Z", - "balance_changes": [ - { - "amount": 0 - } + "modified_time": "2023-07-27T21:55:19.464", + "last_name": "Doe", + "ip_address": "107.200.85.196", + "session_token": [ + "e93u2jiry8fij8q09-tfZ9SIK9DERDXUYMF" ], - "type": "string", - "updated_at": "2019-08-24T14:15:22Z", - "org_id": "string", - "subscription_period_end": "2019-08-24T14:15:22Z", - "meter_metric": 0 - } -] + "last_seen_time": "2023-07-27T21:52:58.0990000Z", + "app_id": "198:3", + "org_id": "177:3" + }, + "sort": [ + 1519768519464 + ] +} ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|Inline| - -

Response Schema

- -Status Code **200** - -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|*anonymous*|[[BillingReport](#schemabillingreport)]|false|none|none| -|» ending_balance|object|false|none|none| -|»» sequence_id|integer(int32)|true|none|none| -|»» current_balance|number(double)|true|none|none| -|»» pending_activity|number(double)|true|none|none| -|»» available_balance|number(double)|true|none|none| -|» company_id|string|true|none|none| -|» success|boolean|true|none|none| -|» provider|string|true|none|none| -|» report_version|integer(int32)|false|none|none| -|» usage_end_time|string(date-time)|true|none|none| -|» usage|object|false|none|none| -|»» invoice|object|false|none|none| -|»»» period_start|string(date-time)|false|none|none| -|»»» period_end|string(date-time)|false|none|none| -|»»» id|string|true|none|none| -|»» aggregator|string|false|none|none| -|» _id|string|false|none|none| -|» meter_usage|integer(int64)|true|none|none| -|» last_success_time|string(date-time)|false|none|none| -|» beginning_balance|object|false|none|none| -|» billing_meter_id|string|true|none|none| -|» amount|number(double)|false|none|none| -|» usage_start_time|string(date-time)|true|none|none| -|» status|string|false|none|none| -|» provider_requests|[[ProviderRequest](#schemaproviderrequest)]|true|none|none| -|»» success|boolean|true|none|none| -|»» status_code|integer(int32)|true|none|none| -|»» job_id|string|true|none|none| -|»» error_message|string|true|none|none| -|»» error_code|string|true|none|none| -|»» request_time|string(date-time)|true|none|none| -|» currency|string|false|none|none| -|» report_total_usage|integer(int64)|true|none|none| -|» channel_requests|[[ChannelRequest](#schemachannelrequest)]|false|none|none| -|»» channel_id|string|true|none|none| -|»» channel_name|string|true|none|none| -|»» provider_requests|[[ProviderRequest](#schemaproviderrequest)]|true|none|none| -|» created_at|string(date-time)|false|none|none| -|» app_id|string|true|none|none| -|» subscription_id|string|true|none|none| -|» subscription_period_start|string(date-time)|false|none|none| -|» balance_changes|[[BalanceChange](#schemabalancechange)]|false|none|none| -|»» amount|number(double)|true|none|none| -|» type|string|false|none|none| -|» updated_at|string(date-time)|false|none|none| -|» org_id|string|true|none|none| -|» subscription_period_end|string(date-time)|false|none|none| -|» meter_metric|integer(int64)|true|none|none| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[userResponse](#schemauserresponsedto)| -## getBillingReportsMetrics +## batchUpdateUsers - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/~/billing/reports/metrics?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z \ +curl -X POST https://api.moesif.com/v1/search/~/users/batch \ + -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + -d '[ + { + "company_id": "string", + "first_name": "string", + "name": "string", + "email": "string", + "photo_url": "string", + "user_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "last_name": "string", + "metadata": {}, + "user_name": "string", + "phone": "string" + } +]' ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = [ + { + "company_id": "string", + "first_name": "string", + "name": "string", + "email": "string", + "photo_url": "string", + "user_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "last_name": "string", + "metadata": {}, + "user_name": "string", + "phone": "string" + } +]; const headers = { + 'Content-Type':'application/json', 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/billing/reports/metrics?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z', +fetch('https://api.moesif.com/v1/search/~/users/batch', { - method: 'GET', - + method: 'POST', + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -4312,13 +5616,27 @@ fetch('https://api.moesif.com/v1/~/billing/reports/metrics?from=2019-08-24T14%3A ```python import requests headers = { + 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = [ + { + "company_id": "string", + "first_name": "string", + "name": "string", + "email": "string", + "photo_url": "string", + "user_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "last_name": "string", + "metadata": {}, + "user_name": "string", + "phone": "string" + } +] -r = requests.get('https://api.moesif.com/v1/~/billing/reports/metrics', params={ - 'from': '2019-08-24T14:15:22Z', 'to': '2019-08-24T14:15:22Z' -}, headers = headers) +r = requests.post('https://api.moesif.com/v1/search/~/users/batch', headers = headers, json = input_data) print(r.json()) @@ -4329,15 +5647,32 @@ require 'rest-client' require 'json' headers = { + 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/~/billing/reports/metrics', +input_payload = JSON.parse('[ + { + "company_id": "string", + "first_name": "string", + "name": "string", + "email": "string", + "photo_url": "string", + "user_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "last_name": "string", + "metadata": {}, + "user_name": "string", + "phone": "string" + } +]') + +result = RestClient.post 'https://api.moesif.com/v1/search/~/users/batch', params: { - 'from' => 'string(date-time)', -'to' => 'string(date-time)' -}, headers: headers + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -4349,19 +5684,33 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('[ + { + "company_id": "string", + "first_name": "string", + "name": "string", + "email": "string", + "photo_url": "string", + "user_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "last_name": "string", + "metadata": {}, + "user_name": "string", + "phone": "string" + } +]') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('GET','https://api.moesif.com/v1/~/billing/reports/metrics', array( + $response = $client->request('POST','https://api.moesif.com/v1/search/~/users/batch', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -4386,12 +5735,27 @@ import ( func main() { headers := map[string][]string{ + "Content-Type": []string{"application/json"}, "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/billing/reports/metrics", data) + jsonPayload := `[ + { + "company_id": "string", + "first_name": "string", + "name": "string", + "email": "string", + "photo_url": "string", + "user_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "last_name": "string", + "metadata": {}, + "user_name": "string", + "phone": "string" + } +]` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/users/batch", data) req.Header = headers client := &http.Client{} @@ -4425,26 +5789,54 @@ public class HttpExample Client = new HttpClient(); } + /// Make a dummy request - public async Task MakeGetRequest() + public async Task MakePostRequest() { - string url = "https://api.moesif.com/v1/~/billing/reports/metrics"; - var result = await GetAsync(url); - } - - /// Performs a GET Request - public async Task GetAsync(string url) - { - //Start the request - HttpResponseMessage response = await Client.GetAsync(url); + string url = "https://api.moesif.com/v1/search/~/users/batch"; + + string json = @"[ + { + ""company_id"": ""string"", + ""first_name"": ""string"", + ""name"": ""string"", + ""email"": ""string"", + ""photo_url"": ""string"", + ""user_id"": ""string"", + ""modified_time"": ""2024-04-11T04:01:35.090Z"", + ""last_name"": ""string"", + ""metadata"": {}, + ""user_name"": ""string"", + ""phone"": ""string"" + } +]"; + var content = JsonConvert.DeserializeObject(json); + await PostAsync(content, url); + + + } - //Validate result - response.EnsureSuccessStatusCode(); + /// Performs a POST Request + public async Task PostAsync(UserUpdate content, string url) + { + //Serialize Object + StringContent jsonContent = SerializeObject(content); + //Execute POST request + HttpResponseMessage response = await Client.PostAsync(url, jsonContent); } + /// Serialize an object to Json + private StringContent SerializeObject(UserUpdate content) + { + //Serialize Object + string jsonObject = JsonConvert.SerializeObject(content); + + //Create Json UTF8 String Content + return new StringContent(jsonObject, Encoding.UTF8, "application/json"); + } /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) @@ -4460,12 +5852,41 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/billing/reports/metrics?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z"); +URL obj = new URL("https://api.moesif.com/v1/search/~/users/batch"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("GET"); +con.setRequestMethod("POST"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """[ + { + "company_id": "string", + "first_name": "string", + "name": "string", + "email": "string", + "photo_url": "string", + "user_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "last_name": "string", + "metadata": {}, + "user_name": "string", + "phone": "string" + } +]"""; + +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -4476,25 +5897,37 @@ System.out.println(response.toString()); ``` -`GET /~/billing/reports/metrics` +`POST /search/~/users/batch` -*Get BillingReports' values for a given meter and time range for a single company or all companies* +*Update Users in Batch* -Get BillingReports' values for a given meter and time range for a single company or all companies +> `POST https://api.moesif.com/v1/search/~/users/batch` -

Parameters

+> Example Request + +```json +[ + { + "company_id": "string", + "first_name": "string", + "name": "string", + "email": "string", + "photo_url": "string", + "user_id": "string", + "modified_time": "2024-04-11T04:01:35.090Z", + "last_name": "string", + "metadata": {}, + "user_name": "string", + "phone": "string" + } +] +``` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|from|query|string(date-time)|true|none| -|to|query|string(date-time)|true|none| -|billing_meter_id|query|string|false|none| -|success|query|boolean|false|none| -|aggregator|query|string|false|none| -|interval|query|string|false|none| -|company_id|query|string|false|none| -|subscription_id|query|string|false|none| -|`type`|query|array[string]|false|none| +|body|body|[UserUpdate](#schemauserupdatedto)|true|none| > Example responses @@ -4502,43 +5935,78 @@ Get BillingReports' values for a given meter and time range for a single company ```json { - "buckets": [ - { - "start": "2019-08-24T14:15:22Z", - "metric": 0, - "amounts": null, - "ending_balance": { - "current_balance": 0, - "pending_activity": 0, - "available_balance": 0 - } - } + "_id": "123456", + "_source": { + "first_name": "John", + "body": {}, + "name": "John Doe", + "email": "john.doe@gmail.com", + "first_seen_time": "2023-07-27T21:52:58.0990000Z", + "user_agent": { + "name": "Android", + "os_major": "7", + "os": "Android 7.0", + "os_name": "Android", + "os_minor": "0", + "major": "7", + "device": "Samsung SM-G955U", + "minor": "0" + }, + "geo_ip": { + "ip": "107.200.85.196", + "region_name": "South Carolina", + "continent_code": "NA", + "location": { + "lon": -79.85489654541016, + "lat": 32.822898864746094 + }, + "latitude": 32.822898864746094, + "timezone": "America/New_York", + "longitude": -79.85489654541016, + "dma_code": 519, + "postal_code": "29464", + "region_code": "SC", + "city_name": "Mt. Pleasant", + "country_code2": "US", + "country_code3": "US", + "country_name": "United States" + }, + "modified_time": "2023-07-27T21:55:19.464", + "last_name": "Doe", + "ip_address": "107.200.85.196", + "session_token": [ + "e93u2jiry8fij8q09-tfZ9SIK9DERDXUYMF" + ], + "last_seen_time": "2023-07-27T21:52:58.0990000Z", + "app_id": "198:3", + "org_id": "177:3" + }, + "sort": [ + 1519768519464 ] } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|three buckets of aggregates for the given meter and time range including Metric Value, Reported Usage, and list of errors.|[BillingMetricResponse](#schemabillingmetricresponse)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[userResponse](#schemauserresponsedto)| -

Keystore

- -## createEncryptedKeys +## getUser - + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/v1/~/keystore \ +curl -X GET https://api.moesif.com/v1/search/~/users/{id} \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' @@ -4552,9 +6020,9 @@ const headers = { 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/v1/~/keystore', +fetch('https://api.moesif.com/v1/search/~/users/{id}', { - method: 'POST', + method: 'GET', headers: headers }) @@ -4573,7 +6041,7 @@ headers = { 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.post('https://api.moesif.com/v1/v1/~/keystore', headers = headers) +r = requests.get('https://api.moesif.com/v1/search/~/users/{id}', headers = headers) print(r.json()) @@ -4588,9 +6056,10 @@ headers = { 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/v1/~/keystore', +result = RestClient.get 'https://api.moesif.com/v1/search/~/users/{id}', params: { - }, headers: headers + }, + headers: headers p JSON.parse(result) @@ -4608,13 +6077,9 @@ $headers = array( $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('POST','https://api.moesif.com/v1/v1/~/keystore', array( + $response = $client->request('GET','https://api.moesif.com/v1/search/~/users/{id}', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -4642,9 +6107,9 @@ func main() { "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/v1/~/keystore", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/search/~/users/{id}") req.Header = headers client := &http.Client{} @@ -4678,38 +6143,26 @@ public class HttpExample Client = new HttpClient(); } - /// Make a dummy request - public async Task MakePostRequest() + public async Task MakeGetRequest() { - string url = "https://api.moesif.com/v1/v1/~/keystore"; - - - await PostAsync(null, url); - + string url = "https://api.moesif.com/v1/search/~/users/{id}"; + var result = await GetAsync(url); } - /// Performs a POST Request - public async Task PostAsync(undefined content, string url) + /// Performs a GET Request + public async Task GetAsync(string url) { - //Serialize Object - StringContent jsonContent = SerializeObject(content); + //Start the request + HttpResponseMessage response = await Client.GetAsync(url); + + //Validate result + response.EnsureSuccessStatusCode(); - //Execute POST request - HttpResponseMessage response = await Client.PostAsync(url, jsonContent); } - /// Serialize an object to Json - private StringContent SerializeObject(undefined content) - { - //Serialize Object - string jsonObject = JsonConvert.SerializeObject(content); - - //Create Json UTF8 String Content - return new StringContent(jsonObject, Encoding.UTF8, "application/json"); - } /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) @@ -4725,12 +6178,15 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/v1/~/keystore"); +URL obj = new URL("https://api.moesif.com/v1/search/~/users/{id}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("POST"); +con.setRequestMethod("GET"); + +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -4741,56 +6197,96 @@ System.out.println(response.toString()); ``` -`POST /v1/~/keystore` +`GET /search/~/users/{id}` + +*Get a User* -*Create New Encrypted key/s* +> `GET https://api.moesif.com/v1/search/~/users/{id}` -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|body|body|[EncryptedKeyCreateItem](#schemaencryptedkeycreateitem)|false|none| +|id|path|string|true|none| > Example responses -> 201 Response +> 200 Response ```json { - "_id": "string", - "to": "2019-08-24T14:15:22Z", - "encrypted_key": "string", - "modified_at": "2019-08-24T14:15:22Z", - "from": "2019-08-24T14:15:22Z", - "created_at": "2019-08-24T14:15:22Z", - "app_id": "string", - "type": "string", - "org_id": "string", - "month": "string" + "_id": "123456", + "_source": { + "first_name": "John", + "body": {}, + "name": "John Doe", + "email": "john.doe@gmail.com", + "first_seen_time": "2023-07-27T21:52:58.0990000Z", + "user_agent": { + "name": "Android", + "os_major": "7", + "os": "Android 7.0", + "os_name": "Android", + "os_minor": "0", + "major": "7", + "device": "Samsung SM-G955U", + "minor": "0" + }, + "geo_ip": { + "ip": "107.200.85.196", + "region_name": "South Carolina", + "continent_code": "NA", + "location": { + "lon": -79.85489654541016, + "lat": 32.822898864746094 + }, + "latitude": 32.822898864746094, + "timezone": "America/New_York", + "longitude": -79.85489654541016, + "dma_code": 519, + "postal_code": "29464", + "region_code": "SC", + "city_name": "Mt. Pleasant", + "country_code2": "US", + "country_code3": "US", + "country_name": "United States" + }, + "modified_time": "2023-07-27T21:55:19.464", + "last_name": "Doe", + "ip_address": "107.200.85.196", + "session_token": [ + "e93u2jiry8fij8q09-tfZ9SIK9DERDXUYMF" + ], + "last_seen_time": "2023-07-27T21:52:58.0990000Z", + "app_id": "198:3", + "org_id": "177:3" + }, + "sort": [ + 1519768519464 + ] } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|[EncryptedKeyDocument](#schemaencryptedkeydocument)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[userResponse](#schemauserresponsedto)| -## getEncryptedKeys +## deleteUser - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/v1/~/keystore \ - -H 'Accept: application/json' \ +curl -X DELETE https://api.moesif.com/v1/search/~/users/{id} \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -4799,13 +6295,12 @@ curl -X GET https://api.moesif.com/v1/v1/~/keystore \ const fetch = require('node-fetch'); const headers = { - 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/v1/~/keystore', +fetch('https://api.moesif.com/v1/search/~/users/{id}', { - method: 'GET', + method: 'DELETE', headers: headers }) @@ -4820,11 +6315,10 @@ fetch('https://api.moesif.com/v1/v1/~/keystore', ```python import requests headers = { - 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.get('https://api.moesif.com/v1/v1/~/keystore', headers = headers) +r = requests.delete('https://api.moesif.com/v1/search/~/users/{id}', headers = headers) print(r.json()) @@ -4835,13 +6329,13 @@ require 'rest-client' require 'json' headers = { - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/v1/~/keystore', +result = RestClient.delete 'https://api.moesif.com/v1/search/~/users/{id}', params: { - }, headers: headers + }, + headers: headers p JSON.parse(result) @@ -4853,19 +6347,14 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('GET','https://api.moesif.com/v1/v1/~/keystore', array( + $response = $client->request('DELETE','https://api.moesif.com/v1/search/~/users/{id}', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -4890,12 +6379,11 @@ import ( func main() { headers := map[string][]string{ - "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/v1/~/keystore", data) + + + req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/search/~/users/{id}") req.Header = headers client := &http.Client{} @@ -4929,27 +6417,28 @@ public class HttpExample Client = new HttpClient(); } + + + /// Make a dummy request - public async Task MakeGetRequest() + public async Task MakeDeleteRequest() { - string url = "https://api.moesif.com/v1/v1/~/keystore"; - var result = await GetAsync(url); + int id = 1; + string url = "https://api.moesif.com/v1/search/~/users/{id}"; + + await DeleteAsync(id, url); } - /// Performs a GET Request - public async Task GetAsync(string url) + /// Performs a DELETE Request + public async Task DeleteAsync(int id, string url) { - //Start the request - HttpResponseMessage response = await Client.GetAsync(url); - - //Validate result - response.EnsureSuccessStatusCode(); + //Execute DELETE request + HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); + //Return response + await DeserializeObject(response); } - - - /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) { @@ -4964,12 +6453,14 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/v1/~/keystore"); +URL obj = new URL("https://api.moesif.com/v1/search/~/users/{id}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("GET"); +con.setRequestMethod("DELETE"); + +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -4980,57 +6471,41 @@ System.out.println(response.toString()); ``` -`GET /v1/~/keystore` +`DELETE /search/~/users/{id}` + +*Delete a User* -*Get Encrypted keys* +> `DELETE https://api.moesif.com/v1/search/~/users/{id}` -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|from|query|string(date-time)|false|none| -|to|query|string(date-time)|false|none| -|type|undefined|undefined|false|none| - -> Example responses - -> 200 Response - -```json -{ - "_id": "string", - "to": "2019-08-24T14:15:22Z", - "encrypted_key": "string", - "modified_at": "2019-08-24T14:15:22Z", - "from": "2019-08-24T14:15:22Z", - "created_at": "2019-08-24T14:15:22Z", - "app_id": "string", - "type": "string", - "org_id": "string", - "month": "string" -} -``` +|id|path|string|true|none| +|delete_events|query|boolean|false|Delete events associated with the user which can be set to true or false(default)| -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[EncryptedKeyDocument](#schemaencryptedkeydocument)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| -## getEncryptedKey +

Properties

+ +## getProperties - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/v1/~/keystore/{keyId} \ +curl -X GET https://api.moesif.com/v1/search/~/mappings/users/properties?app_id=string \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' @@ -5044,7 +6519,7 @@ const headers = { 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/v1/~/keystore/{keyId}', +fetch('https://api.moesif.com/v1/search/~/mappings/users/properties?app_id=string', { method: 'GET', @@ -5065,7 +6540,10 @@ headers = { 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.get('https://api.moesif.com/v1/v1/~/keystore/{keyId}', headers = headers) +r = requests.get('https://api.moesif.com/v1/search/~/mappings/users/properties', params={ + 'app_id': 'string' + +}, headers = headers) print(r.json()) @@ -5080,9 +6558,11 @@ headers = { 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/v1/~/keystore/{keyId}', +result = RestClient.get 'https://api.moesif.com/v1/search/~/mappings/users/properties', params: { - }, headers: headers + 'app_id' => 'string' + }, + headers: headers p JSON.parse(result) @@ -5100,13 +6580,9 @@ $headers = array( $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('GET','https://api.moesif.com/v1/v1/~/keystore/{keyId}', array( + $response = $client->request('GET','https://api.moesif.com/v1/search/~/mappings/users/properties', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -5134,9 +6610,9 @@ func main() { "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/v1/~/keystore/{keyId}", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/search/~/mappings/users/properties") req.Header = headers client := &http.Client{} @@ -5173,7 +6649,7 @@ public class HttpExample /// Make a dummy request public async Task MakeGetRequest() { - string url = "https://api.moesif.com/v1/v1/~/keystore/{keyId}"; + string url = "https://api.moesif.com/v1/search/~/mappings/users/properties"; var result = await GetAsync(url); } @@ -5205,12 +6681,15 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/v1/~/keystore/{keyId}"); +URL obj = new URL("https://api.moesif.com/v1/search/~/mappings/users/properties?app_id=string"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); + +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -5221,57 +6700,41 @@ System.out.println(response.toString()); ``` -`GET /v1/~/keystore/{keyId}` +`GET /search/~/mappings/users/properties` + +*Get Property Mapping for Users* -*Get Encrypted key* +> `GET https://api.moesif.com/v1/search/~/mappings/users/properties` -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|keyId|path|string|true|none| > Example responses -> 200 Response - -```json -{ - "_id": "string", - "to": "2019-08-24T14:15:22Z", - "encrypted_key": "string", - "modified_at": "2019-08-24T14:15:22Z", - "from": "2019-08-24T14:15:22Z", - "created_at": "2019-08-24T14:15:22Z", - "app_id": "string", - "type": "string", - "org_id": "string", - "month": "string" -} -``` - -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[EncryptedKeyDocument](#schemaencryptedkeydocument)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| + +

Response Schema

-

Workspaces

- -## getWorkspaceToken +## getRequestBodyProperties - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/workspaces/access_token \ +curl -X GET https://api.moesif.com/v1/search/~/mappings/events/request/body/properties?app_id=string&from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' @@ -5285,7 +6748,7 @@ const headers = { 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/workspaces/access_token', +fetch('https://api.moesif.com/v1/search/~/mappings/events/request/body/properties?app_id=string&from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z', { method: 'GET', @@ -5306,7 +6769,10 @@ headers = { 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.get('https://api.moesif.com/v1/workspaces/access_token', headers = headers) +r = requests.get('https://api.moesif.com/v1/search/~/mappings/events/request/body/properties', params={ + 'app_id': 'string', 'from': '2024-04-11T04:01:35.090Z', 'to': '2024-04-11T04:01:35.090Z' + +}, headers = headers) print(r.json()) @@ -5321,9 +6787,13 @@ headers = { 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/workspaces/access_token', +result = RestClient.get 'https://api.moesif.com/v1/search/~/mappings/events/request/body/properties', params: { - }, headers: headers + 'app_id' => 'string', + 'from' => 'string(date-time)', + 'to' => 'string(date-time)' + }, + headers: headers p JSON.parse(result) @@ -5341,13 +6811,9 @@ $headers = array( $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('GET','https://api.moesif.com/v1/workspaces/access_token', array( + $response = $client->request('GET','https://api.moesif.com/v1/search/~/mappings/events/request/body/properties', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -5375,9 +6841,9 @@ func main() { "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/workspaces/access_token", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/search/~/mappings/events/request/body/properties") req.Header = headers client := &http.Client{} @@ -5414,7 +6880,7 @@ public class HttpExample /// Make a dummy request public async Task MakeGetRequest() { - string url = "https://api.moesif.com/v1/workspaces/access_token"; + string url = "https://api.moesif.com/v1/search/~/mappings/events/request/body/properties"; var result = await GetAsync(url); } @@ -5446,12 +6912,15 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/workspaces/access_token"); +URL obj = new URL("https://api.moesif.com/v1/search/~/mappings/events/request/body/properties?app_id=string&from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); + +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -5462,44 +6931,45 @@ System.out.println(response.toString()); ``` -`GET /workspaces/access_token` +`GET /search/~/mappings/events/request/body/properties` -*Get new Workspace Token* +*Get Property Mapping for Events Request Body* -Get a new Workspace Access Token +> `GET https://api.moesif.com/v1/search/~/mappings/events/request/body/properties` -> Example responses +

Parameters

-> 200 Response +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|from|query|string(date-time)|true|none| +|to|query|string(date-time)|true|none| +|include_values|query|boolean|false|none| +|key_path|query|string|false|none| -```json -{ - "_id": "string", - "token": "string", - "url": "string" -} -``` +> Example responses -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[SignedTokenDTO](#schemasignedtokendto)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| + +

Response Schema

-## getWorkspaceTemplates +## getResponseBodyProperties - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/~/workspaces/templates \ +curl -X GET https://api.moesif.com/v1/search/~/mappings/events/response/body/properties?app_id=string&from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' @@ -5513,7 +6983,7 @@ const headers = { 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/workspaces/templates', +fetch('https://api.moesif.com/v1/search/~/mappings/events/response/body/properties?app_id=string&from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z', { method: 'GET', @@ -5534,7 +7004,10 @@ headers = { 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.get('https://api.moesif.com/v1/~/workspaces/templates', headers = headers) +r = requests.get('https://api.moesif.com/v1/search/~/mappings/events/response/body/properties', params={ + 'app_id': 'string', 'from': '2024-04-11T04:01:35.090Z', 'to': '2024-04-11T04:01:35.090Z' + +}, headers = headers) print(r.json()) @@ -5549,9 +7022,13 @@ headers = { 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/~/workspaces/templates', +result = RestClient.get 'https://api.moesif.com/v1/search/~/mappings/events/response/body/properties', params: { - }, headers: headers + 'app_id' => 'string', + 'from' => 'string(date-time)', + 'to' => 'string(date-time)' + }, + headers: headers p JSON.parse(result) @@ -5569,13 +7046,9 @@ $headers = array( $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('GET','https://api.moesif.com/v1/~/workspaces/templates', array( + $response = $client->request('GET','https://api.moesif.com/v1/search/~/mappings/events/response/body/properties', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -5603,9 +7076,9 @@ func main() { "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/workspaces/templates", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/search/~/mappings/events/response/body/properties") req.Header = headers client := &http.Client{} @@ -5642,7 +7115,7 @@ public class HttpExample /// Make a dummy request public async Task MakeGetRequest() { - string url = "https://api.moesif.com/v1/~/workspaces/templates"; + string url = "https://api.moesif.com/v1/search/~/mappings/events/response/body/properties"; var result = await GetAsync(url); } @@ -5674,12 +7147,15 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/workspaces/templates"); +URL obj = new URL("https://api.moesif.com/v1/search/~/mappings/events/response/body/properties?app_id=string&from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); + +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -5690,214 +7166,48 @@ System.out.println(response.toString()); ``` -`GET /~/workspaces/templates` +`GET /search/~/mappings/events/response/body/properties` -*Get Workspace Templates* +*Get Property Mapping for Events Response Body* -

Parameters

+> `GET https://api.moesif.com/v1/search/~/mappings/events/response/body/properties` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| +|from|query|string(date-time)|true|none| +|to|query|string(date-time)|true|none| +|include_values|query|boolean|false|none| +|key_path|query|string|false|none| > Example responses -> 200 Response - -```json -[ - { - "name": "string", - "is_default": true, - "view_count": 0, - "_id": "string", - "is_template": true, - "dashboard": {}, - "auth_user_id": "string", - "colors": {}, - "sequence": [ - { - "delay": 0, - "submit_data": { - "body": {}, - "url": "string", - "params": [ - { - "key": "string", - "val": "string" - } - ], - "verb": "string", - "headers": [ - { - "key": "string", - "val": "string" - } - ] - } - } - ], - "drawings": [ - { - "name": "string", - "direction": "string", - "id": "string", - "type": "string", - "value": 0 - } - ], - "chart": { - "original_encoded_view_elements": "string", - "funnel_query": {}, - "url_query": "string", - "to": "string", - "view_elements": {}, - "from": "string", - "original_encoded_funnel_query": "string", - "es_query": {}, - "args": "string", - "original_encoded_query": "string", - "time_zone": "string", - "view": "string" - }, - "template": { - "dynamic_fields": [ - "string" - ], - "dynamic_time": true - }, - "app_id": "string", - "type": "string", - "width": 0, - "sort_order": 0, - "policy": { - "acl": [ - { - "grantee": "string", - "permission": "string" - } - ], - "resource": {}, - "api_scopes": [ - "string" - ], - "original_encoded_resource": "string" - }, - "org_id": "string", - "migration": {}, - "created": "2019-08-24T14:15:22Z", - "comments": { - "summary": { - "count": 0, - "latest_comment": { - "auth_user_id": "string", - "comment_id": "string", - "mentions": [ - "string" - ], - "partner_user_id": "string", - "message": "string", - "created_at": "2019-08-24T14:15:22Z", - "updated_at": "2019-08-24T14:15:22Z" - } - } - } - } -] -``` - -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|Inline| - -

Response Schema

- -Status Code **200** +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|*anonymous*|[[WorkspaceDocument](#schemaworkspacedocument)]|false|none|none| -|» name|string|false|none|none| -|» is_default|boolean|false|none|none| -|» view_count|integer(int32)|true|none|none| -|» _id|string|false|none|none| -|» is_template|boolean|false|none|none| -|» dashboard|object|false|none|none| -|» auth_user_id|string|true|none|none| -|» colors|object|false|none|none| -|» sequence|[[SequenceItem](#schemasequenceitem)]|false|none|none| -|»» delay|integer(int32)|true|none|none| -|»» submit_data|object|true|none|none| -|»»» body|object|false|none|none| -|»»» url|string|true|none|none| -|»»» params|[[KeyValuePair](#schemakeyvaluepair)]|false|none|none| -|»»»» key|string|true|none|none| -|»»»» val|string|true|none|none| -|»»» verb|string|true|none|none| -|»»» headers|[[KeyValuePair](#schemakeyvaluepair)]|false|none|none| -|» drawings|[[DrawingItem](#schemadrawingitem)]|false|none|none| -|»» name|string|true|none|none| -|»» direction|string|true|none|none| -|»» id|string|true|none|none| -|»» type|string|true|none|none| -|»» value|number(double)|true|none|none| -|» chart|object|false|none|none| -|»» original_encoded_view_elements|string|false|none|none| -|»» funnel_query|object|false|none|none| -|»» url_query|string|true|none|none| -|»» to|string|false|none|none| -|»» view_elements|object|false|none|none| -|»» from|string|false|none|none| -|»» original_encoded_funnel_query|string|false|none|none| -|»» es_query|object|false|none|none| -|»» args|string|false|none|none| -|»» original_encoded_query|string|false|none|none| -|»» time_zone|string|false|none|none| -|»» view|string|true|none|none| -|» template|object|false|none|none| -|»» dynamic_fields|[string]|true|none|none| -|»» dynamic_time|boolean|false|none|none| -|» app_id|string|true|none|none| -|» type|string|false|none|none| -|» width|number(double)|false|none|none| -|» sort_order|number(double)|false|none|none| -|» policy|object|false|none|none| -|»» acl|[[ACLItem](#schemaaclitem)]|true|none|none| -|»»» grantee|string|true|none|none| -|»»» permission|string|true|none|none| -|»» resource|object|true|none|none| -|»» api_scopes|[string]|false|none|none| -|»» original_encoded_resource|string|false|none|none| -|» org_id|string|true|none|none| -|» migration|object|false|none|none| -|» created|string(date-time)|true|none|none| -|» comments|object|false|none|none| -|»» summary|object|true|none|none| -|»»» count|integer(int32)|true|none|none| -|»»» latest_comment|object|false|none|none| -|»»»» auth_user_id|string|false|none|none| -|»»»» comment_id|string|false|none|none| -|»»»» mentions|[string]|false|none|none| -|»»»» partner_user_id|string|false|none|none| -|»»»» message|string|false|none|none| -|»»»» created_at|string(date-time)|false|none|none| -|»»»» updated_at|string(date-time)|false|none|none| +

Response Schema

-## updateComment +

Workspaces

- +## getWorkspaceToken + + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId} \ +curl -X GET https://api.moesif.com/v1/workspaces/access_token \ + -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -5906,12 +7216,13 @@ curl -X POST https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId} \ const fetch = require('node-fetch'); const headers = { + 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}', +fetch('https://api.moesif.com/v1/workspaces/access_token', { - method: 'POST', + method: 'GET', headers: headers }) @@ -5926,10 +7237,11 @@ fetch('https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}', ```python import requests headers = { + 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.post('https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}', headers = headers) +r = requests.get('https://api.moesif.com/v1/workspaces/access_token', headers = headers) print(r.json()) @@ -5940,12 +7252,14 @@ require 'rest-client' require 'json' headers = { + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}', +result = RestClient.get 'https://api.moesif.com/v1/workspaces/access_token', params: { - }, headers: headers + }, + headers: headers p JSON.parse(result) @@ -5957,18 +7271,15 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('POST','https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}', array( + $response = $client->request('GET','https://api.moesif.com/v1/workspaces/access_token', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -5993,11 +7304,12 @@ import ( func main() { headers := map[string][]string{ + "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/workspaces/access_token") req.Header = headers client := &http.Client{} @@ -6031,38 +7343,26 @@ public class HttpExample Client = new HttpClient(); } - /// Make a dummy request - public async Task MakePostRequest() + public async Task MakeGetRequest() { - string url = "https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}"; - - - await PostAsync(null, url); - + string url = "https://api.moesif.com/v1/workspaces/access_token"; + var result = await GetAsync(url); } - /// Performs a POST Request - public async Task PostAsync(undefined content, string url) + /// Performs a GET Request + public async Task GetAsync(string url) { - //Serialize Object - StringContent jsonContent = SerializeObject(content); + //Start the request + HttpResponseMessage response = await Client.GetAsync(url); + + //Validate result + response.EnsureSuccessStatusCode(); - //Execute POST request - HttpResponseMessage response = await Client.PostAsync(url, jsonContent); } - /// Serialize an object to Json - private StringContent SerializeObject(undefined content) - { - //Serialize Object - string jsonObject = JsonConvert.SerializeObject(content); - - //Create Json UTF8 String Content - return new StringContent(jsonObject, Encoding.UTF8, "application/json"); - } /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) @@ -6078,12 +7378,15 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}"); +URL obj = new URL("https://api.moesif.com/v1/workspaces/access_token"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("POST"); +con.setRequestMethod("GET"); + +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -6094,37 +7397,47 @@ System.out.println(response.toString()); ``` -`POST /~/workspaces/{id}/comments/{commentId}` +`GET /workspaces/access_token` -*Update Existing Comment* +*Get new Workspace Token* -

Parameters

+Get a new Workspace Access Token -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|id|path|string|true|none| -|commentId|path|string|true|none| +> `GET https://api.moesif.com/v1/workspaces/access_token` -

Responses

+> Example responses + +> 200 Response + +```json +{ + "_id": "string", + "token": "string", + "url": "string" +} +``` + +

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|None| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[SignedToken](#schemasignedtokendto)| -## deleteComment +## getPublicWorkspace - + > Code samples ```shell # You can also use wget -curl -X DELETE https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId} \ +curl -X GET https://api.moesif.com/v1/workspaces/public/{id} \ + -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -6133,12 +7446,13 @@ curl -X DELETE https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId} const fetch = require('node-fetch'); const headers = { + 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}', +fetch('https://api.moesif.com/v1/workspaces/public/{id}', { - method: 'DELETE', + method: 'GET', headers: headers }) @@ -6153,10 +7467,11 @@ fetch('https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}', ```python import requests headers = { + 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.delete('https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}', headers = headers) +r = requests.get('https://api.moesif.com/v1/workspaces/public/{id}', headers = headers) print(r.json()) @@ -6167,12 +7482,14 @@ require 'rest-client' require 'json' headers = { + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.delete 'https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}', +result = RestClient.get 'https://api.moesif.com/v1/workspaces/public/{id}', params: { - }, headers: headers + }, + headers: headers p JSON.parse(result) @@ -6184,18 +7501,15 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('DELETE','https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}', array( + $response = $client->request('GET','https://api.moesif.com/v1/workspaces/public/{id}', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -6220,11 +7534,12 @@ import ( func main() { headers := map[string][]string{ + "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/workspaces/public/{id}") req.Header = headers client := &http.Client{} @@ -6258,28 +7573,27 @@ public class HttpExample Client = new HttpClient(); } - - - /// Make a dummy request - public async Task MakeDeleteRequest() + public async Task MakeGetRequest() { - int id = 1; - string url = "https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}"; - - await DeleteAsync(id, url); + string url = "https://api.moesif.com/v1/workspaces/public/{id}"; + var result = await GetAsync(url); } - /// Performs a DELETE Request - public async Task DeleteAsync(int id, string url) + /// Performs a GET Request + public async Task GetAsync(string url) { - //Execute DELETE request - HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); + //Start the request + HttpResponseMessage response = await Client.GetAsync(url); + + //Validate result + response.EnsureSuccessStatusCode(); - //Return response - await DeserializeObject(response); } + + + /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) { @@ -6294,13 +7608,16 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}"); +URL obj = new URL("https://api.moesif.com/v1/workspaces/public/{id}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("DELETE"); -int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); -String inputLine; +con.setRequestMethod("GET"); + +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +int responseCode = con.getResponseCode(); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); +String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); @@ -6310,52 +7627,264 @@ System.out.println(response.toString()); ``` -`DELETE /~/workspaces/{id}/comments/{commentId}` +`GET /workspaces/public/{id}` -*Delete a Comment* +*Get a Public Workspace* -

Parameters

+> `GET https://api.moesif.com/v1/workspaces/public/{id}` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| |id|path|string|true|none| -|commentId|path|string|true|none| -

Responses

+> Example responses + +> 200 Response + +```json +{ + "name": "string", + "is_default": true, + "view_count": 0, + "_id": "string", + "is_template": true, + "dashboard": {}, + "auth_user_id": "string", + "colors": {}, + "sequence": [ + { + "delay": 0, + "submit_data": { + "body": {}, + "url": "string", + "params": [ + { + "key": null, + "val": null + } + ], + "verb": "string", + "headers": [ + { + "key": null, + "val": null + } + ] + } + } + ], + "drawings": [ + { + "name": "string", + "direction": "string", + "id": "string", + "type": "string", + "value": 0.1 + } + ], + "chart": { + "original_encoded_view_elements": "string", + "funnel_query": {}, + "url_query": "string", + "to": "string", + "view_elements": {}, + "from": "string", + "original_encoded_funnel_query": "string", + "es_query": {}, + "args": "string", + "original_encoded_query": "string", + "time_zone": "string", + "view": "string" + }, + "template": { + "dynamic_fields": [ + "string" + ], + "dynamic_time": true + }, + "app_id": "string", + "type": "string", + "width": 0.1, + "sort_order": 0.1, + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + }, + "org_id": "string", + "migration": {}, + "created": "2024-04-11T04:01:35.090Z", + "comments": { + "summary": { + "count": 0, + "latest_comment": { + "auth_user_id": "string", + "comment_id": "string", + "mentions": [ + "string" + ], + "partner_user_id": "string", + "message": "string", + "created_at": "2024-04-11T04:01:35.090Z", + "updated_at": "2024-04-11T04:01:35.090Z" + } + } + } +} +``` + +

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|204|[No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5)|success|None| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[WorkspaceDocument](#schemaworkspacedocument)| -## updateWorkspace +## createWorkspace - + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/~/workspaces/{id} \ +curl -X POST https://api.moesif.com/v1/~/workspaces \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + -d '{ + "name": "string", + "is_default": true, + "view_count": 0, + "dashboard": {}, + "colors": {}, + "drawings": [ + { + "name": "string", + "direction": "string", + "id": "string", + "type": "string", + "value": 0.1 + } + ], + "chart": { + "original_encoded_view_elements": "string", + "funnel_query": {}, + "url_query": "string", + "to": "string", + "view_elements": {}, + "from": "string", + "original_encoded_funnel_query": "string", + "es_query": {}, + "args": "string", + "original_encoded_query": "string", + "time_zone": "string", + "view": "string" + }, + "template": { + "dynamic_fields": [ + "string" + ], + "dynamic_time": true + }, + "type": "string", + "width": 0.1, + "sort_order": 0.1, + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + } +}' ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = { + "name": "string", + "is_default": true, + "view_count": 0, + "dashboard": {}, + "colors": {}, + "drawings": [ + { + "name": "string", + "direction": "string", + "id": "string", + "type": "string", + "value": 0.1 + } + ], + "chart": { + "original_encoded_view_elements": "string", + "funnel_query": {}, + "url_query": "string", + "to": "string", + "view_elements": {}, + "from": "string", + "original_encoded_funnel_query": "string", + "es_query": {}, + "args": "string", + "original_encoded_query": "string", + "time_zone": "string", + "view": "string" + }, + "template": { + "dynamic_fields": [ + "string" + ], + "dynamic_time": true + }, + "type": "string", + "width": 0.1, + "sort_order": 0.1, + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + } +}; const headers = { + 'Content-Type':'application/json', + 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/workspaces/{id}', +fetch('https://api.moesif.com/v1/~/workspaces', { method: 'POST', - + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -6369,49 +7898,212 @@ fetch('https://api.moesif.com/v1/~/workspaces/{id}', ```python import requests headers = { + 'Content-Type': 'application/json', + 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } - -r = requests.post('https://api.moesif.com/v1/~/workspaces/{id}', headers = headers) - -print(r.json()) - -``` - -```ruby -require 'rest-client' -require 'json' - -headers = { - 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' -} - -result = RestClient.post 'https://api.moesif.com/v1/~/workspaces/{id}', - params: { - }, headers: headers - -p JSON.parse(result) - -``` - -```php - 'Bearer YOUR_MANAGEMENT_API_KEY', -); - -$client = new \GuzzleHttp\Client(); - -// Define array of request body. -$request_body = array(); - -try { - $response = $client->request('POST','https://api.moesif.com/v1/~/workspaces/{id}', array( +input_body = { + "name": "string", + "is_default": true, + "view_count": 0, + "dashboard": {}, + "colors": {}, + "drawings": [ + { + "name": "string", + "direction": "string", + "id": "string", + "type": "string", + "value": 0.1 + } + ], + "chart": { + "original_encoded_view_elements": "string", + "funnel_query": {}, + "url_query": "string", + "to": "string", + "view_elements": {}, + "from": "string", + "original_encoded_funnel_query": "string", + "es_query": {}, + "args": "string", + "original_encoded_query": "string", + "time_zone": "string", + "view": "string" + }, + "template": { + "dynamic_fields": [ + "string" + ], + "dynamic_time": true + }, + "type": "string", + "width": 0.1, + "sort_order": 0.1, + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + } +} + +r = requests.post('https://api.moesif.com/v1/~/workspaces', headers = headers, json = input_data) + +print(r.json()) + +``` + +```ruby +require 'rest-client' +require 'json' + +headers = { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json', + 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' +} + +input_payload = JSON.parse('{ + "name": "string", + "is_default": true, + "view_count": 0, + "dashboard": {}, + "colors": {}, + "drawings": [ + { + "name": "string", + "direction": "string", + "id": "string", + "type": "string", + "value": 0.1 + } + ], + "chart": { + "original_encoded_view_elements": "string", + "funnel_query": {}, + "url_query": "string", + "to": "string", + "view_elements": {}, + "from": "string", + "original_encoded_funnel_query": "string", + "es_query": {}, + "args": "string", + "original_encoded_query": "string", + "time_zone": "string", + "view": "string" + }, + "template": { + "dynamic_fields": [ + "string" + ], + "dynamic_time": true + }, + "type": "string", + "width": 0.1, + "sort_order": 0.1, + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + } +}') + +result = RestClient.post 'https://api.moesif.com/v1/~/workspaces', + params: { + }, + payload: input_payload.to_json, + headers: headers + +p JSON.parse(result) + +``` + +```php + 'application/json', + 'Accept' => 'application/json', + 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', +); + +$inputPayload = json_decode('{ + "name": "string", + "is_default": true, + "view_count": 0, + "dashboard": {}, + "colors": {}, + "drawings": [ + { + "name": "string", + "direction": "string", + "id": "string", + "type": "string", + "value": 0.1 + } + ], + "chart": { + "original_encoded_view_elements": "string", + "funnel_query": {}, + "url_query": "string", + "to": "string", + "view_elements": {}, + "from": "string", + "original_encoded_funnel_query": "string", + "es_query": {}, + "args": "string", + "original_encoded_query": "string", + "time_zone": "string", + "view": "string" + }, + "template": { + "dynamic_fields": [ + "string" + ], + "dynamic_time": true + }, + "type": "string", + "width": 0.1, + "sort_order": 0.1, + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + } +}') + +$client = new \GuzzleHttp\Client(); + +try { + $response = $client->request('POST','https://api.moesif.com/v1/~/workspaces', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -6436,11 +8128,64 @@ import ( func main() { headers := map[string][]string{ + "Content-Type": []string{"application/json"}, + "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/workspaces/{id}", data) + jsonPayload := `{ + "name": "string", + "is_default": true, + "view_count": 0, + "dashboard": {}, + "colors": {}, + "drawings": [ + { + "name": "string", + "direction": "string", + "id": "string", + "type": "string", + "value": 0.1 + } + ], + "chart": { + "original_encoded_view_elements": "string", + "funnel_query": {}, + "url_query": "string", + "to": "string", + "view_elements": {}, + "from": "string", + "original_encoded_funnel_query": "string", + "es_query": {}, + "args": "string", + "original_encoded_query": "string", + "time_zone": "string", + "view": "string" + }, + "template": { + "dynamic_fields": [ + "string" + ], + "dynamic_time": true + }, + "type": "string", + "width": 0.1, + "sort_order": 0.1, + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + } +}` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/workspaces", data) req.Header = headers client := &http.Client{} @@ -6478,15 +8223,68 @@ public class HttpExample /// Make a dummy request public async Task MakePostRequest() { - string url = "https://api.moesif.com/v1/~/workspaces/{id}"; + string url = "https://api.moesif.com/v1/~/workspaces"; + string json = @"{ + ""name"": ""string"", + ""is_default"": true, + ""view_count"": 0, + ""dashboard"": {}, + ""colors"": {}, + ""drawings"": [ + { + ""name"": ""string"", + ""direction"": ""string"", + ""id"": ""string"", + ""type"": ""string"", + ""value"": 0.1 + } + ], + ""chart"": { + ""original_encoded_view_elements"": ""string"", + ""funnel_query"": {}, + ""url_query"": ""string"", + ""to"": ""string"", + ""view_elements"": {}, + ""from"": ""string"", + ""original_encoded_funnel_query"": ""string"", + ""es_query"": {}, + ""args"": ""string"", + ""original_encoded_query"": ""string"", + ""time_zone"": ""string"", + ""view"": ""string"" + }, + ""template"": { + ""dynamic_fields"": [ + ""string"" + ], + ""dynamic_time"": true + }, + ""type"": ""string"", + ""width"": 0.1, + ""sort_order"": 0.1, + ""policy"": { + ""acl"": [ + { + ""grantee"": ""string"", + ""permission"": ""string"" + } + ], + ""resource"": {}, + ""api_scopes"": [ + ""string"" + ], + ""original_encoded_resource"": ""string"" + } +}"; + var content = JsonConvert.DeserializeObject(json); + await PostAsync(content, url); - await PostAsync(null, url); } /// Performs a POST Request - public async Task PostAsync(undefined content, string url) + public async Task PostAsync(WorkspaceCreateItem content, string url) { //Serialize Object StringContent jsonContent = SerializeObject(content); @@ -6498,7 +8296,7 @@ public class HttpExample /// Serialize an object to Json - private StringContent SerializeObject(undefined content) + private StringContent SerializeObject(WorkspaceCreateItem content) { //Serialize Object string jsonObject = JsonConvert.SerializeObject(content); @@ -6521,52 +8319,282 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}"); +URL obj = new URL("https://api.moesif.com/v1/~/workspaces"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); -int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); -String inputLine; -StringBuffer response = new StringBuffer(); -while ((inputLine = in.readLine()) != null) { - response.append(inputLine); -} -in.close(); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """{ + "name": "string", + "is_default": true, + "view_count": 0, + "dashboard": {}, + "colors": {}, + "drawings": [ + { + "name": "string", + "direction": "string", + "id": "string", + "type": "string", + "value": 0.1 + } + ], + "chart": { + "original_encoded_view_elements": "string", + "funnel_query": {}, + "url_query": "string", + "to": "string", + "view_elements": {}, + "from": "string", + "original_encoded_funnel_query": "string", + "es_query": {}, + "args": "string", + "original_encoded_query": "string", + "time_zone": "string", + "view": "string" + }, + "template": { + "dynamic_fields": [ + "string" + ], + "dynamic_time": true + }, + "type": "string", + "width": 0.1, + "sort_order": 0.1, + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + } +}"""; + +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} + +int responseCode = con.getResponseCode(); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); +String inputLine; +StringBuffer response = new StringBuffer(); +while ((inputLine = in.readLine()) != null) { + response.append(inputLine); +} +in.close(); System.out.println(response.toString()); ``` -`POST /~/workspaces/{id}` +`POST /~/workspaces` -*Update a Workspace* +*Create New Workspace* -

Parameters

+> `POST https://api.moesif.com/v1/~/workspaces` + +> Example Request + +```json +{ + "name": "string", + "is_default": true, + "view_count": 0, + "dashboard": {}, + "colors": {}, + "drawings": [ + { + "name": "string", + "direction": "string", + "id": "string", + "type": "string", + "value": 0.1 + } + ], + "chart": { + "original_encoded_view_elements": "string", + "funnel_query": {}, + "url_query": "string", + "to": "string", + "view_elements": {}, + "from": "string", + "original_encoded_funnel_query": "string", + "es_query": {}, + "args": "string", + "original_encoded_query": "string", + "time_zone": "string", + "view": "string" + }, + "template": { + "dynamic_fields": [ + "string" + ], + "dynamic_time": true + }, + "type": "string", + "width": 0.1, + "sort_order": 0.1, + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + } +} +``` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|id|path|string|true|none| +|expiration|query|string(date-time)|false|none| +|body|body|[WorkspaceCreateItem](#schemaworkspacecreateitem)|true|none| -

Responses

+> Example responses + +> 201 Response + +```json +{ + "name": "string", + "is_default": true, + "view_count": 0, + "_id": "string", + "is_template": true, + "dashboard": {}, + "auth_user_id": "string", + "colors": {}, + "sequence": [ + { + "delay": 0, + "submit_data": { + "body": {}, + "url": "string", + "params": [ + { + "key": null, + "val": null + } + ], + "verb": "string", + "headers": [ + { + "key": null, + "val": null + } + ] + } + } + ], + "drawings": [ + { + "name": "string", + "direction": "string", + "id": "string", + "type": "string", + "value": 0.1 + } + ], + "chart": { + "original_encoded_view_elements": "string", + "funnel_query": {}, + "url_query": "string", + "to": "string", + "view_elements": {}, + "from": "string", + "original_encoded_funnel_query": "string", + "es_query": {}, + "args": "string", + "original_encoded_query": "string", + "time_zone": "string", + "view": "string" + }, + "template": { + "dynamic_fields": [ + "string" + ], + "dynamic_time": true + }, + "app_id": "string", + "type": "string", + "width": 0.1, + "sort_order": 0.1, + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + }, + "org_id": "string", + "migration": {}, + "created": "2024-04-11T04:01:35.090Z", + "comments": { + "summary": { + "count": 0, + "latest_comment": { + "auth_user_id": "string", + "comment_id": "string", + "mentions": [ + "string" + ], + "partner_user_id": "string", + "message": "string", + "created_at": "2024-04-11T04:01:35.090Z", + "updated_at": "2024-04-11T04:01:35.090Z" + } + } + } +} +``` + +

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| +|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|[WorkspaceDocument](#schemaworkspacedocument)| -## getWorkspace +## getWorkspaces - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/~/workspaces/{id} \ +curl -X GET https://api.moesif.com/v1/~/workspaces?take=0&access=string \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' @@ -6580,7 +8608,7 @@ const headers = { 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/workspaces/{id}', +fetch('https://api.moesif.com/v1/~/workspaces?take=0&access=string', { method: 'GET', @@ -6601,7 +8629,12 @@ headers = { 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.get('https://api.moesif.com/v1/~/workspaces/{id}', headers = headers) +r = requests.get('https://api.moesif.com/v1/~/workspaces', params={ + 'take': '0', 'access': [ + "string" +] + +}, headers = headers) print(r.json()) @@ -6616,9 +8649,12 @@ headers = { 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/~/workspaces/{id}', +result = RestClient.get 'https://api.moesif.com/v1/~/workspaces', params: { - }, headers: headers + 'take' => 'integer(int32)', + 'access' => 'array[string]' + }, + headers: headers p JSON.parse(result) @@ -6636,13 +8672,9 @@ $headers = array( $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('GET','https://api.moesif.com/v1/~/workspaces/{id}', array( + $response = $client->request('GET','https://api.moesif.com/v1/~/workspaces', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -6670,9 +8702,9 @@ func main() { "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/workspaces/{id}", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/workspaces") req.Header = headers client := &http.Client{} @@ -6709,7 +8741,7 @@ public class HttpExample /// Make a dummy request public async Task MakeGetRequest() { - string url = "https://api.moesif.com/v1/~/workspaces/{id}"; + string url = "https://api.moesif.com/v1/~/workspaces"; var result = await GetAsync(url); } @@ -6741,12 +8773,15 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}"); +URL obj = new URL("https://api.moesif.com/v1/~/workspaces?take=0&access=string"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); + +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -6757,140 +8792,215 @@ System.out.println(response.toString()); ``` -`GET /~/workspaces/{id}` +`GET /~/workspaces` -*Get a Workspace* +*Get Workspaces* -

Parameters

+> `GET https://api.moesif.com/v1/~/workspaces` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|id|path|string|true|none| +|take|query|integer(int32)|true|none| +|before_id|query|string|false|none| +|`type`|query|string|false|none| +|access|query|array[string]|true|none| > Example responses > 200 Response ```json -{ - "name": "string", - "is_default": true, - "view_count": 0, - "_id": "string", - "is_template": true, - "dashboard": {}, - "auth_user_id": "string", - "colors": {}, - "sequence": [ - { - "delay": 0, - "submit_data": { - "body": {}, - "url": "string", - "params": [ - { - "key": "string", - "val": "string" - } - ], - "verb": "string", - "headers": [ - { - "key": "string", - "val": "string" - } - ] +[ + { + "name": "string", + "is_default": true, + "view_count": 0, + "_id": "string", + "is_template": true, + "dashboard": {}, + "auth_user_id": "string", + "colors": {}, + "sequence": [ + { + "delay": 0, + "submit_data": { + "body": {}, + "url": "string", + "params": [ + {} + ], + "verb": "string", + "headers": [ + {} + ] + } } - } - ], - "drawings": [ - { - "name": "string", - "direction": "string", - "id": "string", - "type": "string", - "value": 0 - } - ], - "chart": { - "original_encoded_view_elements": "string", - "funnel_query": {}, - "url_query": "string", - "to": "string", - "view_elements": {}, - "from": "string", - "original_encoded_funnel_query": "string", - "es_query": {}, - "args": "string", - "original_encoded_query": "string", - "time_zone": "string", - "view": "string" - }, - "template": { - "dynamic_fields": [ - "string" ], - "dynamic_time": true - }, - "app_id": "string", - "type": "string", - "width": 0, - "sort_order": 0, - "policy": { - "acl": [ + "drawings": [ { - "grantee": "string", - "permission": "string" + "name": "string", + "direction": "string", + "id": "string", + "type": "string", + "value": 0.1 } ], - "resource": {}, - "api_scopes": [ - "string" - ], - "original_encoded_resource": "string" - }, - "org_id": "string", - "migration": {}, - "created": "2019-08-24T14:15:22Z", - "comments": { - "summary": { - "count": 0, - "latest_comment": { - "auth_user_id": "string", - "comment_id": "string", - "mentions": [ - "string" - ], - "partner_user_id": "string", - "message": "string", - "created_at": "2019-08-24T14:15:22Z", - "updated_at": "2019-08-24T14:15:22Z" + "chart": { + "original_encoded_view_elements": "string", + "funnel_query": {}, + "url_query": "string", + "to": "string", + "view_elements": {}, + "from": "string", + "original_encoded_funnel_query": "string", + "es_query": {}, + "args": "string", + "original_encoded_query": "string", + "time_zone": "string", + "view": "string" + }, + "template": { + "dynamic_fields": [ + "string" + ], + "dynamic_time": true + }, + "app_id": "string", + "type": "string", + "width": 0.1, + "sort_order": 0.1, + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + }, + "org_id": "string", + "migration": {}, + "created": "2024-04-11T04:01:35.090Z", + "comments": { + "summary": { + "count": 0, + "latest_comment": { + "auth_user_id": "string", + "comment_id": "string", + "mentions": [ + null + ], + "partner_user_id": "string", + "message": "string", + "created_at": "2024-04-11T04:01:35.090Z", + "updated_at": "2024-04-11T04:01:35.090Z" + } } } } -} +] ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[WorkspaceDocument](#schemaworkspacedocument)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|Inline| + +

Response Schema

+ +Status Code **200** + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|*anonymous*|[[WorkspaceDocument](#schemaworkspacedocument)]|false|none|none| +|» name|string|false|none|none| +|» is_default|boolean|false|none|none| +|» view_count|integer(int32)|true|none|none| +|» _id|string|false|none|none| +|» is_template|boolean|false|none|none| +|» dashboard|object|false|none|none| +|» auth_user_id|string|true|none|none| +|» colors|object|false|none|none| +|» sequence|[[SequenceItem](#schemasequenceitem)]|false|none|none| +|»» delay|integer(int32)|true|none|none| +|»» submit_data|object|true|none|none| +|»»» body|object|false|none|none| +|»»» url|string|true|none|none| +|»»» params|[[KeyValuePair](#schemakeyvaluepair)]|false|none|none| +|»»»» key|string|true|none|none| +|»»»» val|string|true|none|none| +|»»» verb|string|true|none|none| +|»»» headers|[[KeyValuePair](#schemakeyvaluepair)]|false|none|none| +|» drawings|[[DrawingItem](#schemadrawingitem)]|false|none|none| +|»» name|string|true|none|none| +|»» direction|string|true|none|none| +|»» id|string|true|none|none| +|»» type|string|true|none|none| +|»» value|number(double)|true|none|none| +|» chart|object|false|none|none| +|»» original_encoded_view_elements|string|false|none|none| +|»» funnel_query|object|false|none|none| +|»» url_query|string|true|none|none| +|»» to|string|false|none|none| +|»» view_elements|object|false|none|none| +|»» from|string|false|none|none| +|»» original_encoded_funnel_query|string|false|none|none| +|»» es_query|object|false|none|none| +|»» args|string|false|none|none| +|»» original_encoded_query|string|false|none|none| +|»» time_zone|string|false|none|none| +|»» view|string|true|none|none| +|» template|object|false|none|none| +|»» dynamic_fields|[string]|true|none|none| +|»» dynamic_time|boolean|false|none|none| +|» app_id|string|true|none|none| +|» type|string|false|none|none| +|» width|number(double)|false|none|none| +|» sort_order|number(double)|false|none|none| +|» policy|object|false|none|none| +|»» acl|[[ACLItem](#schemaaclitem)]|true|none|none| +|»»» grantee|string|true|none|none| +|»»» permission|string|true|none|none| +|»» resource|object|true|none|none| +|»» api_scopes|[string]|false|none|none| +|»» original_encoded_resource|string|false|none|none| +|» org_id|string|true|none|none| +|» migration|object|false|none|none| +|» created|string(date-time)|true|none|none| +|» comments|object|false|none|none| +|»» summary|object|true|none|none| +|»»» count|integer(int32)|true|none|none| +|»»» latest_comment|object|false|none|none| +|»»»» auth_user_id|string|false|none|none| +|»»»» comment_id|string|false|none|none| +|»»»» mentions|[string]|false|none|none| +|»»»» partner_user_id|string|false|none|none| +|»»»» message|string|false|none|none| +|»»»» created_at|string(date-time)|false|none|none| +|»»»» updated_at|string(date-time)|false|none|none| -## deleteWorkspace +## getWorkspaceTemplates - + > Code samples ```shell # You can also use wget -curl -X DELETE https://api.moesif.com/v1/~/workspaces/{id} \ +curl -X GET https://api.moesif.com/v1/~/workspaces/templates \ + -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -6899,12 +9009,13 @@ curl -X DELETE https://api.moesif.com/v1/~/workspaces/{id} \ const fetch = require('node-fetch'); const headers = { + 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/workspaces/{id}', +fetch('https://api.moesif.com/v1/~/workspaces/templates', { - method: 'DELETE', + method: 'GET', headers: headers }) @@ -6919,228 +9030,11 @@ fetch('https://api.moesif.com/v1/~/workspaces/{id}', ```python import requests headers = { + 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.delete('https://api.moesif.com/v1/~/workspaces/{id}', headers = headers) - -print(r.json()) - -``` - -```ruby -require 'rest-client' -require 'json' - -headers = { - 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' -} - -result = RestClient.delete 'https://api.moesif.com/v1/~/workspaces/{id}', - params: { - }, headers: headers - -p JSON.parse(result) - -``` - -```php - 'Bearer YOUR_MANAGEMENT_API_KEY', -); - -$client = new \GuzzleHttp\Client(); - -// Define array of request body. -$request_body = array(); - -try { - $response = $client->request('DELETE','https://api.moesif.com/v1/~/workspaces/{id}', array( - 'headers' => $headers, - 'json' => $request_body, - ) - ); - print_r($response->getBody()->getContents()); - } - catch (\GuzzleHttp\Exception\BadResponseException $e) { - // handle exception or api errors. - print_r($e->getMessage()); - } - - // ... - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/workspaces/{id}", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```csharp -using System; -using System.Collections.Generic; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Text; -using System.Threading.Tasks; -using Newtonsoft.Json; - -/// <> -/// Example of Http Client -/// <> -public class HttpExample -{ - private HttpClient Client { get; set; } - - /// <> - /// Setup http client - /// <> - public HttpExample() - { - Client = new HttpClient(); - } - - - - - /// Make a dummy request - public async Task MakeDeleteRequest() - { - int id = 1; - string url = "https://api.moesif.com/v1/~/workspaces/{id}"; - - await DeleteAsync(id, url); - } - - /// Performs a DELETE Request - public async Task DeleteAsync(int id, string url) - { - //Execute DELETE request - HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); - - //Return response - await DeserializeObject(response); - } - - /// Deserialize object from request response - private async Task DeserializeObject(HttpResponseMessage response) - { - //Read body - string responseBody = await response.Content.ReadAsStringAsync(); - - //Deserialize Body to object - var result = JsonConvert.DeserializeObject(responseBody); - } -} - -``` - -```java -URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}"); -HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("DELETE"); -int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); -String inputLine; -StringBuffer response = new StringBuffer(); -while ((inputLine = in.readLine()) != null) { - response.append(inputLine); -} -in.close(); -System.out.println(response.toString()); - -``` - -`DELETE /~/workspaces/{id}` - -*Delete a Workspace* - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|id|path|string|true|none| - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| - - - -## getPublicWorkspace - - - -> Code samples - -```shell -# You can also use wget -curl -X GET https://api.moesif.com/v1/workspaces/public/{id} \ - -H 'Accept: application/json' \ - -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' - -``` - -```javascript--nodejs -const fetch = require('node-fetch'); - -const headers = { - 'Accept':'application/json', - 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' -}; - -fetch('https://api.moesif.com/v1/workspaces/public/{id}', -{ - method: 'GET', - - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Accept': 'application/json', - 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' -} - -r = requests.get('https://api.moesif.com/v1/workspaces/public/{id}', headers = headers) +r = requests.get('https://api.moesif.com/v1/~/workspaces/templates', headers = headers) print(r.json()) @@ -7155,9 +9049,10 @@ headers = { 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/workspaces/public/{id}', +result = RestClient.get 'https://api.moesif.com/v1/~/workspaces/templates', params: { - }, headers: headers + }, + headers: headers p JSON.parse(result) @@ -7175,13 +9070,9 @@ $headers = array( $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('GET','https://api.moesif.com/v1/workspaces/public/{id}', array( + $response = $client->request('GET','https://api.moesif.com/v1/~/workspaces/templates', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -7209,9 +9100,9 @@ func main() { "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/workspaces/public/{id}", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/workspaces/templates") req.Header = headers client := &http.Client{} @@ -7248,7 +9139,7 @@ public class HttpExample /// Make a dummy request public async Task MakeGetRequest() { - string url = "https://api.moesif.com/v1/workspaces/public/{id}"; + string url = "https://api.moesif.com/v1/~/workspaces/templates"; var result = await GetAsync(url); } @@ -7280,12 +9171,15 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/workspaces/public/{id}"); +URL obj = new URL("https://api.moesif.com/v1/~/workspaces/templates"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); + +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -7296,59 +9190,223 @@ System.out.println(response.toString()); ``` -`GET /workspaces/public/{id}` +`GET /~/workspaces/templates` -*Get a Public Workspace* +*Get Workspace Templates* -

Parameters

+> `GET https://api.moesif.com/v1/~/workspaces/templates` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|id|path|string|true|none| > Example responses > 200 Response ```json -{ - "name": "string", - "is_default": true, - "view_count": 0, - "_id": "string", - "is_template": true, - "dashboard": {}, - "auth_user_id": "string", - "colors": {}, - "sequence": [ - { - "delay": 0, - "submit_data": { - "body": {}, - "url": "string", - "params": [ - { - "key": "string", - "val": "string" - } - ], - "verb": "string", - "headers": [ - { - "key": "string", - "val": "string" - } - ] +[ + { + "name": "string", + "is_default": true, + "view_count": 0, + "_id": "string", + "is_template": true, + "dashboard": {}, + "auth_user_id": "string", + "colors": {}, + "sequence": [ + { + "delay": 0, + "submit_data": { + "body": {}, + "url": "string", + "params": [ + {} + ], + "verb": "string", + "headers": [ + {} + ] + } + } + ], + "drawings": [ + { + "name": "string", + "direction": "string", + "id": "string", + "type": "string", + "value": 0.1 + } + ], + "chart": { + "original_encoded_view_elements": "string", + "funnel_query": {}, + "url_query": "string", + "to": "string", + "view_elements": {}, + "from": "string", + "original_encoded_funnel_query": "string", + "es_query": {}, + "args": "string", + "original_encoded_query": "string", + "time_zone": "string", + "view": "string" + }, + "template": { + "dynamic_fields": [ + "string" + ], + "dynamic_time": true + }, + "app_id": "string", + "type": "string", + "width": 0.1, + "sort_order": 0.1, + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + }, + "org_id": "string", + "migration": {}, + "created": "2024-04-11T04:01:35.090Z", + "comments": { + "summary": { + "count": 0, + "latest_comment": { + "auth_user_id": "string", + "comment_id": "string", + "mentions": [ + null + ], + "partner_user_id": "string", + "message": "string", + "created_at": "2024-04-11T04:01:35.090Z", + "updated_at": "2024-04-11T04:01:35.090Z" + } } } - ], + } +] +``` + +

Responses

+ +|Status|Meaning|Description|Schema| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|Inline| + +

Response Schema

+ +Status Code **200** + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|*anonymous*|[[WorkspaceDocument](#schemaworkspacedocument)]|false|none|none| +|» name|string|false|none|none| +|» is_default|boolean|false|none|none| +|» view_count|integer(int32)|true|none|none| +|» _id|string|false|none|none| +|» is_template|boolean|false|none|none| +|» dashboard|object|false|none|none| +|» auth_user_id|string|true|none|none| +|» colors|object|false|none|none| +|» sequence|[[SequenceItem](#schemasequenceitem)]|false|none|none| +|»» delay|integer(int32)|true|none|none| +|»» submit_data|object|true|none|none| +|»»» body|object|false|none|none| +|»»» url|string|true|none|none| +|»»» params|[[KeyValuePair](#schemakeyvaluepair)]|false|none|none| +|»»»» key|string|true|none|none| +|»»»» val|string|true|none|none| +|»»» verb|string|true|none|none| +|»»» headers|[[KeyValuePair](#schemakeyvaluepair)]|false|none|none| +|» drawings|[[DrawingItem](#schemadrawingitem)]|false|none|none| +|»» name|string|true|none|none| +|»» direction|string|true|none|none| +|»» id|string|true|none|none| +|»» type|string|true|none|none| +|»» value|number(double)|true|none|none| +|» chart|object|false|none|none| +|»» original_encoded_view_elements|string|false|none|none| +|»» funnel_query|object|false|none|none| +|»» url_query|string|true|none|none| +|»» to|string|false|none|none| +|»» view_elements|object|false|none|none| +|»» from|string|false|none|none| +|»» original_encoded_funnel_query|string|false|none|none| +|»» es_query|object|false|none|none| +|»» args|string|false|none|none| +|»» original_encoded_query|string|false|none|none| +|»» time_zone|string|false|none|none| +|»» view|string|true|none|none| +|» template|object|false|none|none| +|»» dynamic_fields|[string]|true|none|none| +|»» dynamic_time|boolean|false|none|none| +|» app_id|string|true|none|none| +|» type|string|false|none|none| +|» width|number(double)|false|none|none| +|» sort_order|number(double)|false|none|none| +|» policy|object|false|none|none| +|»» acl|[[ACLItem](#schemaaclitem)]|true|none|none| +|»»» grantee|string|true|none|none| +|»»» permission|string|true|none|none| +|»» resource|object|true|none|none| +|»» api_scopes|[string]|false|none|none| +|»» original_encoded_resource|string|false|none|none| +|» org_id|string|true|none|none| +|» migration|object|false|none|none| +|» created|string(date-time)|true|none|none| +|» comments|object|false|none|none| +|»» summary|object|true|none|none| +|»»» count|integer(int32)|true|none|none| +|»»» latest_comment|object|false|none|none| +|»»»» auth_user_id|string|false|none|none| +|»»»» comment_id|string|false|none|none| +|»»»» mentions|[string]|false|none|none| +|»»»» partner_user_id|string|false|none|none| +|»»»» message|string|false|none|none| +|»»»» created_at|string(date-time)|false|none|none| +|»»»» updated_at|string(date-time)|false|none|none| + + + +## updateWorkspace + + + +> Code samples + +```shell +# You can also use wget +curl -X POST https://api.moesif.com/v1/~/workspaces/{id} \ + -H 'Content-Type: application/json' \ + -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + + -d '{ + "name": "string", + "colors": {}, "drawings": [ { "name": "string", "direction": "string", "id": "string", "type": "string", - "value": 0 + "value": 0.1 } ], "chart": { @@ -7371,10 +9429,8 @@ System.out.println(response.toString()); ], "dynamic_time": true }, - "app_id": "string", - "type": "string", - "width": 0, - "sort_order": 0, + "width": 0.1, + "sort_order": 0.1, "policy": { "acl": [ { @@ -7387,2357 +9443,69 @@ System.out.println(response.toString()); "string" ], "original_encoded_resource": "string" - }, - "org_id": "string", - "migration": {}, - "created": "2019-08-24T14:15:22Z", - "comments": { - "summary": { - "count": 0, - "latest_comment": { - "auth_user_id": "string", - "comment_id": "string", - "mentions": [ - "string" - ], - "partner_user_id": "string", - "message": "string", - "created_at": "2019-08-24T14:15:22Z", - "updated_at": "2019-08-24T14:15:22Z" - } - } } -} -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[WorkspaceDocument](#schemaworkspacedocument)| - - - -## addACLPermissions - - - -> Code samples - -```shell -# You can also use wget -curl -X POST https://api.moesif.com/v1/~/workspaces/{id}/policy/acl \ - -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' - +}' ``` ```javascript--nodejs const fetch = require('node-fetch'); - -const headers = { - 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' -}; - -fetch('https://api.moesif.com/v1/~/workspaces/{id}/policy/acl', -{ - method: 'POST', - - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' -} - -r = requests.post('https://api.moesif.com/v1/~/workspaces/{id}/policy/acl', headers = headers) - -print(r.json()) - -``` - -```ruby -require 'rest-client' -require 'json' - -headers = { - 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' -} - -result = RestClient.post 'https://api.moesif.com/v1/~/workspaces/{id}/policy/acl', - params: { - }, headers: headers - -p JSON.parse(result) - -``` - -```php - 'Bearer YOUR_MANAGEMENT_API_KEY', -); - -$client = new \GuzzleHttp\Client(); - -// Define array of request body. -$request_body = array(); - -try { - $response = $client->request('POST','https://api.moesif.com/v1/~/workspaces/{id}/policy/acl', array( - 'headers' => $headers, - 'json' => $request_body, - ) - ); - print_r($response->getBody()->getContents()); - } - catch (\GuzzleHttp\Exception\BadResponseException $e) { - // handle exception or api errors. - print_r($e->getMessage()); - } - - // ... - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/workspaces/{id}/policy/acl", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```csharp -using System; -using System.Collections.Generic; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Text; -using System.Threading.Tasks; -using Newtonsoft.Json; - -/// <> -/// Example of Http Client -/// <> -public class HttpExample -{ - private HttpClient Client { get; set; } - - /// <> - /// Setup http client - /// <> - public HttpExample() - { - Client = new HttpClient(); - } - - - /// Make a dummy request - public async Task MakePostRequest() - { - string url = "https://api.moesif.com/v1/~/workspaces/{id}/policy/acl"; - - - await PostAsync(null, url); - - } - - /// Performs a POST Request - public async Task PostAsync(undefined content, string url) - { - //Serialize Object - StringContent jsonContent = SerializeObject(content); - - //Execute POST request - HttpResponseMessage response = await Client.PostAsync(url, jsonContent); - } - - - - /// Serialize an object to Json - private StringContent SerializeObject(undefined content) - { - //Serialize Object - string jsonObject = JsonConvert.SerializeObject(content); - - //Create Json UTF8 String Content - return new StringContent(jsonObject, Encoding.UTF8, "application/json"); - } - - /// Deserialize object from request response - private async Task DeserializeObject(HttpResponseMessage response) - { - //Read body - string responseBody = await response.Content.ReadAsStringAsync(); - - //Deserialize Body to object - var result = JsonConvert.DeserializeObject(responseBody); - } -} - -``` - -```java -URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}/policy/acl"); -HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("POST"); -int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); -String inputLine; -StringBuffer response = new StringBuffer(); -while ((inputLine = in.readLine()) != null) { - response.append(inputLine); -} -in.close(); -System.out.println(response.toString()); - -``` - -`POST /~/workspaces/{id}/policy/acl` - -*Add ACL permission* - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|id|path|string|true|none| -|grantee|query|string|false|none| -|permission|query|string|false|none| - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| - - - -## deleteACLPermissions - - - -> Code samples - -```shell -# You can also use wget -curl -X DELETE https://api.moesif.com/v1/~/workspaces/{id}/policy/acl?grantee=string \ - -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' - -``` - -```javascript--nodejs -const fetch = require('node-fetch'); - -const headers = { - 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' -}; - -fetch('https://api.moesif.com/v1/~/workspaces/{id}/policy/acl?grantee=string', -{ - method: 'DELETE', - - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' -} - -r = requests.delete('https://api.moesif.com/v1/~/workspaces/{id}/policy/acl', params={ - 'grantee': 'string' -}, headers = headers) - -print(r.json()) - -``` - -```ruby -require 'rest-client' -require 'json' - -headers = { - 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' -} - -result = RestClient.delete 'https://api.moesif.com/v1/~/workspaces/{id}/policy/acl', - params: { - 'grantee' => 'string' -}, headers: headers - -p JSON.parse(result) - -``` - -```php - 'Bearer YOUR_MANAGEMENT_API_KEY', -); - -$client = new \GuzzleHttp\Client(); - -// Define array of request body. -$request_body = array(); - -try { - $response = $client->request('DELETE','https://api.moesif.com/v1/~/workspaces/{id}/policy/acl', array( - 'headers' => $headers, - 'json' => $request_body, - ) - ); - print_r($response->getBody()->getContents()); - } - catch (\GuzzleHttp\Exception\BadResponseException $e) { - // handle exception or api errors. - print_r($e->getMessage()); - } - - // ... - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/workspaces/{id}/policy/acl", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```csharp -using System; -using System.Collections.Generic; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Text; -using System.Threading.Tasks; -using Newtonsoft.Json; - -/// <> -/// Example of Http Client -/// <> -public class HttpExample -{ - private HttpClient Client { get; set; } - - /// <> - /// Setup http client - /// <> - public HttpExample() - { - Client = new HttpClient(); - } - - - - - /// Make a dummy request - public async Task MakeDeleteRequest() - { - int id = 1; - string url = "https://api.moesif.com/v1/~/workspaces/{id}/policy/acl"; - - await DeleteAsync(id, url); - } - - /// Performs a DELETE Request - public async Task DeleteAsync(int id, string url) - { - //Execute DELETE request - HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); - - //Return response - await DeserializeObject(response); - } - - /// Deserialize object from request response - private async Task DeserializeObject(HttpResponseMessage response) - { - //Read body - string responseBody = await response.Content.ReadAsStringAsync(); - - //Deserialize Body to object - var result = JsonConvert.DeserializeObject(responseBody); - } -} - -``` - -```java -URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}/policy/acl?grantee=string"); -HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("DELETE"); -int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); -String inputLine; -StringBuffer response = new StringBuffer(); -while ((inputLine = in.readLine()) != null) { - response.append(inputLine); -} -in.close(); -System.out.println(response.toString()); - -``` - -`DELETE /~/workspaces/{id}/policy/acl` - -*Delete ACL permission* - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|id|path|string|true|none| -|grantee|query|string|true|none| - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| - - - -## createWorkspace - - - -> Code samples - -```shell -# You can also use wget -curl -X POST https://api.moesif.com/v1/~/workspaces \ - -H 'Accept: application/json' \ - -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' - -``` - -```javascript--nodejs -const fetch = require('node-fetch'); - -const headers = { - 'Accept':'application/json', - 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' -}; - -fetch('https://api.moesif.com/v1/~/workspaces', -{ - method: 'POST', - - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Accept': 'application/json', - 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' -} - -r = requests.post('https://api.moesif.com/v1/~/workspaces', headers = headers) - -print(r.json()) - -``` - -```ruby -require 'rest-client' -require 'json' - -headers = { - 'Accept' => 'application/json', - 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' -} - -result = RestClient.post 'https://api.moesif.com/v1/~/workspaces', - params: { - }, headers: headers - -p JSON.parse(result) - -``` - -```php - 'application/json', - 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', -); - -$client = new \GuzzleHttp\Client(); - -// Define array of request body. -$request_body = array(); - -try { - $response = $client->request('POST','https://api.moesif.com/v1/~/workspaces', array( - 'headers' => $headers, - 'json' => $request_body, - ) - ); - print_r($response->getBody()->getContents()); - } - catch (\GuzzleHttp\Exception\BadResponseException $e) { - // handle exception or api errors. - print_r($e->getMessage()); - } - - // ... - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Accept": []string{"application/json"}, - "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/workspaces", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```csharp -using System; -using System.Collections.Generic; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Text; -using System.Threading.Tasks; -using Newtonsoft.Json; - -/// <> -/// Example of Http Client -/// <> -public class HttpExample -{ - private HttpClient Client { get; set; } - - /// <> - /// Setup http client - /// <> - public HttpExample() - { - Client = new HttpClient(); - } - - - /// Make a dummy request - public async Task MakePostRequest() - { - string url = "https://api.moesif.com/v1/~/workspaces"; - - - await PostAsync(null, url); - - } - - /// Performs a POST Request - public async Task PostAsync(undefined content, string url) - { - //Serialize Object - StringContent jsonContent = SerializeObject(content); - - //Execute POST request - HttpResponseMessage response = await Client.PostAsync(url, jsonContent); - } - - - - /// Serialize an object to Json - private StringContent SerializeObject(undefined content) - { - //Serialize Object - string jsonObject = JsonConvert.SerializeObject(content); - - //Create Json UTF8 String Content - return new StringContent(jsonObject, Encoding.UTF8, "application/json"); - } - - /// Deserialize object from request response - private async Task DeserializeObject(HttpResponseMessage response) - { - //Read body - string responseBody = await response.Content.ReadAsStringAsync(); - - //Deserialize Body to object - var result = JsonConvert.DeserializeObject(responseBody); - } -} - -``` - -```java -URL obj = new URL("https://api.moesif.com/v1/~/workspaces"); -HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("POST"); -int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); -String inputLine; -StringBuffer response = new StringBuffer(); -while ((inputLine = in.readLine()) != null) { - response.append(inputLine); -} -in.close(); -System.out.println(response.toString()); - -``` - -`POST /~/workspaces` - -*Create New Workspace* - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|expiration|query|string(date-time)|false|none| - -> Example responses - -> 201 Response - -```json -{ - "name": "string", - "is_default": true, - "view_count": 0, - "_id": "string", - "is_template": true, - "dashboard": {}, - "auth_user_id": "string", - "colors": {}, - "sequence": [ - { - "delay": 0, - "submit_data": { - "body": {}, - "url": "string", - "params": [ - { - "key": "string", - "val": "string" - } - ], - "verb": "string", - "headers": [ - { - "key": "string", - "val": "string" - } - ] - } - } - ], - "drawings": [ - { - "name": "string", - "direction": "string", - "id": "string", - "type": "string", - "value": 0 - } - ], - "chart": { - "original_encoded_view_elements": "string", - "funnel_query": {}, - "url_query": "string", - "to": "string", - "view_elements": {}, - "from": "string", - "original_encoded_funnel_query": "string", - "es_query": {}, - "args": "string", - "original_encoded_query": "string", - "time_zone": "string", - "view": "string" - }, - "template": { - "dynamic_fields": [ - "string" - ], - "dynamic_time": true - }, - "app_id": "string", - "type": "string", - "width": 0, - "sort_order": 0, - "policy": { - "acl": [ - { - "grantee": "string", - "permission": "string" - } - ], - "resource": {}, - "api_scopes": [ - "string" - ], - "original_encoded_resource": "string" - }, - "org_id": "string", - "migration": {}, - "created": "2019-08-24T14:15:22Z", - "comments": { - "summary": { - "count": 0, - "latest_comment": { - "auth_user_id": "string", - "comment_id": "string", - "mentions": [ - "string" - ], - "partner_user_id": "string", - "message": "string", - "created_at": "2019-08-24T14:15:22Z", - "updated_at": "2019-08-24T14:15:22Z" - } - } - } -} -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|[WorkspaceDocument](#schemaworkspacedocument)| - - - -## getWorkspaces - - - -> Code samples - -```shell -# You can also use wget -curl -X GET https://api.moesif.com/v1/~/workspaces?take=0&access=string \ - -H 'Accept: application/json' \ - -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' - -``` - -```javascript--nodejs -const fetch = require('node-fetch'); - -const headers = { - 'Accept':'application/json', - 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' -}; - -fetch('https://api.moesif.com/v1/~/workspaces?take=0&access=string', -{ - method: 'GET', - - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Accept': 'application/json', - 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' -} - -r = requests.get('https://api.moesif.com/v1/~/workspaces', params={ - 'take': '0', 'access': [ - "string" -] -}, headers = headers) - -print(r.json()) - -``` - -```ruby -require 'rest-client' -require 'json' - -headers = { - 'Accept' => 'application/json', - 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' -} - -result = RestClient.get 'https://api.moesif.com/v1/~/workspaces', - params: { - 'take' => 'integer(int32)', -'access' => 'array[string]' -}, headers: headers - -p JSON.parse(result) - -``` - -```php - 'application/json', - 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', -); - -$client = new \GuzzleHttp\Client(); - -// Define array of request body. -$request_body = array(); - -try { - $response = $client->request('GET','https://api.moesif.com/v1/~/workspaces', array( - 'headers' => $headers, - 'json' => $request_body, - ) - ); - print_r($response->getBody()->getContents()); - } - catch (\GuzzleHttp\Exception\BadResponseException $e) { - // handle exception or api errors. - print_r($e->getMessage()); - } - - // ... - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Accept": []string{"application/json"}, - "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/workspaces", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```csharp -using System; -using System.Collections.Generic; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Text; -using System.Threading.Tasks; -using Newtonsoft.Json; - -/// <> -/// Example of Http Client -/// <> -public class HttpExample -{ - private HttpClient Client { get; set; } - - /// <> - /// Setup http client - /// <> - public HttpExample() - { - Client = new HttpClient(); - } - - /// Make a dummy request - public async Task MakeGetRequest() - { - string url = "https://api.moesif.com/v1/~/workspaces"; - var result = await GetAsync(url); - } - - /// Performs a GET Request - public async Task GetAsync(string url) - { - //Start the request - HttpResponseMessage response = await Client.GetAsync(url); - - //Validate result - response.EnsureSuccessStatusCode(); - - } - - - - - /// Deserialize object from request response - private async Task DeserializeObject(HttpResponseMessage response) - { - //Read body - string responseBody = await response.Content.ReadAsStringAsync(); - - //Deserialize Body to object - var result = JsonConvert.DeserializeObject(responseBody); - } -} - -``` - -```java -URL obj = new URL("https://api.moesif.com/v1/~/workspaces?take=0&access=string"); -HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("GET"); -int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); -String inputLine; -StringBuffer response = new StringBuffer(); -while ((inputLine = in.readLine()) != null) { - response.append(inputLine); -} -in.close(); -System.out.println(response.toString()); - -``` - -`GET /~/workspaces` - -*Get Workspaces* - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|take|query|integer(int32)|true|none| -|before_id|query|string|false|none| -|`type`|query|string|false|none| -|access|query|array[string]|true|none| - -> Example responses - -> 200 Response - -```json -[ - { - "name": "string", - "is_default": true, - "view_count": 0, - "_id": "string", - "is_template": true, - "dashboard": {}, - "auth_user_id": "string", - "colors": {}, - "sequence": [ - { - "delay": 0, - "submit_data": { - "body": {}, - "url": "string", - "params": [ - { - "key": "string", - "val": "string" - } - ], - "verb": "string", - "headers": [ - { - "key": "string", - "val": "string" - } - ] - } - } - ], - "drawings": [ - { - "name": "string", - "direction": "string", - "id": "string", - "type": "string", - "value": 0 - } - ], - "chart": { - "original_encoded_view_elements": "string", - "funnel_query": {}, - "url_query": "string", - "to": "string", - "view_elements": {}, - "from": "string", - "original_encoded_funnel_query": "string", - "es_query": {}, - "args": "string", - "original_encoded_query": "string", - "time_zone": "string", - "view": "string" - }, - "template": { - "dynamic_fields": [ - "string" - ], - "dynamic_time": true - }, - "app_id": "string", - "type": "string", - "width": 0, - "sort_order": 0, - "policy": { - "acl": [ - { - "grantee": "string", - "permission": "string" - } - ], - "resource": {}, - "api_scopes": [ - "string" - ], - "original_encoded_resource": "string" - }, - "org_id": "string", - "migration": {}, - "created": "2019-08-24T14:15:22Z", - "comments": { - "summary": { - "count": 0, - "latest_comment": { - "auth_user_id": "string", - "comment_id": "string", - "mentions": [ - "string" - ], - "partner_user_id": "string", - "message": "string", - "created_at": "2019-08-24T14:15:22Z", - "updated_at": "2019-08-24T14:15:22Z" - } - } - } - } -] -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|Inline| - -

Response Schema

- -Status Code **200** - -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|*anonymous*|[[WorkspaceDocument](#schemaworkspacedocument)]|false|none|none| -|» name|string|false|none|none| -|» is_default|boolean|false|none|none| -|» view_count|integer(int32)|true|none|none| -|» _id|string|false|none|none| -|» is_template|boolean|false|none|none| -|» dashboard|object|false|none|none| -|» auth_user_id|string|true|none|none| -|» colors|object|false|none|none| -|» sequence|[[SequenceItem](#schemasequenceitem)]|false|none|none| -|»» delay|integer(int32)|true|none|none| -|»» submit_data|object|true|none|none| -|»»» body|object|false|none|none| -|»»» url|string|true|none|none| -|»»» params|[[KeyValuePair](#schemakeyvaluepair)]|false|none|none| -|»»»» key|string|true|none|none| -|»»»» val|string|true|none|none| -|»»» verb|string|true|none|none| -|»»» headers|[[KeyValuePair](#schemakeyvaluepair)]|false|none|none| -|» drawings|[[DrawingItem](#schemadrawingitem)]|false|none|none| -|»» name|string|true|none|none| -|»» direction|string|true|none|none| -|»» id|string|true|none|none| -|»» type|string|true|none|none| -|»» value|number(double)|true|none|none| -|» chart|object|false|none|none| -|»» original_encoded_view_elements|string|false|none|none| -|»» funnel_query|object|false|none|none| -|»» url_query|string|true|none|none| -|»» to|string|false|none|none| -|»» view_elements|object|false|none|none| -|»» from|string|false|none|none| -|»» original_encoded_funnel_query|string|false|none|none| -|»» es_query|object|false|none|none| -|»» args|string|false|none|none| -|»» original_encoded_query|string|false|none|none| -|»» time_zone|string|false|none|none| -|»» view|string|true|none|none| -|» template|object|false|none|none| -|»» dynamic_fields|[string]|true|none|none| -|»» dynamic_time|boolean|false|none|none| -|» app_id|string|true|none|none| -|» type|string|false|none|none| -|» width|number(double)|false|none|none| -|» sort_order|number(double)|false|none|none| -|» policy|object|false|none|none| -|»» acl|[[ACLItem](#schemaaclitem)]|true|none|none| -|»»» grantee|string|true|none|none| -|»»» permission|string|true|none|none| -|»» resource|object|true|none|none| -|»» api_scopes|[string]|false|none|none| -|»» original_encoded_resource|string|false|none|none| -|» org_id|string|true|none|none| -|» migration|object|false|none|none| -|» created|string(date-time)|true|none|none| -|» comments|object|false|none|none| -|»» summary|object|true|none|none| -|»»» count|integer(int32)|true|none|none| -|»»» latest_comment|object|false|none|none| -|»»»» auth_user_id|string|false|none|none| -|»»»» comment_id|string|false|none|none| -|»»»» mentions|[string]|false|none|none| -|»»»» partner_user_id|string|false|none|none| -|»»»» message|string|false|none|none| -|»»»» created_at|string(date-time)|false|none|none| -|»»»» updated_at|string(date-time)|false|none|none| - - - -## createComment - - - -> Code samples - -```shell -# You can also use wget -curl -X POST https://api.moesif.com/v1/~/workspaces/{id}/comments \ - -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' - -``` - -```javascript--nodejs -const fetch = require('node-fetch'); - -const headers = { - 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' -}; - -fetch('https://api.moesif.com/v1/~/workspaces/{id}/comments', -{ - method: 'POST', - - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' -} - -r = requests.post('https://api.moesif.com/v1/~/workspaces/{id}/comments', headers = headers) - -print(r.json()) - -``` - -```ruby -require 'rest-client' -require 'json' - -headers = { - 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' -} - -result = RestClient.post 'https://api.moesif.com/v1/~/workspaces/{id}/comments', - params: { - }, headers: headers - -p JSON.parse(result) - -``` - -```php - 'Bearer YOUR_MANAGEMENT_API_KEY', -); - -$client = new \GuzzleHttp\Client(); - -// Define array of request body. -$request_body = array(); - -try { - $response = $client->request('POST','https://api.moesif.com/v1/~/workspaces/{id}/comments', array( - 'headers' => $headers, - 'json' => $request_body, - ) - ); - print_r($response->getBody()->getContents()); - } - catch (\GuzzleHttp\Exception\BadResponseException $e) { - // handle exception or api errors. - print_r($e->getMessage()); - } - - // ... - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/workspaces/{id}/comments", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```csharp -using System; -using System.Collections.Generic; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Text; -using System.Threading.Tasks; -using Newtonsoft.Json; - -/// <> -/// Example of Http Client -/// <> -public class HttpExample -{ - private HttpClient Client { get; set; } - - /// <> - /// Setup http client - /// <> - public HttpExample() - { - Client = new HttpClient(); - } - - - /// Make a dummy request - public async Task MakePostRequest() - { - string url = "https://api.moesif.com/v1/~/workspaces/{id}/comments"; - - - await PostAsync(null, url); - - } - - /// Performs a POST Request - public async Task PostAsync(undefined content, string url) - { - //Serialize Object - StringContent jsonContent = SerializeObject(content); - - //Execute POST request - HttpResponseMessage response = await Client.PostAsync(url, jsonContent); - } - - - - /// Serialize an object to Json - private StringContent SerializeObject(undefined content) - { - //Serialize Object - string jsonObject = JsonConvert.SerializeObject(content); - - //Create Json UTF8 String Content - return new StringContent(jsonObject, Encoding.UTF8, "application/json"); - } - - /// Deserialize object from request response - private async Task DeserializeObject(HttpResponseMessage response) - { - //Read body - string responseBody = await response.Content.ReadAsStringAsync(); - - //Deserialize Body to object - var result = JsonConvert.DeserializeObject(responseBody); - } -} - -``` - -```java -URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}/comments"); -HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("POST"); -int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); -String inputLine; -StringBuffer response = new StringBuffer(); -while ((inputLine = in.readLine()) != null) { - response.append(inputLine); -} -in.close(); -System.out.println(response.toString()); - -``` - -`POST /~/workspaces/{id}/comments` - -*Create a New Comment* - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|id|path|string|true|none| - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|None| - - - -## getComments - - - -> Code samples - -```shell -# You can also use wget -curl -X GET https://api.moesif.com/v1/~/workspaces/{id}/comments \ - -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' - -``` - -```javascript--nodejs -const fetch = require('node-fetch'); - -const headers = { - 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' -}; - -fetch('https://api.moesif.com/v1/~/workspaces/{id}/comments', -{ - method: 'GET', - - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' -} - -r = requests.get('https://api.moesif.com/v1/~/workspaces/{id}/comments', headers = headers) - -print(r.json()) - -``` - -```ruby -require 'rest-client' -require 'json' - -headers = { - 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' -} - -result = RestClient.get 'https://api.moesif.com/v1/~/workspaces/{id}/comments', - params: { - }, headers: headers - -p JSON.parse(result) - -``` - -```php - 'Bearer YOUR_MANAGEMENT_API_KEY', -); - -$client = new \GuzzleHttp\Client(); - -// Define array of request body. -$request_body = array(); - -try { - $response = $client->request('GET','https://api.moesif.com/v1/~/workspaces/{id}/comments', array( - 'headers' => $headers, - 'json' => $request_body, - ) - ); - print_r($response->getBody()->getContents()); - } - catch (\GuzzleHttp\Exception\BadResponseException $e) { - // handle exception or api errors. - print_r($e->getMessage()); - } - - // ... - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/workspaces/{id}/comments", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```csharp -using System; -using System.Collections.Generic; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Text; -using System.Threading.Tasks; -using Newtonsoft.Json; - -/// <> -/// Example of Http Client -/// <> -public class HttpExample -{ - private HttpClient Client { get; set; } - - /// <> - /// Setup http client - /// <> - public HttpExample() - { - Client = new HttpClient(); - } - - /// Make a dummy request - public async Task MakeGetRequest() - { - string url = "https://api.moesif.com/v1/~/workspaces/{id}/comments"; - var result = await GetAsync(url); - } - - /// Performs a GET Request - public async Task GetAsync(string url) - { - //Start the request - HttpResponseMessage response = await Client.GetAsync(url); - - //Validate result - response.EnsureSuccessStatusCode(); - - } - - - - - /// Deserialize object from request response - private async Task DeserializeObject(HttpResponseMessage response) - { - //Read body - string responseBody = await response.Content.ReadAsStringAsync(); - - //Deserialize Body to object - var result = JsonConvert.DeserializeObject(responseBody); - } -} - -``` - -```java -URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}/comments"); -HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("GET"); -int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); -String inputLine; -StringBuffer response = new StringBuffer(); -while ((inputLine = in.readLine()) != null) { - response.append(inputLine); -} -in.close(); -System.out.println(response.toString()); - -``` - -`GET /~/workspaces/{id}/comments` - -*Get all Comments* - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|id|path|string|true|none| - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| - - - -

Cohorts

- -## updateCohort - - - -> Code samples - -```shell -# You can also use wget -curl -X POST https://api.moesif.com/v1/~/cohorts/{cohortId} \ - -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' - -``` - -```javascript--nodejs -const fetch = require('node-fetch'); - -const headers = { - 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' -}; - -fetch('https://api.moesif.com/v1/~/cohorts/{cohortId}', -{ - method: 'POST', - - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' -} - -r = requests.post('https://api.moesif.com/v1/~/cohorts/{cohortId}', headers = headers) - -print(r.json()) - -``` - -```ruby -require 'rest-client' -require 'json' - -headers = { - 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' -} - -result = RestClient.post 'https://api.moesif.com/v1/~/cohorts/{cohortId}', - params: { - }, headers: headers - -p JSON.parse(result) - -``` - -```php - 'Bearer YOUR_MANAGEMENT_API_KEY', -); - -$client = new \GuzzleHttp\Client(); - -// Define array of request body. -$request_body = array(); - -try { - $response = $client->request('POST','https://api.moesif.com/v1/~/cohorts/{cohortId}', array( - 'headers' => $headers, - 'json' => $request_body, - ) - ); - print_r($response->getBody()->getContents()); - } - catch (\GuzzleHttp\Exception\BadResponseException $e) { - // handle exception or api errors. - print_r($e->getMessage()); - } - - // ... - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/cohorts/{cohortId}", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```csharp -using System; -using System.Collections.Generic; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Text; -using System.Threading.Tasks; -using Newtonsoft.Json; - -/// <> -/// Example of Http Client -/// <> -public class HttpExample -{ - private HttpClient Client { get; set; } - - /// <> - /// Setup http client - /// <> - public HttpExample() - { - Client = new HttpClient(); - } - - - /// Make a dummy request - public async Task MakePostRequest() - { - string url = "https://api.moesif.com/v1/~/cohorts/{cohortId}"; - - - await PostAsync(null, url); - - } - - /// Performs a POST Request - public async Task PostAsync(undefined content, string url) - { - //Serialize Object - StringContent jsonContent = SerializeObject(content); - - //Execute POST request - HttpResponseMessage response = await Client.PostAsync(url, jsonContent); - } - - - - /// Serialize an object to Json - private StringContent SerializeObject(undefined content) - { - //Serialize Object - string jsonObject = JsonConvert.SerializeObject(content); - - //Create Json UTF8 String Content - return new StringContent(jsonObject, Encoding.UTF8, "application/json"); - } - - /// Deserialize object from request response - private async Task DeserializeObject(HttpResponseMessage response) - { - //Read body - string responseBody = await response.Content.ReadAsStringAsync(); - - //Deserialize Body to object - var result = JsonConvert.DeserializeObject(responseBody); - } -} - -``` - -```java -URL obj = new URL("https://api.moesif.com/v1/~/cohorts/{cohortId}"); -HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("POST"); -int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); -String inputLine; -StringBuffer response = new StringBuffer(); -while ((inputLine = in.readLine()) != null) { - response.append(inputLine); -} -in.close(); -System.out.println(response.toString()); - -``` - -`POST /~/cohorts/{cohortId}` - -*Update a Cohort* - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|cohortId|path|string|true|none| -|body|body|[CohortUpdateItem](#schemacohortupdateitem)|false|none| - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| - - - -## getCohort - - - -> Code samples - -```shell -# You can also use wget -curl -X GET https://api.moesif.com/v1/~/cohorts/{cohortId}?cohort_type=string \ - -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' - -``` - -```javascript--nodejs -const fetch = require('node-fetch'); - -const headers = { - 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' -}; - -fetch('https://api.moesif.com/v1/~/cohorts/{cohortId}?cohort_type=string', -{ - method: 'GET', - - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' -} - -r = requests.get('https://api.moesif.com/v1/~/cohorts/{cohortId}', params={ - 'cohort_type': 'string' -}, headers = headers) - -print(r.json()) - -``` - -```ruby -require 'rest-client' -require 'json' - -headers = { - 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' -} - -result = RestClient.get 'https://api.moesif.com/v1/~/cohorts/{cohortId}', - params: { - 'cohort_type' => 'string' -}, headers: headers - -p JSON.parse(result) - -``` - -```php - 'Bearer YOUR_MANAGEMENT_API_KEY', -); - -$client = new \GuzzleHttp\Client(); - -// Define array of request body. -$request_body = array(); - -try { - $response = $client->request('GET','https://api.moesif.com/v1/~/cohorts/{cohortId}', array( - 'headers' => $headers, - 'json' => $request_body, - ) - ); - print_r($response->getBody()->getContents()); - } - catch (\GuzzleHttp\Exception\BadResponseException $e) { - // handle exception or api errors. - print_r($e->getMessage()); - } - - // ... - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/cohorts/{cohortId}", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```csharp -using System; -using System.Collections.Generic; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Text; -using System.Threading.Tasks; -using Newtonsoft.Json; - -/// <> -/// Example of Http Client -/// <> -public class HttpExample -{ - private HttpClient Client { get; set; } - - /// <> - /// Setup http client - /// <> - public HttpExample() - { - Client = new HttpClient(); - } - - /// Make a dummy request - public async Task MakeGetRequest() - { - string url = "https://api.moesif.com/v1/~/cohorts/{cohortId}"; - var result = await GetAsync(url); - } - - /// Performs a GET Request - public async Task GetAsync(string url) - { - //Start the request - HttpResponseMessage response = await Client.GetAsync(url); - - //Validate result - response.EnsureSuccessStatusCode(); - - } - - - - - /// Deserialize object from request response - private async Task DeserializeObject(HttpResponseMessage response) - { - //Read body - string responseBody = await response.Content.ReadAsStringAsync(); - - //Deserialize Body to object - var result = JsonConvert.DeserializeObject(responseBody); - } -} - -``` - -```java -URL obj = new URL("https://api.moesif.com/v1/~/cohorts/{cohortId}?cohort_type=string"); -HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("GET"); -int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); -String inputLine; -StringBuffer response = new StringBuffer(); -while ((inputLine = in.readLine()) != null) { - response.append(inputLine); -} -in.close(); -System.out.println(response.toString()); - -``` - -`GET /~/cohorts/{cohortId}` - -*Get Cohort* - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|cohort_type|query|string|true|none| -|cohortId|path|string|true|none| - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| - - - -## deleteCohort - - - -> Code samples - -```shell -# You can also use wget -curl -X DELETE https://api.moesif.com/v1/~/cohorts/{cohortId} \ - -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' - -``` - -```javascript--nodejs -const fetch = require('node-fetch'); - -const headers = { - 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' -}; - -fetch('https://api.moesif.com/v1/~/cohorts/{cohortId}', -{ - method: 'DELETE', - - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' -} - -r = requests.delete('https://api.moesif.com/v1/~/cohorts/{cohortId}', headers = headers) - -print(r.json()) - -``` - -```ruby -require 'rest-client' -require 'json' - -headers = { - 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' -} - -result = RestClient.delete 'https://api.moesif.com/v1/~/cohorts/{cohortId}', - params: { - }, headers: headers - -p JSON.parse(result) - -``` - -```php - 'Bearer YOUR_MANAGEMENT_API_KEY', -); - -$client = new \GuzzleHttp\Client(); - -// Define array of request body. -$request_body = array(); - -try { - $response = $client->request('DELETE','https://api.moesif.com/v1/~/cohorts/{cohortId}', array( - 'headers' => $headers, - 'json' => $request_body, - ) - ); - print_r($response->getBody()->getContents()); - } - catch (\GuzzleHttp\Exception\BadResponseException $e) { - // handle exception or api errors. - print_r($e->getMessage()); - } - - // ... - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/cohorts/{cohortId}", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```csharp -using System; -using System.Collections.Generic; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Text; -using System.Threading.Tasks; -using Newtonsoft.Json; - -/// <> -/// Example of Http Client -/// <> -public class HttpExample -{ - private HttpClient Client { get; set; } - - /// <> - /// Setup http client - /// <> - public HttpExample() - { - Client = new HttpClient(); - } - - - - - /// Make a dummy request - public async Task MakeDeleteRequest() - { - int id = 1; - string url = "https://api.moesif.com/v1/~/cohorts/{cohortId}"; - - await DeleteAsync(id, url); - } - - /// Performs a DELETE Request - public async Task DeleteAsync(int id, string url) - { - //Execute DELETE request - HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); - - //Return response - await DeserializeObject(response); - } - - /// Deserialize object from request response - private async Task DeserializeObject(HttpResponseMessage response) +const inputBody = { + "name": "string", + "colors": {}, + "drawings": [ { - //Read body - string responseBody = await response.Content.ReadAsStringAsync(); - - //Deserialize Body to object - var result = JsonConvert.DeserializeObject(responseBody); + "name": "string", + "direction": "string", + "id": "string", + "type": "string", + "value": 0.1 } -} - -``` - -```java -URL obj = new URL("https://api.moesif.com/v1/~/cohorts/{cohortId}"); -HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("DELETE"); -int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); -String inputLine; -StringBuffer response = new StringBuffer(); -while ((inputLine = in.readLine()) != null) { - response.append(inputLine); -} -in.close(); -System.out.println(response.toString()); - -``` - -`DELETE /~/cohorts/{cohortId}` - -*Delete Cohort* - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|cohortId|path|string|true|none| - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| - - - -## deleteCohortSampleRate - - - -> Code samples - -```shell -# You can also use wget -curl -X DELETE https://api.moesif.com/v1/~/cohorts/{cohortId}/sample_rate \ - -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' - -``` - -```javascript--nodejs -const fetch = require('node-fetch'); - + ], + "chart": { + "original_encoded_view_elements": "string", + "funnel_query": {}, + "url_query": "string", + "to": "string", + "view_elements": {}, + "from": "string", + "original_encoded_funnel_query": "string", + "es_query": {}, + "args": "string", + "original_encoded_query": "string", + "time_zone": "string", + "view": "string" + }, + "template": { + "dynamic_fields": [ + "string" + ], + "dynamic_time": true + }, + "width": 0.1, + "sort_order": 0.1, + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + } +}; const headers = { + 'Content-Type':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/cohorts/{cohortId}/sample_rate', +fetch('https://api.moesif.com/v1/~/workspaces/{id}', { - method: 'DELETE', - + method: 'POST', + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -9751,10 +9519,59 @@ fetch('https://api.moesif.com/v1/~/cohorts/{cohortId}/sample_rate', ```python import requests headers = { + 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = { + "name": "string", + "colors": {}, + "drawings": [ + { + "name": "string", + "direction": "string", + "id": "string", + "type": "string", + "value": 0.1 + } + ], + "chart": { + "original_encoded_view_elements": "string", + "funnel_query": {}, + "url_query": "string", + "to": "string", + "view_elements": {}, + "from": "string", + "original_encoded_funnel_query": "string", + "es_query": {}, + "args": "string", + "original_encoded_query": "string", + "time_zone": "string", + "view": "string" + }, + "template": { + "dynamic_fields": [ + "string" + ], + "dynamic_time": true + }, + "width": 0.1, + "sort_order": 0.1, + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + } +} -r = requests.delete('https://api.moesif.com/v1/~/cohorts/{cohortId}/sample_rate', headers = headers) +r = requests.post('https://api.moesif.com/v1/~/workspaces/{id}', headers = headers, json = input_data) print(r.json()) @@ -9765,12 +9582,64 @@ require 'rest-client' require 'json' headers = { + 'Content-Type' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.delete 'https://api.moesif.com/v1/~/cohorts/{cohortId}/sample_rate', +input_payload = JSON.parse('{ + "name": "string", + "colors": {}, + "drawings": [ + { + "name": "string", + "direction": "string", + "id": "string", + "type": "string", + "value": 0.1 + } + ], + "chart": { + "original_encoded_view_elements": "string", + "funnel_query": {}, + "url_query": "string", + "to": "string", + "view_elements": {}, + "from": "string", + "original_encoded_funnel_query": "string", + "es_query": {}, + "args": "string", + "original_encoded_query": "string", + "time_zone": "string", + "view": "string" + }, + "template": { + "dynamic_fields": [ + "string" + ], + "dynamic_time": true + }, + "width": 0.1, + "sort_order": 0.1, + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + } +}') + +result = RestClient.post 'https://api.moesif.com/v1/~/workspaces/{id}', params: { - }, headers: headers + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -9782,18 +9651,65 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Content-Type' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('{ + "name": "string", + "colors": {}, + "drawings": [ + { + "name": "string", + "direction": "string", + "id": "string", + "type": "string", + "value": 0.1 + } + ], + "chart": { + "original_encoded_view_elements": "string", + "funnel_query": {}, + "url_query": "string", + "to": "string", + "view_elements": {}, + "from": "string", + "original_encoded_funnel_query": "string", + "es_query": {}, + "args": "string", + "original_encoded_query": "string", + "time_zone": "string", + "view": "string" + }, + "template": { + "dynamic_fields": [ + "string" + ], + "dynamic_time": true + }, + "width": 0.1, + "sort_order": 0.1, + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + } +}') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('DELETE','https://api.moesif.com/v1/~/cohorts/{cohortId}/sample_rate', array( + $response = $client->request('POST','https://api.moesif.com/v1/~/workspaces/{id}', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -9818,11 +9734,59 @@ import ( func main() { headers := map[string][]string{ + "Content-Type": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/cohorts/{cohortId}/sample_rate", data) + jsonPayload := `{ + "name": "string", + "colors": {}, + "drawings": [ + { + "name": "string", + "direction": "string", + "id": "string", + "type": "string", + "value": 0.1 + } + ], + "chart": { + "original_encoded_view_elements": "string", + "funnel_query": {}, + "url_query": "string", + "to": "string", + "view_elements": {}, + "from": "string", + "original_encoded_funnel_query": "string", + "es_query": {}, + "args": "string", + "original_encoded_query": "string", + "time_zone": "string", + "view": "string" + }, + "template": { + "dynamic_fields": [ + "string" + ], + "dynamic_time": true + }, + "width": 0.1, + "sort_order": 0.1, + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + } +}` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/workspaces/{id}", data) req.Header = headers client := &http.Client{} @@ -9857,25 +9821,85 @@ public class HttpExample } - - /// Make a dummy request - public async Task MakeDeleteRequest() + public async Task MakePostRequest() { - int id = 1; - string url = "https://api.moesif.com/v1/~/cohorts/{cohortId}/sample_rate"; - - await DeleteAsync(id, url); + string url = "https://api.moesif.com/v1/~/workspaces/{id}"; + + string json = @"{ + ""name"": ""string"", + ""colors"": {}, + ""drawings"": [ + { + ""name"": ""string"", + ""direction"": ""string"", + ""id"": ""string"", + ""type"": ""string"", + ""value"": 0.1 + } + ], + ""chart"": { + ""original_encoded_view_elements"": ""string"", + ""funnel_query"": {}, + ""url_query"": ""string"", + ""to"": ""string"", + ""view_elements"": {}, + ""from"": ""string"", + ""original_encoded_funnel_query"": ""string"", + ""es_query"": {}, + ""args"": ""string"", + ""original_encoded_query"": ""string"", + ""time_zone"": ""string"", + ""view"": ""string"" + }, + ""template"": { + ""dynamic_fields"": [ + ""string"" + ], + ""dynamic_time"": true + }, + ""width"": 0.1, + ""sort_order"": 0.1, + ""policy"": { + ""acl"": [ + { + ""grantee"": ""string"", + ""permission"": ""string"" + } + ], + ""resource"": {}, + ""api_scopes"": [ + ""string"" + ], + ""original_encoded_resource"": ""string"" + } +}"; + var content = JsonConvert.DeserializeObject(json); + await PostAsync(content, url); + + } - /// Performs a DELETE Request - public async Task DeleteAsync(int id, string url) + /// Performs a POST Request + public async Task PostAsync(WorkspaceUpdateItem content, string url) { - //Execute DELETE request - HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); + //Serialize Object + StringContent jsonContent = SerializeObject(content); - //Return response - await DeserializeObject(response); + //Execute POST request + HttpResponseMessage response = await Client.PostAsync(url, jsonContent); + } + + + + /// Serialize an object to Json + private StringContent SerializeObject(WorkspaceUpdateItem content) + { + //Serialize Object + string jsonObject = JsonConvert.SerializeObject(content); + + //Create Json UTF8 String Content + return new StringContent(jsonObject, Encoding.UTF8, "application/json"); } /// Deserialize object from request response @@ -9887,17 +9911,78 @@ public class HttpExample //Deserialize Body to object var result = JsonConvert.DeserializeObject(responseBody); } -} +} + +``` + +```java +URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}"); +HttpURLConnection con = (HttpURLConnection) obj.openConnection(); +con.setRequestMethod("POST"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """{ + "name": "string", + "colors": {}, + "drawings": [ + { + "name": "string", + "direction": "string", + "id": "string", + "type": "string", + "value": 0.1 + } + ], + "chart": { + "original_encoded_view_elements": "string", + "funnel_query": {}, + "url_query": "string", + "to": "string", + "view_elements": {}, + "from": "string", + "original_encoded_funnel_query": "string", + "es_query": {}, + "args": "string", + "original_encoded_query": "string", + "time_zone": "string", + "view": "string" + }, + "template": { + "dynamic_fields": [ + "string" + ], + "dynamic_time": true + }, + "width": 0.1, + "sort_order": 0.1, + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + } +}"""; -``` +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} -```java -URL obj = new URL("https://api.moesif.com/v1/~/cohorts/{cohortId}/sample_rate"); -HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("DELETE"); int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -9908,17 +9993,73 @@ System.out.println(response.toString()); ``` -`DELETE /~/cohorts/{cohortId}/sample_rate` +`POST /~/workspaces/{id}` -*Delete Sample Rate for a Cohort* +*Update a Workspace* -

Parameters

+> `POST https://api.moesif.com/v1/~/workspaces/{id}` + +> Example Request + +```json +{ + "name": "string", + "colors": {}, + "drawings": [ + { + "name": "string", + "direction": "string", + "id": "string", + "type": "string", + "value": 0.1 + } + ], + "chart": { + "original_encoded_view_elements": "string", + "funnel_query": {}, + "url_query": "string", + "to": "string", + "view_elements": {}, + "from": "string", + "original_encoded_funnel_query": "string", + "es_query": {}, + "args": "string", + "original_encoded_query": "string", + "time_zone": "string", + "view": "string" + }, + "template": { + "dynamic_fields": [ + "string" + ], + "dynamic_time": true + }, + "width": 0.1, + "sort_order": 0.1, + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + } +} +``` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|cohortId|path|string|true|none| +|id|path|string|true|none| +|body|body|[WorkspaceUpdateItem](#schemaworkspaceupdateitem)|true|none| -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| @@ -9926,18 +10067,18 @@ System.out.println(response.toString()); -## createCohort +## getWorkspace - + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/~/cohorts \ +curl -X GET https://api.moesif.com/v1/~/workspaces/{id} \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' @@ -9951,9 +10092,9 @@ const headers = { 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/cohorts', +fetch('https://api.moesif.com/v1/~/workspaces/{id}', { - method: 'POST', + method: 'GET', headers: headers }) @@ -9972,7 +10113,7 @@ headers = { 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.post('https://api.moesif.com/v1/~/cohorts', headers = headers) +r = requests.get('https://api.moesif.com/v1/~/workspaces/{id}', headers = headers) print(r.json()) @@ -9987,9 +10128,10 @@ headers = { 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/~/cohorts', +result = RestClient.get 'https://api.moesif.com/v1/~/workspaces/{id}', params: { - }, headers: headers + }, + headers: headers p JSON.parse(result) @@ -10007,13 +10149,9 @@ $headers = array( $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('POST','https://api.moesif.com/v1/~/cohorts', array( + $response = $client->request('GET','https://api.moesif.com/v1/~/workspaces/{id}', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -10041,9 +10179,9 @@ func main() { "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/cohorts", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/workspaces/{id}") req.Header = headers client := &http.Client{} @@ -10077,38 +10215,26 @@ public class HttpExample Client = new HttpClient(); } - /// Make a dummy request - public async Task MakePostRequest() + public async Task MakeGetRequest() { - string url = "https://api.moesif.com/v1/~/cohorts"; - - - await PostAsync(null, url); - + string url = "https://api.moesif.com/v1/~/workspaces/{id}"; + var result = await GetAsync(url); } - /// Performs a POST Request - public async Task PostAsync(undefined content, string url) + /// Performs a GET Request + public async Task GetAsync(string url) { - //Serialize Object - StringContent jsonContent = SerializeObject(content); + //Start the request + HttpResponseMessage response = await Client.GetAsync(url); + + //Validate result + response.EnsureSuccessStatusCode(); - //Execute POST request - HttpResponseMessage response = await Client.PostAsync(url, jsonContent); } - /// Serialize an object to Json - private StringContent SerializeObject(undefined content) - { - //Serialize Object - string jsonObject = JsonConvert.SerializeObject(content); - - //Create Json UTF8 String Content - return new StringContent(jsonObject, Encoding.UTF8, "application/json"); - } /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) @@ -10124,12 +10250,15 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/cohorts"); +URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("POST"); +con.setRequestMethod("GET"); + +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -10140,70 +10269,142 @@ System.out.println(response.toString()); ``` -`POST /~/cohorts` +`GET /~/workspaces/{id}` -*Create New Cohort* +*Get a Workspace* -

Parameters

+> `GET https://api.moesif.com/v1/~/workspaces/{id}` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|body|body|[CohortCreateItem](#schemacohortcreateitem)|false|none| +|id|path|string|true|none| > Example responses -> 201 Response +> 200 Response ```json { - "channels": null, - "priority": 0, - "url_query": "string", - "criteria": "string", + "name": "string", + "is_default": true, + "view_count": 0, "_id": "string", - "sample_rate": 0, - "notification_rule": { - "send_on_addition": true, - "send_on_removal": true, - "period": "string", - "fields": [ + "is_template": true, + "dashboard": {}, + "auth_user_id": "string", + "colors": {}, + "sequence": [ + { + "delay": 0, + "submit_data": { + "body": {}, + "url": "string", + "params": [ + { + "key": null, + "val": null + } + ], + "verb": "string", + "headers": [ + { + "key": null, + "val": null + } + ] + } + } + ], + "drawings": [ + { + "name": "string", + "direction": "string", + "id": "string", + "type": "string", + "value": 0.1 + } + ], + "chart": { + "original_encoded_view_elements": "string", + "funnel_query": {}, + "url_query": "string", + "to": "string", + "view_elements": {}, + "from": "string", + "original_encoded_funnel_query": "string", + "es_query": {}, + "args": "string", + "original_encoded_query": "string", + "time_zone": "string", + "view": "string" + }, + "template": { + "dynamic_fields": [ "string" - ] + ], + "dynamic_time": true }, - "cohort_name": "string", - "to": "string", - "week_starts_on": 0, - "locked_by": "string", - "modified_at": "2019-08-24T14:15:22Z", - "from": "string", - "created_at": "2019-08-24T14:15:22Z", "app_id": "string", - "cohort_type": "string", - "time_zone": "string", - "org_id": "string" + "type": "string", + "width": 0.1, + "sort_order": 0.1, + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + }, + "org_id": "string", + "migration": {}, + "created": "2024-04-11T04:01:35.090Z", + "comments": { + "summary": { + "count": 0, + "latest_comment": { + "auth_user_id": "string", + "comment_id": "string", + "mentions": [ + "string" + ], + "partner_user_id": "string", + "message": "string", + "created_at": "2024-04-11T04:01:35.090Z", + "updated_at": "2024-04-11T04:01:35.090Z" + } + } + } } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|[CohortDocument](#schemacohortdocument)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[WorkspaceDocument](#schemaworkspacedocument)| -## getCohorts +## deleteWorkspace - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/~/cohorts?cohort_type=string \ +curl -X DELETE https://api.moesif.com/v1/~/workspaces/{id} \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -10215,9 +10416,9 @@ const headers = { 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/cohorts?cohort_type=string', +fetch('https://api.moesif.com/v1/~/workspaces/{id}', { - method: 'GET', + method: 'DELETE', headers: headers }) @@ -10235,9 +10436,7 @@ headers = { 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.get('https://api.moesif.com/v1/~/cohorts', params={ - 'cohort_type': 'string' -}, headers = headers) +r = requests.delete('https://api.moesif.com/v1/~/workspaces/{id}', headers = headers) print(r.json()) @@ -10251,10 +10450,10 @@ headers = { 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/~/cohorts', +result = RestClient.delete 'https://api.moesif.com/v1/~/workspaces/{id}', params: { - 'cohort_type' => 'string' -}, headers: headers + }, + headers: headers p JSON.parse(result) @@ -10271,13 +10470,9 @@ $headers = array( $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('GET','https://api.moesif.com/v1/~/cohorts', array( + $response = $client->request('DELETE','https://api.moesif.com/v1/~/workspaces/{id}', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -10304,9 +10499,9 @@ func main() { headers := map[string][]string{ "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/cohorts", data) + + + req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/workspaces/{id}") req.Header = headers client := &http.Client{} @@ -10340,27 +10535,28 @@ public class HttpExample Client = new HttpClient(); } + + + /// Make a dummy request - public async Task MakeGetRequest() + public async Task MakeDeleteRequest() { - string url = "https://api.moesif.com/v1/~/cohorts"; - var result = await GetAsync(url); + int id = 1; + string url = "https://api.moesif.com/v1/~/workspaces/{id}"; + + await DeleteAsync(id, url); } - /// Performs a GET Request - public async Task GetAsync(string url) + /// Performs a DELETE Request + public async Task DeleteAsync(int id, string url) { - //Start the request - HttpResponseMessage response = await Client.GetAsync(url); - - //Validate result - response.EnsureSuccessStatusCode(); + //Execute DELETE request + HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); + //Return response + await DeserializeObject(response); } - - - /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) { @@ -10375,12 +10571,14 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/cohorts?cohort_type=string"); +URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("GET"); +con.setRequestMethod("DELETE"); + +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -10391,17 +10589,19 @@ System.out.println(response.toString()); ``` -`GET /~/cohorts` +`DELETE /~/workspaces/{id}` -*Get Cohorts* +*Delete a Workspace* -

Parameters

+> `DELETE https://api.moesif.com/v1/~/workspaces/{id}` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|cohort_type|query|string|true|none| +|id|path|string|true|none| -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| @@ -10409,37 +10609,46 @@ System.out.println(response.toString()); -

Billing Meters

- -## getMeter +## createComment - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/~/billing/meters/{meterId} \ - -H 'Accept: application/json' \ +curl -X POST https://api.moesif.com/v1/~/workspaces/{id}/comments \ + -H 'Content-Type: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + -d '{ + "message": "string", + "mentions": [ + "string" + ] +}' ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = { + "message": "string", + "mentions": [ + "string" + ] +}; const headers = { - 'Accept':'application/json', + 'Content-Type':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/billing/meters/{meterId}', +fetch('https://api.moesif.com/v1/~/workspaces/{id}/comments', { - method: 'GET', - + method: 'POST', + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -10453,11 +10662,17 @@ fetch('https://api.moesif.com/v1/~/billing/meters/{meterId}', ```python import requests headers = { - 'Accept': 'application/json', + 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = { + "message": "string", + "mentions": [ + "string" + ] +} -r = requests.get('https://api.moesif.com/v1/~/billing/meters/{meterId}', headers = headers) +r = requests.post('https://api.moesif.com/v1/~/workspaces/{id}/comments', headers = headers, json = input_data) print(r.json()) @@ -10468,13 +10683,22 @@ require 'rest-client' require 'json' headers = { - 'Accept' => 'application/json', + 'Content-Type' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/~/billing/meters/{meterId}', +input_payload = JSON.parse('{ + "message": "string", + "mentions": [ + "string" + ] +}') + +result = RestClient.post 'https://api.moesif.com/v1/~/workspaces/{id}/comments', params: { - }, headers: headers + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -10486,19 +10710,23 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( - 'Accept' => 'application/json', + 'Content-Type' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('{ + "message": "string", + "mentions": [ + "string" + ] +}') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('GET','https://api.moesif.com/v1/~/billing/meters/{meterId}', array( + $response = $client->request('POST','https://api.moesif.com/v1/~/workspaces/{id}/comments', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -10523,12 +10751,17 @@ import ( func main() { headers := map[string][]string{ - "Accept": []string{"application/json"}, + "Content-Type": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/billing/meters/{meterId}", data) + jsonPayload := `{ + "message": "string", + "mentions": [ + "string" + ] +}` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/workspaces/{id}/comments", data) req.Header = headers client := &http.Client{} @@ -10562,26 +10795,45 @@ public class HttpExample Client = new HttpClient(); } + /// Make a dummy request - public async Task MakeGetRequest() + public async Task MakePostRequest() { - string url = "https://api.moesif.com/v1/~/billing/meters/{meterId}"; - var result = await GetAsync(url); + string url = "https://api.moesif.com/v1/~/workspaces/{id}/comments"; + + string json = @"{ + ""message"": ""string"", + ""mentions"": [ + ""string"" + ] +}"; + var content = JsonConvert.DeserializeObject(json); + await PostAsync(content, url); + + } - /// Performs a GET Request - public async Task GetAsync(string url) + /// Performs a POST Request + public async Task PostAsync(CommentItem content, string url) { - //Start the request - HttpResponseMessage response = await Client.GetAsync(url); - - //Validate result - response.EnsureSuccessStatusCode(); + //Serialize Object + StringContent jsonContent = SerializeObject(content); + //Execute POST request + HttpResponseMessage response = await Client.PostAsync(url, jsonContent); } + /// Serialize an object to Json + private StringContent SerializeObject(CommentItem content) + { + //Serialize Object + string jsonObject = JsonConvert.SerializeObject(content); + + //Create Json UTF8 String Content + return new StringContent(jsonObject, Encoding.UTF8, "application/json"); + } /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) @@ -10597,12 +10849,31 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/billing/meters/{meterId}"); +URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}/comments"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("GET"); +con.setRequestMethod("POST"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """{ + "message": "string", + "mentions": [ + "string" + ] +}"""; + +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -10613,42 +10884,50 @@ System.out.println(response.toString()); ``` -`GET /~/billing/meters/{meterId}` +`POST /~/workspaces/{id}/comments` -*Get Billing Meter by id* +*Create a New Comment* -Get Billing Meter by id +> `POST https://api.moesif.com/v1/~/workspaces/{id}/comments` -

Parameters

+> Example Request + +```json +{ + "message": "string", + "mentions": [ + "string" + ] +} +``` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|meterId|path|string|true|none| - -> Example responses +|id|path|string|true|none| +|body|body|[CommentItem](#schemacommentitem)|true|none| -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| - -

Response Schema

+|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|None| -## deleteMeter +## getComments - + > Code samples ```shell # You can also use wget -curl -X DELETE https://api.moesif.com/v1/~/billing/meters/{meterId} \ +curl -X GET https://api.moesif.com/v1/~/workspaces/{id}/comments \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -10660,9 +10939,9 @@ const headers = { 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/billing/meters/{meterId}', +fetch('https://api.moesif.com/v1/~/workspaces/{id}/comments', { - method: 'DELETE', + method: 'GET', headers: headers }) @@ -10680,7 +10959,7 @@ headers = { 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.delete('https://api.moesif.com/v1/~/billing/meters/{meterId}', headers = headers) +r = requests.get('https://api.moesif.com/v1/~/workspaces/{id}/comments', headers = headers) print(r.json()) @@ -10694,9 +10973,10 @@ headers = { 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.delete 'https://api.moesif.com/v1/~/billing/meters/{meterId}', +result = RestClient.get 'https://api.moesif.com/v1/~/workspaces/{id}/comments', params: { - }, headers: headers + }, + headers: headers p JSON.parse(result) @@ -10713,13 +10993,9 @@ $headers = array( $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('DELETE','https://api.moesif.com/v1/~/billing/meters/{meterId}', array( + $response = $client->request('GET','https://api.moesif.com/v1/~/workspaces/{id}/comments', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -10746,9 +11022,9 @@ func main() { headers := map[string][]string{ "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/billing/meters/{meterId}", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/workspaces/{id}/comments") req.Header = headers client := &http.Client{} @@ -10782,28 +11058,27 @@ public class HttpExample Client = new HttpClient(); } - - - /// Make a dummy request - public async Task MakeDeleteRequest() + public async Task MakeGetRequest() { - int id = 1; - string url = "https://api.moesif.com/v1/~/billing/meters/{meterId}"; - - await DeleteAsync(id, url); + string url = "https://api.moesif.com/v1/~/workspaces/{id}/comments"; + var result = await GetAsync(url); } - /// Performs a DELETE Request - public async Task DeleteAsync(int id, string url) + /// Performs a GET Request + public async Task GetAsync(string url) { - //Execute DELETE request - HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); + //Start the request + HttpResponseMessage response = await Client.GetAsync(url); + + //Validate result + response.EnsureSuccessStatusCode(); - //Return response - await DeserializeObject(response); } + + + /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) { @@ -10818,12 +11093,14 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/billing/meters/{meterId}"); +URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}/comments"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("DELETE"); +con.setRequestMethod("GET"); + +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -10834,19 +11111,19 @@ System.out.println(response.toString()); ``` -`DELETE /~/billing/meters/{meterId}` +`GET /~/workspaces/{id}/comments` -*Delete Billing Meter by id* +*Get all Comments* -Delete Billing Meter by id +> `GET https://api.moesif.com/v1/~/workspaces/{id}/comments` -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|meterId|path|string|true|none| +|id|path|string|true|none| -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| @@ -10854,35 +11131,46 @@ Delete Billing Meter by id -## listMeters +## updateComment - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/~/billing/meters \ - -H 'Accept: application/json' \ +curl -X POST https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId} \ + -H 'Content-Type: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + -d '{ + "message": "string", + "mentions": [ + "string" + ] +}' ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = { + "message": "string", + "mentions": [ + "string" + ] +}; const headers = { - 'Accept':'application/json', + 'Content-Type':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/billing/meters', +fetch('https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}', { - method: 'GET', - + method: 'POST', + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -10896,11 +11184,17 @@ fetch('https://api.moesif.com/v1/~/billing/meters', ```python import requests headers = { - 'Accept': 'application/json', + 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = { + "message": "string", + "mentions": [ + "string" + ] +} -r = requests.get('https://api.moesif.com/v1/~/billing/meters', headers = headers) +r = requests.post('https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}', headers = headers, json = input_data) print(r.json()) @@ -10911,13 +11205,22 @@ require 'rest-client' require 'json' headers = { - 'Accept' => 'application/json', + 'Content-Type' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/~/billing/meters', +input_payload = JSON.parse('{ + "message": "string", + "mentions": [ + "string" + ] +}') + +result = RestClient.post 'https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}', params: { - }, headers: headers + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -10929,19 +11232,23 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( - 'Accept' => 'application/json', + 'Content-Type' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('{ + "message": "string", + "mentions": [ + "string" + ] +}') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('GET','https://api.moesif.com/v1/~/billing/meters', array( + $response = $client->request('POST','https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -10966,12 +11273,17 @@ import ( func main() { headers := map[string][]string{ - "Accept": []string{"application/json"}, + "Content-Type": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/billing/meters", data) + jsonPayload := `{ + "message": "string", + "mentions": [ + "string" + ] +}` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}", data) req.Header = headers client := &http.Client{} @@ -11005,26 +11317,45 @@ public class HttpExample Client = new HttpClient(); } + /// Make a dummy request - public async Task MakeGetRequest() + public async Task MakePostRequest() { - string url = "https://api.moesif.com/v1/~/billing/meters"; - var result = await GetAsync(url); + string url = "https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}"; + + string json = @"{ + ""message"": ""string"", + ""mentions"": [ + ""string"" + ] +}"; + var content = JsonConvert.DeserializeObject(json); + await PostAsync(content, url); + + } - /// Performs a GET Request - public async Task GetAsync(string url) + /// Performs a POST Request + public async Task PostAsync(CommentItem content, string url) { - //Start the request - HttpResponseMessage response = await Client.GetAsync(url); - - //Validate result - response.EnsureSuccessStatusCode(); + //Serialize Object + StringContent jsonContent = SerializeObject(content); + //Execute POST request + HttpResponseMessage response = await Client.PostAsync(url, jsonContent); } + /// Serialize an object to Json + private StringContent SerializeObject(CommentItem content) + { + //Serialize Object + string jsonObject = JsonConvert.SerializeObject(content); + + //Create Json UTF8 String Content + return new StringContent(jsonObject, Encoding.UTF8, "application/json"); + } /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) @@ -11040,12 +11371,31 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/billing/meters"); +URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("GET"); +con.setRequestMethod("POST"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """{ + "message": "string", + "mentions": [ + "string" + ] +}"""; + +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -11056,55 +11406,51 @@ System.out.println(response.toString()); ``` -`GET /~/billing/meters` - -*List Billing Meters* - -List Billing Meters - -

Parameters

+`POST /~/workspaces/{id}/comments/{commentId}` -|Name|In|Type|Required|Description| -|---|---|---|---|---| +*Update Existing Comment* -> Example responses +> `POST https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}` -> 200 Response +> Example Request ```json -[] +{ + "message": "string", + "mentions": [ + "string" + ] +} ``` -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|Inline| +

Parameters

-

Response Schema

+|Name|In|Type|Required|Description| +|---|---|---|---|---| +|id|path|string|true|none| +|commentId|path|string|true|none| +|body|body|[CommentItem](#schemacommentitem)|true|none| -Status Code **200** +

Responses

-|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|» *anonymous*|any|false|none|none| +|Status|Meaning|Description|Schema| +|---|---|---|---| +|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|None| -

Balance Transactions

- -## createBalanceTransaction +## deleteComment - + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/~/billing/reports/balance_transactions \ +curl -X DELETE https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId} \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -11116,9 +11462,9 @@ const headers = { 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/billing/reports/balance_transactions', +fetch('https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}', { - method: 'POST', + method: 'DELETE', headers: headers }) @@ -11136,7 +11482,7 @@ headers = { 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.post('https://api.moesif.com/v1/~/billing/reports/balance_transactions', headers = headers) +r = requests.delete('https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}', headers = headers) print(r.json()) @@ -11150,9 +11496,10 @@ headers = { 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/~/billing/reports/balance_transactions', +result = RestClient.delete 'https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}', params: { - }, headers: headers + }, + headers: headers p JSON.parse(result) @@ -11169,13 +11516,9 @@ $headers = array( $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('POST','https://api.moesif.com/v1/~/billing/reports/balance_transactions', array( + $response = $client->request('DELETE','https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -11202,9 +11545,9 @@ func main() { headers := map[string][]string{ "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/billing/reports/balance_transactions", data) + + + req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}") req.Header = headers client := &http.Client{} @@ -11239,36 +11582,25 @@ public class HttpExample } + + /// Make a dummy request - public async Task MakePostRequest() - { - string url = "https://api.moesif.com/v1/~/billing/reports/balance_transactions"; - - - await PostAsync(null, url); - - } - - /// Performs a POST Request - public async Task PostAsync(undefined content, string url) + public async Task MakeDeleteRequest() { - //Serialize Object - StringContent jsonContent = SerializeObject(content); + int id = 1; + string url = "https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}"; - //Execute POST request - HttpResponseMessage response = await Client.PostAsync(url, jsonContent); + await DeleteAsync(id, url); } - - - - /// Serialize an object to Json - private StringContent SerializeObject(undefined content) + + /// Performs a DELETE Request + public async Task DeleteAsync(int id, string url) { - //Serialize Object - string jsonObject = JsonConvert.SerializeObject(content); + //Execute DELETE request + HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); - //Create Json UTF8 String Content - return new StringContent(jsonObject, Encoding.UTF8, "application/json"); + //Return response + await DeserializeObject(response); } /// Deserialize object from request response @@ -11285,12 +11617,14 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/billing/reports/balance_transactions"); +URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("POST"); +con.setRequestMethod("DELETE"); + +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -11301,41 +11635,39 @@ System.out.println(response.toString()); ``` -`POST /~/billing/reports/balance_transactions` +`DELETE /~/workspaces/{id}/comments/{commentId}` -*Post BillingReports Balance Transactions* +*Delete a Comment* -Post a billing report of type balance_transaction +> `DELETE https://api.moesif.com/v1/~/workspaces/{id}/comments/{commentId}` -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|body|body|undefined|false|none| +|id|path|string|true|none| +|commentId|path|string|true|none| -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|204|[No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5)|success, no content and BillingReports were created or updated|None| +|204|[No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5)|success|None| -

OAuth

- -## getTokenInfo +## addACLPermissions - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/~/oauth/tokeninfo?scope=string \ - -H 'Accept: application/json' \ +curl -X POST https://api.moesif.com/v1/~/workspaces/{id}/policy/acl \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -11344,13 +11676,12 @@ curl -X GET https://api.moesif.com/v1/~/oauth/tokeninfo?scope=string \ const fetch = require('node-fetch'); const headers = { - 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/oauth/tokeninfo?scope=string', +fetch('https://api.moesif.com/v1/~/workspaces/{id}/policy/acl', { - method: 'GET', + method: 'POST', headers: headers }) @@ -11365,13 +11696,10 @@ fetch('https://api.moesif.com/v1/~/oauth/tokeninfo?scope=string', ```python import requests headers = { - 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.get('https://api.moesif.com/v1/~/oauth/tokeninfo', params={ - 'scope': 'string' -}, headers = headers) +r = requests.post('https://api.moesif.com/v1/~/workspaces/{id}/policy/acl', headers = headers) print(r.json()) @@ -11382,14 +11710,13 @@ require 'rest-client' require 'json' headers = { - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/~/oauth/tokeninfo', +result = RestClient.post 'https://api.moesif.com/v1/~/workspaces/{id}/policy/acl', params: { - 'scope' => 'string' -}, headers: headers + }, + headers: headers p JSON.parse(result) @@ -11401,19 +11728,14 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('GET','https://api.moesif.com/v1/~/oauth/tokeninfo', array( + $response = $client->request('POST','https://api.moesif.com/v1/~/workspaces/{id}/policy/acl', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -11438,12 +11760,11 @@ import ( func main() { headers := map[string][]string{ - "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/oauth/tokeninfo", data) + + + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/workspaces/{id}/policy/acl") req.Header = headers client := &http.Client{} @@ -11477,26 +11798,38 @@ public class HttpExample Client = new HttpClient(); } + /// Make a dummy request - public async Task MakeGetRequest() + public async Task MakePostRequest() { - string url = "https://api.moesif.com/v1/~/oauth/tokeninfo"; - var result = await GetAsync(url); + string url = "https://api.moesif.com/v1/~/workspaces/{id}/policy/acl"; + + + await PostAsync(null, url); + } - /// Performs a GET Request - public async Task GetAsync(string url) + /// Performs a POST Request + public async Task PostAsync(undefined content, string url) { - //Start the request - HttpResponseMessage response = await Client.GetAsync(url); - - //Validate result - response.EnsureSuccessStatusCode(); + //Serialize Object + StringContent jsonContent = SerializeObject(content); + //Execute POST request + HttpResponseMessage response = await Client.PostAsync(url, jsonContent); } + /// Serialize an object to Json + private StringContent SerializeObject(undefined content) + { + //Serialize Object + string jsonObject = JsonConvert.SerializeObject(content); + + //Create Json UTF8 String Content + return new StringContent(jsonObject, Encoding.UTF8, "application/json"); + } /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) @@ -11512,12 +11845,14 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/oauth/tokeninfo?scope=string"); +URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}/policy/acl"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("GET"); +con.setRequestMethod("POST"); + +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -11528,43 +11863,40 @@ System.out.println(response.toString()); ``` -`GET /~/oauth/tokeninfo` +`POST /~/workspaces/{id}/policy/acl` -*Get Token Info* +*Add ACL permission* -Get info for user's token +> `POST https://api.moesif.com/v1/~/workspaces/{id}/policy/acl` -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|scope|query|string|true|none| - -> Example responses +|id|path|string|true|none| +|grantee|query|string|false|none| +|permission|query|string|false|none| -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| -

Response Schema

- -## getAccessToken +## deleteACLPermissions - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/~/oauth/access_tokens?target=string&scope=string \ - -H 'Accept: application/json' \ +curl -X DELETE https://api.moesif.com/v1/~/workspaces/{id}/policy/acl?grantee=string \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -11573,13 +11905,12 @@ curl -X GET https://api.moesif.com/v1/~/oauth/access_tokens?target=string&scope= const fetch = require('node-fetch'); const headers = { - 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/oauth/access_tokens?target=string&scope=string', +fetch('https://api.moesif.com/v1/~/workspaces/{id}/policy/acl?grantee=string', { - method: 'GET', + method: 'DELETE', headers: headers }) @@ -11594,12 +11925,12 @@ fetch('https://api.moesif.com/v1/~/oauth/access_tokens?target=string&scope=strin ```python import requests headers = { - 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.get('https://api.moesif.com/v1/~/oauth/access_tokens', params={ - 'target': 'string', 'scope': 'string' +r = requests.delete('https://api.moesif.com/v1/~/workspaces/{id}/policy/acl', params={ + 'grantee': 'string' + }, headers = headers) print(r.json()) @@ -11611,15 +11942,14 @@ require 'rest-client' require 'json' headers = { - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/~/oauth/access_tokens', +result = RestClient.delete 'https://api.moesif.com/v1/~/workspaces/{id}/policy/acl', params: { - 'target' => 'string', -'scope' => 'string' -}, headers: headers + 'grantee' => 'string' + }, + headers: headers p JSON.parse(result) @@ -11631,19 +11961,14 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('GET','https://api.moesif.com/v1/~/oauth/access_tokens', array( + $response = $client->request('DELETE','https://api.moesif.com/v1/~/workspaces/{id}/policy/acl', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -11668,12 +11993,11 @@ import ( func main() { headers := map[string][]string{ - "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/oauth/access_tokens", data) + + + req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/workspaces/{id}/policy/acl") req.Header = headers client := &http.Client{} @@ -11707,27 +12031,28 @@ public class HttpExample Client = new HttpClient(); } + + + /// Make a dummy request - public async Task MakeGetRequest() + public async Task MakeDeleteRequest() { - string url = "https://api.moesif.com/v1/~/oauth/access_tokens"; - var result = await GetAsync(url); + int id = 1; + string url = "https://api.moesif.com/v1/~/workspaces/{id}/policy/acl"; + + await DeleteAsync(id, url); } - /// Performs a GET Request - public async Task GetAsync(string url) + /// Performs a DELETE Request + public async Task DeleteAsync(int id, string url) { - //Start the request - HttpResponseMessage response = await Client.GetAsync(url); - - //Validate result - response.EnsureSuccessStatusCode(); + //Execute DELETE request + HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); + //Return response + await DeserializeObject(response); } - - - /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) { @@ -11742,12 +12067,14 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/oauth/access_tokens?target=string&scope=string"); +URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}/policy/acl?grantee=string"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("GET"); +con.setRequestMethod("DELETE"); + +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -11758,70 +12085,71 @@ System.out.println(response.toString()); ``` -`GET /~/oauth/access_tokens` +`DELETE /~/workspaces/{id}/policy/acl` -*Get a new Access Token* +*Delete ACL permission* -Get a new access_token using logged in user's token +> `DELETE https://api.moesif.com/v1/~/workspaces/{id}/policy/acl` -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|target|query|string|true|none| -|scope|query|string|true|none| -|publishable|query|boolean|false|none| -|expiration|query|string(date-time)|false|none| - -> Example responses - -> 200 Response - -```json -{ - "app_token": "string" -} -``` +|id|path|string|true|none| +|grantee|query|string|true|none| -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[AccessTokenDTO](#schemaaccesstokendto)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| -

Profile View

+

Applications

-## createProfileViewConfig +## addApp - + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/~/profileviewconfigs?entity=string \ +curl -X POST https://api.moesif.com/v1/~/apps \ + -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + -d '{ + "name": "string", + "time_zone": "string", + "week_starts_on": 0, + "custom_app_id": "string" +}' ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = { + "name": "string", + "time_zone": "string", + "week_starts_on": 0, + "custom_app_id": "string" +}; const headers = { + 'Content-Type':'application/json', 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/profileviewconfigs?entity=string', +fetch('https://api.moesif.com/v1/~/apps', { method: 'POST', - + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -11835,13 +12163,18 @@ fetch('https://api.moesif.com/v1/~/profileviewconfigs?entity=string', ```python import requests headers = { + 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = { + "name": "string", + "time_zone": "string", + "week_starts_on": 0, + "custom_app_id": "string" +} -r = requests.post('https://api.moesif.com/v1/~/profileviewconfigs', params={ - 'entity': 'string' -}, headers = headers) +r = requests.post('https://api.moesif.com/v1/~/apps', headers = headers, json = input_data) print(r.json()) @@ -11852,14 +12185,23 @@ require 'rest-client' require 'json' headers = { + 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/~/profileviewconfigs', +input_payload = JSON.parse('{ + "name": "string", + "time_zone": "string", + "week_starts_on": 0, + "custom_app_id": "string" +}') + +result = RestClient.post 'https://api.moesif.com/v1/~/apps', params: { - 'entity' => 'string' -}, headers: headers + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -11871,19 +12213,24 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('{ + "name": "string", + "time_zone": "string", + "week_starts_on": 0, + "custom_app_id": "string" +}') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('POST','https://api.moesif.com/v1/~/profileviewconfigs', array( + $response = $client->request('POST','https://api.moesif.com/v1/~/apps', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -11908,12 +12255,18 @@ import ( func main() { headers := map[string][]string{ + "Content-Type": []string{"application/json"}, "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/profileviewconfigs", data) + jsonPayload := `{ + "name": "string", + "time_zone": "string", + "week_starts_on": 0, + "custom_app_id": "string" +}` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/apps", data) req.Header = headers client := &http.Client{} @@ -11951,15 +12304,22 @@ public class HttpExample /// Make a dummy request public async Task MakePostRequest() { - string url = "https://api.moesif.com/v1/~/profileviewconfigs"; + string url = "https://api.moesif.com/v1/~/apps"; + string json = @"{ + ""name"": ""string"", + ""time_zone"": ""string"", + ""week_starts_on"": 0, + ""custom_app_id"": ""string"" +}"; + var content = JsonConvert.DeserializeObject(json); + await PostAsync(content, url); - await PostAsync(null, url); } /// Performs a POST Request - public async Task PostAsync(undefined content, string url) + public async Task PostAsync(AppCreate content, string url) { //Serialize Object StringContent jsonContent = SerializeObject(content); @@ -11971,7 +12331,7 @@ public class HttpExample /// Serialize an object to Json - private StringContent SerializeObject(undefined content) + private StringContent SerializeObject(AppCreate content) { //Serialize Object string jsonObject = JsonConvert.SerializeObject(content); @@ -11994,12 +12354,32 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/profileviewconfigs?entity=string"); +URL obj = new URL("https://api.moesif.com/v1/~/apps"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """{ + "name": "string", + "time_zone": "string", + "week_starts_on": 0, + "custom_app_id": "string" +}"""; + +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -12010,41 +12390,68 @@ System.out.println(response.toString()); ``` -`POST /~/profileviewconfigs` +`POST /~/apps` + +*Create a new App* + +Create a new app under the selected organization + +> `POST https://api.moesif.com/v1/~/apps` -*Create a new Profile View of a given entity type. Note the compound index (orgId, appId, entity) is unique in this collection* +> Example Request -

Parameters

+```json +{ + "name": "string", + "time_zone": "string", + "week_starts_on": 0, + "custom_app_id": "string" +} +``` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|entity|query|string|true|none| -|body|body|undefined|false|none| +|body|body|[AppCreate](#schemaappcreatedto)|true|none| > Example responses -

Responses

+> 200 Response + +```json +{ + "name": "string", + "custom_app_id": "string", + "search_api_base_url": "string", + "week_starts_on": 0, + "id": "string", + "portal_api_base_url": "string", + "secure_proxy": true, + "time_zone": "string" +} +``` + +

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|created|None| - -

Response Schema

+|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[AppResponse](#schemaappresponsedto)| -## getProfileViewConfig +## getApps - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/~/profileviewconfigs?entity=string \ +curl -X GET https://api.moesif.com/v1/~/apps?take=0 \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' @@ -12058,7 +12465,7 @@ const headers = { 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/profileviewconfigs?entity=string', +fetch('https://api.moesif.com/v1/~/apps?take=0', { method: 'GET', @@ -12079,8 +12486,9 @@ headers = { 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.get('https://api.moesif.com/v1/~/profileviewconfigs', params={ - 'entity': 'string' +r = requests.get('https://api.moesif.com/v1/~/apps', params={ + 'take': '0' + }, headers = headers) print(r.json()) @@ -12096,10 +12504,11 @@ headers = { 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/~/profileviewconfigs', +result = RestClient.get 'https://api.moesif.com/v1/~/apps', params: { - 'entity' => 'string' -}, headers: headers + 'take' => 'integer(int32)' + }, + headers: headers p JSON.parse(result) @@ -12117,13 +12526,9 @@ $headers = array( $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('GET','https://api.moesif.com/v1/~/profileviewconfigs', array( + $response = $client->request('GET','https://api.moesif.com/v1/~/apps', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -12151,9 +12556,9 @@ func main() { "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/profileviewconfigs", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/apps") req.Header = headers client := &http.Client{} @@ -12190,7 +12595,7 @@ public class HttpExample /// Make a dummy request public async Task MakeGetRequest() { - string url = "https://api.moesif.com/v1/~/profileviewconfigs"; + string url = "https://api.moesif.com/v1/~/apps"; var result = await GetAsync(url); } @@ -12222,12 +12627,15 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/profileviewconfigs?entity=string"); +URL obj = new URL("https://api.moesif.com/v1/~/apps?take=0"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); + +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -12238,59 +12646,106 @@ System.out.println(response.toString()); ``` -`GET /~/profileviewconfigs` +`GET /~/apps` + +*Gets Apps* -*Get a Profile View* +Gets a list of apps for the selected organization -Get the Profile View of a given entity type for authenticated users +> `GET https://api.moesif.com/v1/~/apps` -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|entity|query|string|true|none| +|take|query|integer(int32)|true|none| +|before_id|query|string|false|none| > Example responses -

Responses

+> 200 Response + +```json +[ + { + "name": "string", + "custom_app_id": "string", + "search_api_base_url": "string", + "week_starts_on": 0, + "id": "string", + "portal_api_base_url": "string", + "secure_proxy": true, + "time_zone": "string" + } +] +``` + +

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|Inline| + +

Response Schema

+ +Status Code **200** -

Response Schema

+|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|*anonymous*|[[AppResponse](#schemaappresponsedto)]|false|none|none| +|» name|string|true|none|none| +|» custom_app_id|string|false|none|none| +|» search_api_base_url|string|false|none|none| +|» week_starts_on|integer(int32)|false|none|none| +|» id|string|false|none|none| +|» portal_api_base_url|string|false|none|none| +|» secure_proxy|boolean|false|none|none| +|» time_zone|string|false|none|none| -## deleteProfileViewConfig +## updateApp - + > Code samples ```shell # You can also use wget -curl -X DELETE https://api.moesif.com/v1/~/profileviewconfigs?entity=string \ +curl -X POST https://api.moesif.com/v1/~/apps/{id} \ + -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + -d '{ + "name": "string", + "time_zone": "string", + "week_starts_on": 0, + "custom_app_id": "string" +}' ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = { + "name": "string", + "time_zone": "string", + "week_starts_on": 0, + "custom_app_id": "string" +}; const headers = { + 'Content-Type':'application/json', 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/profileviewconfigs?entity=string', +fetch('https://api.moesif.com/v1/~/apps/{id}', { - method: 'DELETE', - + method: 'POST', + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -12304,13 +12759,18 @@ fetch('https://api.moesif.com/v1/~/profileviewconfigs?entity=string', ```python import requests headers = { + 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = { + "name": "string", + "time_zone": "string", + "week_starts_on": 0, + "custom_app_id": "string" +} -r = requests.delete('https://api.moesif.com/v1/~/profileviewconfigs', params={ - 'entity': 'string' -}, headers = headers) +r = requests.post('https://api.moesif.com/v1/~/apps/{id}', headers = headers, json = input_data) print(r.json()) @@ -12321,14 +12781,23 @@ require 'rest-client' require 'json' headers = { + 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.delete 'https://api.moesif.com/v1/~/profileviewconfigs', +input_payload = JSON.parse('{ + "name": "string", + "time_zone": "string", + "week_starts_on": 0, + "custom_app_id": "string" +}') + +result = RestClient.post 'https://api.moesif.com/v1/~/apps/{id}', params: { - 'entity' => 'string' -}, headers: headers + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -12340,19 +12809,24 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('{ + "name": "string", + "time_zone": "string", + "week_starts_on": 0, + "custom_app_id": "string" +}') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('DELETE','https://api.moesif.com/v1/~/profileviewconfigs', array( + $response = $client->request('POST','https://api.moesif.com/v1/~/apps/{id}', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -12377,12 +12851,18 @@ import ( func main() { headers := map[string][]string{ + "Content-Type": []string{"application/json"}, "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/profileviewconfigs", data) + jsonPayload := `{ + "name": "string", + "time_zone": "string", + "week_starts_on": 0, + "custom_app_id": "string" +}` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/apps/{id}", data) req.Header = headers client := &http.Client{} @@ -12417,25 +12897,43 @@ public class HttpExample } - - /// Make a dummy request - public async Task MakeDeleteRequest() + public async Task MakePostRequest() { - int id = 1; - string url = "https://api.moesif.com/v1/~/profileviewconfigs"; - - await DeleteAsync(id, url); + string url = "https://api.moesif.com/v1/~/apps/{id}"; + + string json = @"{ + ""name"": ""string"", + ""time_zone"": ""string"", + ""week_starts_on"": 0, + ""custom_app_id"": ""string"" +}"; + var content = JsonConvert.DeserializeObject(json); + await PostAsync(content, url); + + } - /// Performs a DELETE Request - public async Task DeleteAsync(int id, string url) + /// Performs a POST Request + public async Task PostAsync(AppUpdate content, string url) { - //Execute DELETE request - HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); + //Serialize Object + StringContent jsonContent = SerializeObject(content); - //Return response - await DeserializeObject(response); + //Execute POST request + HttpResponseMessage response = await Client.PostAsync(url, jsonContent); + } + + + + /// Serialize an object to Json + private StringContent SerializeObject(AppUpdate content) + { + //Serialize Object + string jsonObject = JsonConvert.SerializeObject(content); + + //Create Json UTF8 String Content + return new StringContent(jsonObject, Encoding.UTF8, "application/json"); } /// Deserialize object from request response @@ -12452,12 +12950,32 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/profileviewconfigs?entity=string"); +URL obj = new URL("https://api.moesif.com/v1/~/apps/{id}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("DELETE"); +con.setRequestMethod("POST"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """{ + "name": "string", + "time_zone": "string", + "week_starts_on": 0, + "custom_app_id": "string" +}"""; + +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -12468,41 +12986,65 @@ System.out.println(response.toString()); ``` -`DELETE /~/profileviewconfigs` +`POST /~/apps/{id}` + +*Update Apps* + +Update the name of the app for the selected organization + +> `POST https://api.moesif.com/v1/~/apps/{id}` -*Delete a Profile View* +> Example Request -

Parameters

+```json +{ + "name": "string", + "time_zone": "string", + "week_starts_on": 0, + "custom_app_id": "string" +} +``` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|entity|query|string|true|none| +|id|path|string|true|none| +|body|body|[AppUpdate](#schemaappupdatedto)|true|none| > Example responses -

Responses

+> 200 Response + +```json +{ + "name": "string", + "time_zone": "string", + "week_starts_on": 0, + "custom_app_id": "string" +} +``` + +

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| - -

Response Schema

+|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[AppUpdate](#schemaappupdatedto)| -## upsertProfileViewConfig +## deleteApp - + > Code samples ```shell # You can also use wget -curl -X PUT https://api.moesif.com/v1/~/profileviewconfigs?entity=string \ - -H 'Accept: application/json' \ +curl -X DELETE https://api.moesif.com/v1/~/apps/{id} \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -12511,13 +13053,12 @@ curl -X PUT https://api.moesif.com/v1/~/profileviewconfigs?entity=string \ const fetch = require('node-fetch'); const headers = { - 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/profileviewconfigs?entity=string', +fetch('https://api.moesif.com/v1/~/apps/{id}', { - method: 'PUT', + method: 'DELETE', headers: headers }) @@ -12532,13 +13073,10 @@ fetch('https://api.moesif.com/v1/~/profileviewconfigs?entity=string', ```python import requests headers = { - 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.put('https://api.moesif.com/v1/~/profileviewconfigs', params={ - 'entity': 'string' -}, headers = headers) +r = requests.delete('https://api.moesif.com/v1/~/apps/{id}', headers = headers) print(r.json()) @@ -12549,14 +13087,13 @@ require 'rest-client' require 'json' headers = { - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.put 'https://api.moesif.com/v1/~/profileviewconfigs', +result = RestClient.delete 'https://api.moesif.com/v1/~/apps/{id}', params: { - 'entity' => 'string' -}, headers: headers + }, + headers: headers p JSON.parse(result) @@ -12568,19 +13105,14 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('PUT','https://api.moesif.com/v1/~/profileviewconfigs', array( + $response = $client->request('DELETE','https://api.moesif.com/v1/~/apps/{id}', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -12605,12 +13137,11 @@ import ( func main() { headers := map[string][]string{ - "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("PUT", "https://api.moesif.com/v1/~/profileviewconfigs", data) + + + req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/apps/{id}") req.Header = headers client := &http.Client{} @@ -12646,40 +13177,24 @@ public class HttpExample + /// Make a dummy request - public async Task MakePutRequest() + public async Task MakeDeleteRequest() { int id = 1; - string url = "https://api.moesif.com/v1/~/profileviewconfigs"; + string url = "https://api.moesif.com/v1/~/apps/{id}"; - - - var result = await PutAsync(id, null, url); - + await DeleteAsync(id, url); } - /// Performs a PUT Request - public async Task PutAsync(int id, undefined content, string url) + /// Performs a DELETE Request + public async Task DeleteAsync(int id, string url) { - //Serialize Object - StringContent jsonContent = SerializeObject(content); - - //Execute PUT request - HttpResponseMessage response = await Client.PutAsync(url + $"/{id}", jsonContent); + //Execute DELETE request + HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); //Return response - return await DeserializeObject(response); - } - - - /// Serialize an object to Json - private StringContent SerializeObject(undefined content) - { - //Serialize Object - string jsonObject = JsonConvert.SerializeObject(content); - - //Create Json UTF8 String Content - return new StringContent(jsonObject, Encoding.UTF8, "application/json"); + await DeserializeObject(response); } /// Deserialize object from request response @@ -12696,12 +13211,14 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/profileviewconfigs?entity=string"); +URL obj = new URL("https://api.moesif.com/v1/~/apps/{id}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("PUT"); +con.setRequestMethod("DELETE"); + +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -12712,72 +13229,144 @@ System.out.println(response.toString()); ``` -`PUT /~/profileviewconfigs` - -*Update a Profile View* +`DELETE /~/apps/{id}` -

Parameters

+*Delete Apps* -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|entity|query|string|true|none| -|body|body|undefined|false|none| +Delete the app for the selected organization -> Example responses +> `DELETE https://api.moesif.com/v1/~/apps/{id}` -> 200 Response +

Parameters

-```json -{} -``` +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|id|path|string|true|none| -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|Inline| - -

Response Schema

- -Status Code **200** - -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|» *anonymous*|any|false|none|none| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| -

Applications

+

Product Catalog

-## addApp +## createMoesifPlan - + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/~/apps \ +curl -X POST https://api.moesif.com/v1/~/billing/catalog/plans?provider=string \ + -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + -d '{ + "name": "string", + "prices": [ + { + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 + } + ], + "provider": "string", + "description": "string", + "id": "string", + "status": "string", + "product_id": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "updated_at": "2024-04-11T04:01:35.090Z" +}' ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = { + "name": "string", + "prices": [ + { + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 + } + ], + "provider": "string", + "description": "string", + "id": "string", + "status": "string", + "product_id": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "updated_at": "2024-04-11T04:01:35.090Z" +}; const headers = { + 'Content-Type':'application/json', 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/apps', +fetch('https://api.moesif.com/v1/~/billing/catalog/plans?provider=string', { method: 'POST', - + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -12791,11 +13380,57 @@ fetch('https://api.moesif.com/v1/~/apps', ```python import requests headers = { + 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = { + "name": "string", + "prices": [ + { + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 + } + ], + "provider": "string", + "description": "string", + "id": "string", + "status": "string", + "product_id": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "updated_at": "2024-04-11T04:01:35.090Z" +} + +r = requests.post('https://api.moesif.com/v1/~/billing/catalog/plans', params={ + 'provider': 'string' -r = requests.post('https://api.moesif.com/v1/~/apps', headers = headers) +}, headers = headers, json = input_data) print(r.json()) @@ -12806,13 +13441,60 @@ require 'rest-client' require 'json' headers = { + 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/~/apps', +input_payload = JSON.parse('{ + "name": "string", + "prices": [ + { + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 + } + ], + "provider": "string", + "description": "string", + "id": "string", + "status": "string", + "product_id": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "updated_at": "2024-04-11T04:01:35.090Z" +}') + +result = RestClient.post 'https://api.moesif.com/v1/~/billing/catalog/plans', params: { - }, headers: headers + 'provider' => 'string' + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -12824,19 +13506,60 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('{ + "name": "string", + "prices": [ + { + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 + } + ], + "provider": "string", + "description": "string", + "id": "string", + "status": "string", + "product_id": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "updated_at": "2024-04-11T04:01:35.090Z" +}') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('POST','https://api.moesif.com/v1/~/apps', array( + $response = $client->request('POST','https://api.moesif.com/v1/~/billing/catalog/plans', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -12861,12 +13584,54 @@ import ( func main() { headers := map[string][]string{ + "Content-Type": []string{"application/json"}, "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/apps", data) + jsonPayload := `{ + "name": "string", + "prices": [ + { + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 + } + ], + "provider": "string", + "description": "string", + "id": "string", + "status": "string", + "product_id": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "updated_at": "2024-04-11T04:01:35.090Z" +}` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/billing/catalog/plans", data) req.Header = headers client := &http.Client{} @@ -12904,15 +13669,58 @@ public class HttpExample /// Make a dummy request public async Task MakePostRequest() { - string url = "https://api.moesif.com/v1/~/apps"; + string url = "https://api.moesif.com/v1/~/billing/catalog/plans"; + string json = @"{ + ""name"": ""string"", + ""prices"": [ + { + ""name"": ""string"", + ""transform_quantity"": { + ""divide_by"": 0, + ""round"": ""string"" + }, + ""provider"": ""string"", + ""price_in_decimal"": ""string"", + ""tiers"": [ + { + ""up_to"": null, + ""unit_price_in_decimal"": ""string"", + ""flat_price_in_decimal"": ""string"" + } + ], + ""period_units"": ""string"", + ""plan_id"": ""string"", + ""id"": ""string"", + ""status"": ""string"", + ""pricing_model"": ""string"", + ""tax_behavior"": ""string"", + ""currency"": ""string"", + ""metadata"": null, + ""created_at"": ""2024-04-11T04:01:35.090Z"", + ""unit"": ""string"", + ""usage_aggregator"": ""string"", + ""period"": 0 + } + ], + ""provider"": ""string"", + ""description"": ""string"", + ""id"": ""string"", + ""status"": ""string"", + ""product_id"": ""string"", + ""metadata"": null, + ""created_at"": ""2024-04-11T04:01:35.090Z"", + ""unit"": ""string"", + ""updated_at"": ""2024-04-11T04:01:35.090Z"" +}"; + var content = JsonConvert.DeserializeObject(json); + await PostAsync(content, url); - await PostAsync(null, url); } /// Performs a POST Request - public async Task PostAsync(undefined content, string url) + public async Task PostAsync(MoesifPlan content, string url) { //Serialize Object StringContent jsonContent = SerializeObject(content); @@ -12924,7 +13732,7 @@ public class HttpExample /// Serialize an object to Json - private StringContent SerializeObject(undefined content) + private StringContent SerializeObject(MoesifPlan content) { //Serialize Object string jsonObject = JsonConvert.SerializeObject(content); @@ -12932,27 +13740,83 @@ public class HttpExample //Create Json UTF8 String Content return new StringContent(jsonObject, Encoding.UTF8, "application/json"); } - - /// Deserialize object from request response - private async Task DeserializeObject(HttpResponseMessage response) - { - //Read body - string responseBody = await response.Content.ReadAsStringAsync(); + + /// Deserialize object from request response + private async Task DeserializeObject(HttpResponseMessage response) + { + //Read body + string responseBody = await response.Content.ReadAsStringAsync(); + + //Deserialize Body to object + var result = JsonConvert.DeserializeObject(responseBody); + } +} + +``` + +```java +URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/plans?provider=string"); +HttpURLConnection con = (HttpURLConnection) obj.openConnection(); +con.setRequestMethod("POST"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """{ + "name": "string", + "prices": [ + { + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 + } + ], + "provider": "string", + "description": "string", + "id": "string", + "status": "string", + "product_id": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "updated_at": "2024-04-11T04:01:35.090Z" +}"""; - //Deserialize Body to object - var result = JsonConvert.DeserializeObject(responseBody); - } +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); } -``` - -```java -URL obj = new URL("https://api.moesif.com/v1/~/apps"); -HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("POST"); int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -12963,55 +13827,135 @@ System.out.println(response.toString()); ``` -`POST /~/apps` +`POST /~/billing/catalog/plans` -*Create a new App* +*Create a new Moesif Plan* -Create a new app under the selected organization +> `POST https://api.moesif.com/v1/~/billing/catalog/plans` -

Parameters

+> Example Request + +```json +{ + "name": "string", + "prices": [ + { + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 + } + ], + "provider": "string", + "description": "string", + "id": "string", + "status": "string", + "product_id": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "updated_at": "2024-04-11T04:01:35.090Z" +} +``` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|body|body|[AppCreateDTO](#schemaappcreatedto)|false|none| +|provider|query|string|true|none| +|body|body|[MoesifPlan](#schemamoesifplan)|true|none| > Example responses -> 200 Response +> 201 Response ```json { "name": "string", - "custom_app_id": "string", - "search_api_base_url": "string", - "week_starts_on": 0, + "prices": [ + { + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 + } + ], + "provider": "string", + "description": "string", "id": "string", - "portal_api_base_url": "string", - "secure_proxy": true, - "time_zone": "string" + "status": "string", + "product_id": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "updated_at": "2024-04-11T04:01:35.090Z" } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[AppResponseDTO](#schemaappresponsedto)| +|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|created|[MoesifPlan](#schemamoesifplan)| -## getApps +## listMoesifPlans - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/~/apps?take=0 \ +curl -X GET https://api.moesif.com/v1/~/billing/catalog/plans \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' @@ -13025,7 +13969,7 @@ const headers = { 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/apps?take=0', +fetch('https://api.moesif.com/v1/~/billing/catalog/plans', { method: 'GET', @@ -13046,9 +13990,7 @@ headers = { 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.get('https://api.moesif.com/v1/~/apps', params={ - 'take': '0' -}, headers = headers) +r = requests.get('https://api.moesif.com/v1/~/billing/catalog/plans', headers = headers) print(r.json()) @@ -13063,10 +14005,10 @@ headers = { 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/~/apps', +result = RestClient.get 'https://api.moesif.com/v1/~/billing/catalog/plans', params: { - 'take' => 'integer(int32)' -}, headers: headers + }, + headers: headers p JSON.parse(result) @@ -13084,13 +14026,9 @@ $headers = array( $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('GET','https://api.moesif.com/v1/~/apps', array( + $response = $client->request('GET','https://api.moesif.com/v1/~/billing/catalog/plans', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -13118,9 +14056,9 @@ func main() { "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/apps", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/billing/catalog/plans") req.Header = headers client := &http.Client{} @@ -13157,7 +14095,7 @@ public class HttpExample /// Make a dummy request public async Task MakeGetRequest() { - string url = "https://api.moesif.com/v1/~/apps"; + string url = "https://api.moesif.com/v1/~/billing/catalog/plans"; var result = await GetAsync(url); } @@ -13189,12 +14127,15 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/apps?take=0"); +URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/plans"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); + +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -13205,18 +14146,18 @@ System.out.println(response.toString()); ``` -`GET /~/apps` +`GET /~/billing/catalog/plans` -*Gets Apps* +*List all Moesif Plans* -Gets a list of apps for the selected organization +> `GET https://api.moesif.com/v1/~/billing/catalog/plans` -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|take|query|integer(int32)|true|none| -|before_id|query|string|false|none| +|provider|query|string|false|none| +|includes|query|string|false|none| > Example responses @@ -13226,53 +14167,110 @@ Gets a list of apps for the selected organization [ { "name": "string", - "custom_app_id": "string", - "search_api_base_url": "string", - "week_starts_on": 0, + "prices": [ + { + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 + } + ], + "provider": "string", + "description": "string", "id": "string", - "portal_api_base_url": "string", - "secure_proxy": true, - "time_zone": "string" + "status": "string", + "product_id": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "updated_at": "2024-04-11T04:01:35.090Z" } ] ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|Inline| -

Response Schema

+

Response Schema

Status Code **200** |Name|Type|Required|Restrictions|Description| |---|---|---|---|---| -|*anonymous*|[[AppResponseDTO](#schemaappresponsedto)]|false|none|none| -|» name|string|true|none|none| -|» custom_app_id|string|false|none|none| -|» search_api_base_url|string|false|none|none| -|» week_starts_on|integer(int32)|false|none|none| +|*anonymous*|[[MoesifPlan](#schemamoesifplan)]|false|none|none| +|» name|string|false|none|none| +|» prices|[[MoesifPrice](#schemamoesifprice)]|false|none|none| +|»» name|string|false|none|none| +|»» transform_quantity|object|false|none|none| +|»»» divide_by|integer(int64)|true|none|none| +|»»» round|string|true|none|none| +|»» provider|string|false|none|none| +|»» price_in_decimal|string|false|none|none| +|»» tiers|[[MoesifPriceTier](#schemamoesifpricetier)]|false|none|none| +|»»» up_to|util.either[scala.long,string]|true|none|none| +|»»» unit_price_in_decimal|string|false|none|none| +|»»» flat_price_in_decimal|string|false|none|none| +|»» period_units|string|false|none|none| +|»» plan_id|string|false|none|none| +|»» id|string|false|none|none| +|»» status|string|false|none|none| +|»» pricing_model|string|false|none|none| +|»» tax_behavior|string|false|none|none| +|»» currency|string|false|none|none| +|»» metadata|.map[string,string]|false|none|none| +|»» created_at|string(date-time)|false|none|none| +|»» unit|string|false|none|none| +|»» usage_aggregator|string|false|none|none| +|»» period|integer(int64)|false|none|none| +|» provider|string|false|none|none| +|» description|string|false|none|none| |» id|string|false|none|none| -|» portal_api_base_url|string|false|none|none| -|» secure_proxy|boolean|false|none|none| -|» time_zone|string|false|none|none| +|» status|string|false|none|none| +|» product_id|string|false|none|none| +|» metadata|.map[string,string]|false|none|none| +|» created_at|string(date-time)|false|none|none| +|» unit|string|false|none|none| +|» updated_at|string(date-time)|false|none|none| -## updateApp +## getMoesifPlan - + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/~/apps/{id} \ +curl -X GET https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' @@ -13286,9 +14284,9 @@ const headers = { 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/apps/{id}', +fetch('https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string', { - method: 'POST', + method: 'GET', headers: headers }) @@ -13307,7 +14305,10 @@ headers = { 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.post('https://api.moesif.com/v1/~/apps/{id}', headers = headers) +r = requests.get('https://api.moesif.com/v1/~/billing/catalog/plans/{id}', params={ + 'provider': 'string' + +}, headers = headers) print(r.json()) @@ -13322,9 +14323,11 @@ headers = { 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/~/apps/{id}', +result = RestClient.get 'https://api.moesif.com/v1/~/billing/catalog/plans/{id}', params: { - }, headers: headers + 'provider' => 'string' + }, + headers: headers p JSON.parse(result) @@ -13342,13 +14345,9 @@ $headers = array( $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('POST','https://api.moesif.com/v1/~/apps/{id}', array( + $response = $client->request('GET','https://api.moesif.com/v1/~/billing/catalog/plans/{id}', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -13376,9 +14375,9 @@ func main() { "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/apps/{id}", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/billing/catalog/plans/{id}") req.Header = headers client := &http.Client{} @@ -13412,38 +14411,26 @@ public class HttpExample Client = new HttpClient(); } - /// Make a dummy request - public async Task MakePostRequest() + public async Task MakeGetRequest() { - string url = "https://api.moesif.com/v1/~/apps/{id}"; - - - await PostAsync(null, url); - + string url = "https://api.moesif.com/v1/~/billing/catalog/plans/{id}"; + var result = await GetAsync(url); } - /// Performs a POST Request - public async Task PostAsync(undefined content, string url) + /// Performs a GET Request + public async Task GetAsync(string url) { - //Serialize Object - StringContent jsonContent = SerializeObject(content); + //Start the request + HttpResponseMessage response = await Client.GetAsync(url); + + //Validate result + response.EnsureSuccessStatusCode(); - //Execute POST request - HttpResponseMessage response = await Client.PostAsync(url, jsonContent); } - /// Serialize an object to Json - private StringContent SerializeObject(undefined content) - { - //Serialize Object - string jsonObject = JsonConvert.SerializeObject(content); - - //Create Json UTF8 String Content - return new StringContent(jsonObject, Encoding.UTF8, "application/json"); - } /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) @@ -13459,12 +14446,15 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/apps/{id}"); +URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("POST"); +con.setRequestMethod("GET"); + +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -13475,17 +14465,20 @@ System.out.println(response.toString()); ``` -`POST /~/apps/{id}` +`GET /~/billing/catalog/plans/{id}` -*Update Apps* +*Get a Moesif Plan* -Update the name of the app for the selected organization +Get the Moesif Plan for authenticated users -

Parameters

+> `GET https://api.moesif.com/v1/~/billing/catalog/plans/{id}` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| |id|path|string|true|none| +|provider|query|string|true|none| > Example responses @@ -13494,35 +14487,68 @@ Update the name of the app for the selected organization ```json { "name": "string", - "custom_app_id": "string", - "search_api_base_url": "string", - "week_starts_on": 0, - "portal_api_base_url": "string", - "secure_proxy": true, - "time_zone": "string" + "prices": [ + { + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 + } + ], + "provider": "string", + "description": "string", + "id": "string", + "status": "string", + "product_id": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "updated_at": "2024-04-11T04:01:35.090Z" } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[AppUpdateDTO](#schemaappupdatedto)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[MoesifPlan](#schemamoesifplan)| -## deleteApp +## deleteMoesifPlan - + > Code samples ```shell # You can also use wget -curl -X DELETE https://api.moesif.com/v1/~/apps/{id} \ +curl -X DELETE https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -13534,7 +14560,7 @@ const headers = { 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/apps/{id}', +fetch('https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string', { method: 'DELETE', @@ -13554,7 +14580,10 @@ headers = { 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.delete('https://api.moesif.com/v1/~/apps/{id}', headers = headers) +r = requests.delete('https://api.moesif.com/v1/~/billing/catalog/plans/{id}', params={ + 'provider': 'string' + +}, headers = headers) print(r.json()) @@ -13568,9 +14597,11 @@ headers = { 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.delete 'https://api.moesif.com/v1/~/apps/{id}', +result = RestClient.delete 'https://api.moesif.com/v1/~/billing/catalog/plans/{id}', params: { - }, headers: headers + 'provider' => 'string' + }, + headers: headers p JSON.parse(result) @@ -13587,13 +14618,9 @@ $headers = array( $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('DELETE','https://api.moesif.com/v1/~/apps/{id}', array( + $response = $client->request('DELETE','https://api.moesif.com/v1/~/billing/catalog/plans/{id}', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -13620,9 +14647,9 @@ func main() { headers := map[string][]string{ "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/apps/{id}", data) + + + req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/billing/catalog/plans/{id}") req.Header = headers client := &http.Client{} @@ -13663,7 +14690,7 @@ public class HttpExample public async Task MakeDeleteRequest() { int id = 1; - string url = "https://api.moesif.com/v1/~/apps/{id}"; + string url = "https://api.moesif.com/v1/~/billing/catalog/plans/{id}"; await DeleteAsync(id, url); } @@ -13692,12 +14719,14 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/apps/{id}"); +URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("DELETE"); + +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -13708,57 +14737,141 @@ System.out.println(response.toString()); ``` -`DELETE /~/apps/{id}` +`DELETE /~/billing/catalog/plans/{id}` -*Delete Apps* +*Delete a Moesif Plan* -Delete the app for the selected organization +> `DELETE https://api.moesif.com/v1/~/billing/catalog/plans/{id}` -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| |id|path|string|true|none| +|provider|query|string|true|none| -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| +|204|[No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5)|no content|None| -

Billing Catalog

- -## getMoesifPrice +## updateMoesifPlan - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string \ +curl -X PUT https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string \ + -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + -d '{ + "name": "string", + "prices": [ + { + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 + } + ], + "provider": "string", + "description": "string", + "id": "string", + "status": "string", + "product_id": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "updated_at": "2024-04-11T04:01:35.090Z" +}' ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = { + "name": "string", + "prices": [ + { + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 + } + ], + "provider": "string", + "description": "string", + "id": "string", + "status": "string", + "product_id": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "updated_at": "2024-04-11T04:01:35.090Z" +}; const headers = { + 'Content-Type':'application/json', 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string', -{ - method: 'GET', - +fetch('https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string', +{ + method: 'PUT', + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -13772,13 +14885,57 @@ fetch('https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string', ```python import requests headers = { + 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = { + "name": "string", + "prices": [ + { + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 + } + ], + "provider": "string", + "description": "string", + "id": "string", + "status": "string", + "product_id": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "updated_at": "2024-04-11T04:01:35.090Z" +} -r = requests.get('https://api.moesif.com/v1/~/billing/catalog/prices/{id}', params={ +r = requests.put('https://api.moesif.com/v1/~/billing/catalog/plans/{id}', params={ 'provider': 'string' -}, headers = headers) + +}, headers = headers, json = input_data) print(r.json()) @@ -13789,14 +14946,60 @@ require 'rest-client' require 'json' headers = { + 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/~/billing/catalog/prices/{id}', +input_payload = JSON.parse('{ + "name": "string", + "prices": [ + { + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 + } + ], + "provider": "string", + "description": "string", + "id": "string", + "status": "string", + "product_id": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "updated_at": "2024-04-11T04:01:35.090Z" +}') + +result = RestClient.put 'https://api.moesif.com/v1/~/billing/catalog/plans/{id}', params: { 'provider' => 'string' -}, headers: headers + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -13808,19 +15011,60 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('{ + "name": "string", + "prices": [ + { + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 + } + ], + "provider": "string", + "description": "string", + "id": "string", + "status": "string", + "product_id": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "updated_at": "2024-04-11T04:01:35.090Z" +}') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('GET','https://api.moesif.com/v1/~/billing/catalog/prices/{id}', array( + $response = $client->request('PUT','https://api.moesif.com/v1/~/billing/catalog/plans/{id}', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -13845,12 +15089,54 @@ import ( func main() { headers := map[string][]string{ + "Content-Type": []string{"application/json"}, "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/billing/catalog/prices/{id}", data) + jsonPayload := `{ + "name": "string", + "prices": [ + { + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 + } + ], + "provider": "string", + "description": "string", + "id": "string", + "status": "string", + "product_id": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "updated_at": "2024-04-11T04:01:35.090Z" +}` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("PUT", "https://api.moesif.com/v1/~/billing/catalog/plans/{id}", data) req.Header = headers client := &http.Client{} @@ -13884,47 +15170,163 @@ public class HttpExample Client = new HttpClient(); } + + /// Make a dummy request - public async Task MakeGetRequest() + public async Task MakePutRequest() { - string url = "https://api.moesif.com/v1/~/billing/catalog/prices/{id}"; - var result = await GetAsync(url); + int id = 1; + string url = "https://api.moesif.com/v1/~/billing/catalog/plans/{id}"; + + + string json = @"{ + ""name"": ""string"", + ""prices"": [ + { + ""name"": ""string"", + ""transform_quantity"": { + ""divide_by"": 0, + ""round"": ""string"" + }, + ""provider"": ""string"", + ""price_in_decimal"": ""string"", + ""tiers"": [ + { + ""up_to"": null, + ""unit_price_in_decimal"": ""string"", + ""flat_price_in_decimal"": ""string"" + } + ], + ""period_units"": ""string"", + ""plan_id"": ""string"", + ""id"": ""string"", + ""status"": ""string"", + ""pricing_model"": ""string"", + ""tax_behavior"": ""string"", + ""currency"": ""string"", + ""metadata"": null, + ""created_at"": ""2024-04-11T04:01:35.090Z"", + ""unit"": ""string"", + ""usage_aggregator"": ""string"", + ""period"": 0 + } + ], + ""provider"": ""string"", + ""description"": ""string"", + ""id"": ""string"", + ""status"": ""string"", + ""product_id"": ""string"", + ""metadata"": null, + ""created_at"": ""2024-04-11T04:01:35.090Z"", + ""unit"": ""string"", + ""updated_at"": ""2024-04-11T04:01:35.090Z"" +}"; + var content = JsonConvert.DeserializeObject(json); + var result = await PutAsync(id, content, url); + + } - /// Performs a GET Request - public async Task GetAsync(string url) + /// Performs a PUT Request + public async Task PutAsync(int id, MoesifPlan content, string url) { - //Start the request - HttpResponseMessage response = await Client.GetAsync(url); + //Serialize Object + StringContent jsonContent = SerializeObject(content); - //Validate result - response.EnsureSuccessStatusCode(); + //Execute PUT request + HttpResponseMessage response = await Client.PutAsync(url + $"/{id}", jsonContent); + + //Return response + return await DeserializeObject(response); + } + + + /// Serialize an object to Json + private StringContent SerializeObject(MoesifPlan content) + { + //Serialize Object + string jsonObject = JsonConvert.SerializeObject(content); + + //Create Json UTF8 String Content + return new StringContent(jsonObject, Encoding.UTF8, "application/json"); + } + + /// Deserialize object from request response + private async Task DeserializeObject(HttpResponseMessage response) + { + //Read body + string responseBody = await response.Content.ReadAsStringAsync(); + + //Deserialize Body to object + var result = JsonConvert.DeserializeObject(responseBody); + } +} + +``` + +```java +URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string"); +HttpURLConnection con = (HttpURLConnection) obj.openConnection(); +con.setRequestMethod("PUT"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """{ + "name": "string", + "prices": [ + { + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 } - - - - - /// Deserialize object from request response - private async Task DeserializeObject(HttpResponseMessage response) - { - //Read body - string responseBody = await response.Content.ReadAsStringAsync(); + ], + "provider": "string", + "description": "string", + "id": "string", + "status": "string", + "product_id": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "updated_at": "2024-04-11T04:01:35.090Z" +}"""; - //Deserialize Body to object - var result = JsonConvert.DeserializeObject(responseBody); - } +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); } -``` - -```java -URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string"); -HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -13935,18 +15337,66 @@ System.out.println(response.toString()); ``` -`GET /~/billing/catalog/prices/{id}` +`PUT /~/billing/catalog/plans/{id}` -*Get a Moesif Price* +*Update a Moesif Plan* -Get the Moesif Price for a specific Plan for authenticated users +> `PUT https://api.moesif.com/v1/~/billing/catalog/plans/{id}` -

Parameters

+> Example Request + +```json +{ + "name": "string", + "prices": [ + { + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 + } + ], + "provider": "string", + "description": "string", + "id": "string", + "status": "string", + "product_id": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "updated_at": "2024-04-11T04:01:35.090Z" +} +``` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| |id|path|string|true|none| |provider|query|string|true|none| +|body|body|[MoesifPlan](#schemamoesifplan)|true|none| > Example responses @@ -13955,69 +15405,142 @@ Get the Moesif Price for a specific Plan for authenticated users ```json { "name": "string", - "transform_quantity": { - "divide_by": 0, - "round": "string" - }, - "provider": "string", - "price_in_decimal": "string", - "tiers": [ + "prices": [ { - "up_to": null, - "unit_price_in_decimal": "string", - "flat_price_in_decimal": "string" + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 } ], - "period_units": "string", - "plan_id": "string", + "provider": "string", + "description": "string", "id": "string", "status": "string", - "pricing_model": "string", - "tax_behavior": "string", - "currency": "string", + "product_id": "string", "metadata": null, - "created_at": "2019-08-24T14:15:22Z", + "created_at": "2024-04-11T04:01:35.090Z", "unit": "string", - "usage_aggregator": "string", - "period": 0 + "updated_at": "2024-04-11T04:01:35.090Z" } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[MoesifPrice](#schemamoesifprice)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[MoesifPlan](#schemamoesifplan)| -## deleteMoesifPrice +## createMoesifPrice - + > Code samples ```shell # You can also use wget -curl -X DELETE https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string \ +curl -X POST https://api.moesif.com/v1/~/billing/catalog/prices?provider=string \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + -d '{ + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 +}' ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = { + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 +}; const headers = { + 'Content-Type':'application/json', + 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string', +fetch('https://api.moesif.com/v1/~/billing/catalog/prices?provider=string', { - method: 'DELETE', - + method: 'POST', + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -14031,12 +15554,43 @@ fetch('https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string', ```python import requests headers = { + 'Content-Type': 'application/json', + 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = { + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 +} -r = requests.delete('https://api.moesif.com/v1/~/billing/catalog/prices/{id}', params={ +r = requests.post('https://api.moesif.com/v1/~/billing/catalog/prices', params={ 'provider': 'string' -}, headers = headers) + +}, headers = headers, json = input_data) print(r.json()) @@ -14047,13 +15601,46 @@ require 'rest-client' require 'json' headers = { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.delete 'https://api.moesif.com/v1/~/billing/catalog/prices/{id}', +input_payload = JSON.parse('{ + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 +}') + +result = RestClient.post 'https://api.moesif.com/v1/~/billing/catalog/prices', params: { 'provider' => 'string' -}, headers: headers + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -14065,18 +15652,46 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Content-Type' => 'application/json', + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('{ + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 +}') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('DELETE','https://api.moesif.com/v1/~/billing/catalog/prices/{id}', array( + $response = $client->request('POST','https://api.moesif.com/v1/~/billing/catalog/prices', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -14101,11 +15716,40 @@ import ( func main() { headers := map[string][]string{ + "Content-Type": []string{"application/json"}, + "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/billing/catalog/prices/{id}", data) + jsonPayload := `{ + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 +}` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/billing/catalog/prices", data) req.Header = headers client := &http.Client{} @@ -14140,25 +15784,65 @@ public class HttpExample } - - /// Make a dummy request - public async Task MakeDeleteRequest() + public async Task MakePostRequest() { - int id = 1; - string url = "https://api.moesif.com/v1/~/billing/catalog/prices/{id}"; - - await DeleteAsync(id, url); + string url = "https://api.moesif.com/v1/~/billing/catalog/prices"; + + string json = @"{ + ""name"": ""string"", + ""transform_quantity"": { + ""divide_by"": 0, + ""round"": ""string"" + }, + ""provider"": ""string"", + ""price_in_decimal"": ""string"", + ""tiers"": [ + { + ""up_to"": null, + ""unit_price_in_decimal"": ""string"", + ""flat_price_in_decimal"": ""string"" + } + ], + ""period_units"": ""string"", + ""plan_id"": ""string"", + ""id"": ""string"", + ""status"": ""string"", + ""pricing_model"": ""string"", + ""tax_behavior"": ""string"", + ""currency"": ""string"", + ""metadata"": null, + ""created_at"": ""2024-04-11T04:01:35.090Z"", + ""unit"": ""string"", + ""usage_aggregator"": ""string"", + ""period"": 0 +}"; + var content = JsonConvert.DeserializeObject(json); + await PostAsync(content, url); + + } - /// Performs a DELETE Request - public async Task DeleteAsync(int id, string url) + /// Performs a POST Request + public async Task PostAsync(MoesifPrice content, string url) { - //Execute DELETE request - HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); + //Serialize Object + StringContent jsonContent = SerializeObject(content); - //Return response - await DeserializeObject(response); + //Execute POST request + HttpResponseMessage response = await Client.PostAsync(url, jsonContent); + } + + + + /// Serialize an object to Json + private StringContent SerializeObject(MoesifPrice content) + { + //Serialize Object + string jsonObject = JsonConvert.SerializeObject(content); + + //Create Json UTF8 String Content + return new StringContent(jsonObject, Encoding.UTF8, "application/json"); } /// Deserialize object from request response @@ -14175,12 +15859,54 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string"); +URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/prices?provider=string"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("DELETE"); +con.setRequestMethod("POST"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """{ + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 +}"""; + +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -14191,37 +15917,107 @@ System.out.println(response.toString()); ``` -`DELETE /~/billing/catalog/prices/{id}` +`POST /~/billing/catalog/prices` -*Delete a Moesif Price* +*Create a new Moesif Price* -

Parameters

+> `POST https://api.moesif.com/v1/~/billing/catalog/prices` + +> Example Request + +```json +{ + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 +} +``` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|id|path|string|true|none| |provider|query|string|true|none| +|body|body|[MoesifPrice](#schemamoesifprice)|true|none| -

Responses

+> Example responses + +> 201 Response + +```json +{ + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 +} +``` + +

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|204|[No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5)|no content|None| +|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|created|[MoesifPrice](#schemamoesifprice)| -## updateMoesifPrice +## listMoesifPrices - + > Code samples ```shell # You can also use wget -curl -X PUT https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string \ +curl -X GET https://api.moesif.com/v1/~/billing/catalog/prices \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' @@ -14235,9 +16031,9 @@ const headers = { 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string', +fetch('https://api.moesif.com/v1/~/billing/catalog/prices', { - method: 'PUT', + method: 'GET', headers: headers }) @@ -14256,9 +16052,7 @@ headers = { 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.put('https://api.moesif.com/v1/~/billing/catalog/prices/{id}', params={ - 'provider': 'string' -}, headers = headers) +r = requests.get('https://api.moesif.com/v1/~/billing/catalog/prices', headers = headers) print(r.json()) @@ -14273,10 +16067,10 @@ headers = { 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.put 'https://api.moesif.com/v1/~/billing/catalog/prices/{id}', +result = RestClient.get 'https://api.moesif.com/v1/~/billing/catalog/prices', params: { - 'provider' => 'string' -}, headers: headers + }, + headers: headers p JSON.parse(result) @@ -14294,13 +16088,9 @@ $headers = array( $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('PUT','https://api.moesif.com/v1/~/billing/catalog/prices/{id}', array( + $response = $client->request('GET','https://api.moesif.com/v1/~/billing/catalog/prices', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -14328,9 +16118,9 @@ func main() { "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("PUT", "https://api.moesif.com/v1/~/billing/catalog/prices/{id}", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/billing/catalog/prices") req.Header = headers client := &http.Client{} @@ -14364,43 +16154,26 @@ public class HttpExample Client = new HttpClient(); } - - /// Make a dummy request - public async Task MakePutRequest() + public async Task MakeGetRequest() { - int id = 1; - string url = "https://api.moesif.com/v1/~/billing/catalog/prices/{id}"; - - - - var result = await PutAsync(id, null, url); - + string url = "https://api.moesif.com/v1/~/billing/catalog/prices"; + var result = await GetAsync(url); } - /// Performs a PUT Request - public async Task PutAsync(int id, undefined content, string url) + /// Performs a GET Request + public async Task GetAsync(string url) { - //Serialize Object - StringContent jsonContent = SerializeObject(content); + //Start the request + HttpResponseMessage response = await Client.GetAsync(url); - //Execute PUT request - HttpResponseMessage response = await Client.PutAsync(url + $"/{id}", jsonContent); + //Validate result + response.EnsureSuccessStatusCode(); - //Return response - return await DeserializeObject(response); } - /// Serialize an object to Json - private StringContent SerializeObject(undefined content) - { - //Serialize Object - string jsonObject = JsonConvert.SerializeObject(content); - - //Create Json UTF8 String Content - return new StringContent(jsonObject, Encoding.UTF8, "application/json"); - } + /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) @@ -14416,12 +16189,15 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string"); +URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/prices"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("PUT"); +con.setRequestMethod("GET"); + +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -14432,73 +16208,105 @@ System.out.println(response.toString()); ``` -`PUT /~/billing/catalog/prices/{id}` +`GET /~/billing/catalog/prices` -*Update a Moesif Price* +*List all Moesif Prices for a specific Plan* -

Parameters

+> `GET https://api.moesif.com/v1/~/billing/catalog/prices` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|id|path|string|true|none| -|provider|query|string|true|none| -|body|body|[MoesifPrice](#schemamoesifprice)|false|none| +|provider|query|string|false|none| > Example responses > 200 Response ```json -{ - "name": "string", - "transform_quantity": { - "divide_by": 0, - "round": "string" - }, - "provider": "string", - "price_in_decimal": "string", - "tiers": [ - { - "up_to": null, - "unit_price_in_decimal": "string", - "flat_price_in_decimal": "string" - } - ], - "period_units": "string", - "plan_id": "string", - "id": "string", - "status": "string", - "pricing_model": "string", - "tax_behavior": "string", - "currency": "string", - "metadata": null, - "created_at": "2019-08-24T14:15:22Z", - "unit": "string", - "usage_aggregator": "string", - "period": 0 -} +[ + { + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 + } +] ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[MoesifPrice](#schemamoesifprice)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|Inline| + +

Response Schema

+ +Status Code **200** + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|*anonymous*|[[MoesifPrice](#schemamoesifprice)]|false|none|none| +|» name|string|false|none|none| +|» transform_quantity|object|false|none|none| +|»» divide_by|integer(int64)|true|none|none| +|»» round|string|true|none|none| +|» provider|string|false|none|none| +|» price_in_decimal|string|false|none|none| +|» tiers|[[MoesifPriceTier](#schemamoesifpricetier)]|false|none|none| +|»» up_to|util.either[scala.long,string]|true|none|none| +|»» unit_price_in_decimal|string|false|none|none| +|»» flat_price_in_decimal|string|false|none|none| +|» period_units|string|false|none|none| +|» plan_id|string|false|none|none| +|» id|string|false|none|none| +|» status|string|false|none|none| +|» pricing_model|string|false|none|none| +|» tax_behavior|string|false|none|none| +|» currency|string|false|none|none| +|» metadata|.map[string,string]|false|none|none| +|» created_at|string(date-time)|false|none|none| +|» unit|string|false|none|none| +|» usage_aggregator|string|false|none|none| +|» period|integer(int64)|false|none|none| -## createMoesifPlan +## getMoesifPrice - + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/~/billing/catalog/plans?provider=string \ +curl -X GET https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' @@ -14512,9 +16320,9 @@ const headers = { 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/billing/catalog/plans?provider=string', +fetch('https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string', { - method: 'POST', + method: 'GET', headers: headers }) @@ -14533,8 +16341,9 @@ headers = { 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.post('https://api.moesif.com/v1/~/billing/catalog/plans', params={ +r = requests.get('https://api.moesif.com/v1/~/billing/catalog/prices/{id}', params={ 'provider': 'string' + }, headers = headers) print(r.json()) @@ -14550,10 +16359,11 @@ headers = { 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/~/billing/catalog/plans', +result = RestClient.get 'https://api.moesif.com/v1/~/billing/catalog/prices/{id}', params: { 'provider' => 'string' -}, headers: headers + }, + headers: headers p JSON.parse(result) @@ -14571,13 +16381,9 @@ $headers = array( $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('POST','https://api.moesif.com/v1/~/billing/catalog/plans', array( + $response = $client->request('GET','https://api.moesif.com/v1/~/billing/catalog/prices/{id}', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -14605,9 +16411,9 @@ func main() { "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/billing/catalog/plans", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/billing/catalog/prices/{id}") req.Header = headers client := &http.Client{} @@ -14641,38 +16447,26 @@ public class HttpExample Client = new HttpClient(); } - /// Make a dummy request - public async Task MakePostRequest() + public async Task MakeGetRequest() { - string url = "https://api.moesif.com/v1/~/billing/catalog/plans"; - - - await PostAsync(null, url); - + string url = "https://api.moesif.com/v1/~/billing/catalog/prices/{id}"; + var result = await GetAsync(url); } - /// Performs a POST Request - public async Task PostAsync(undefined content, string url) + /// Performs a GET Request + public async Task GetAsync(string url) { - //Serialize Object - StringContent jsonContent = SerializeObject(content); + //Start the request + HttpResponseMessage response = await Client.GetAsync(url); + + //Validate result + response.EnsureSuccessStatusCode(); - //Execute POST request - HttpResponseMessage response = await Client.PostAsync(url, jsonContent); } - /// Serialize an object to Json - private StringContent SerializeObject(undefined content) - { - //Serialize Object - string jsonObject = JsonConvert.SerializeObject(content); - - //Create Json UTF8 String Content - return new StringContent(jsonObject, Encoding.UTF8, "application/json"); - } /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) @@ -14688,12 +16482,15 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/plans?provider=string"); +URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("POST"); +con.setRequestMethod("GET"); + +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -14704,87 +16501,76 @@ System.out.println(response.toString()); ``` -`POST /~/billing/catalog/plans` +`GET /~/billing/catalog/prices/{id}` -*Create a new Moesif Plan* +*Get a Moesif Price* -

Parameters

+Get the Moesif Price for a specific Plan for authenticated users + +> `GET https://api.moesif.com/v1/~/billing/catalog/prices/{id}` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| +|id|path|string|true|none| |provider|query|string|true|none| -|body|body|[MoesifPlan](#schemamoesifplan)|false|none| > Example responses -> 201 Response +> 200 Response ```json { "name": "string", - "prices": [ + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ { - "name": "string", - "transform_quantity": { - "divide_by": 0, - "round": "string" - }, - "provider": "string", - "price_in_decimal": "string", - "tiers": [ - { - "up_to": null, - "unit_price_in_decimal": "string", - "flat_price_in_decimal": "string" - } - ], - "period_units": "string", - "plan_id": "string", - "id": "string", - "status": "string", - "pricing_model": "string", - "tax_behavior": "string", - "currency": "string", - "metadata": null, - "created_at": "2019-08-24T14:15:22Z", - "unit": "string", - "usage_aggregator": "string", - "period": 0 + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" } ], - "provider": "string", - "description": "string", + "period_units": "string", + "plan_id": "string", "id": "string", "status": "string", - "product_id": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", "metadata": null, - "created_at": "2019-08-24T14:15:22Z", + "created_at": "2024-04-11T04:01:35.090Z", "unit": "string", - "updated_at": "2019-08-24T14:15:22Z" + "usage_aggregator": "string", + "period": 0 } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|created|[MoesifPlan](#schemamoesifplan)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[MoesifPrice](#schemamoesifprice)| -## listMoesifPlans +## deleteMoesifPrice - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/~/billing/catalog/plans \ - -H 'Accept: application/json' \ +curl -X DELETE https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -14793,13 +16579,12 @@ curl -X GET https://api.moesif.com/v1/~/billing/catalog/plans \ const fetch = require('node-fetch'); const headers = { - 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/billing/catalog/plans', +fetch('https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string', { - method: 'GET', + method: 'DELETE', headers: headers }) @@ -14814,11 +16599,13 @@ fetch('https://api.moesif.com/v1/~/billing/catalog/plans', ```python import requests headers = { - 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.get('https://api.moesif.com/v1/~/billing/catalog/plans', headers = headers) +r = requests.delete('https://api.moesif.com/v1/~/billing/catalog/prices/{id}', params={ + 'provider': 'string' + +}, headers = headers) print(r.json()) @@ -14829,13 +16616,14 @@ require 'rest-client' require 'json' headers = { - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/~/billing/catalog/plans', +result = RestClient.delete 'https://api.moesif.com/v1/~/billing/catalog/prices/{id}', params: { - }, headers: headers + 'provider' => 'string' + }, + headers: headers p JSON.parse(result) @@ -14847,19 +16635,14 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('GET','https://api.moesif.com/v1/~/billing/catalog/plans', array( + $response = $client->request('DELETE','https://api.moesif.com/v1/~/billing/catalog/prices/{id}', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -14884,12 +16667,11 @@ import ( func main() { headers := map[string][]string{ - "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/billing/catalog/plans", data) + + + req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/billing/catalog/prices/{id}") req.Header = headers client := &http.Client{} @@ -14923,27 +16705,28 @@ public class HttpExample Client = new HttpClient(); } + + + /// Make a dummy request - public async Task MakeGetRequest() + public async Task MakeDeleteRequest() { - string url = "https://api.moesif.com/v1/~/billing/catalog/plans"; - var result = await GetAsync(url); + int id = 1; + string url = "https://api.moesif.com/v1/~/billing/catalog/prices/{id}"; + + await DeleteAsync(id, url); } - /// Performs a GET Request - public async Task GetAsync(string url) + /// Performs a DELETE Request + public async Task DeleteAsync(int id, string url) { - //Start the request - HttpResponseMessage response = await Client.GetAsync(url); - - //Validate result - response.EnsureSuccessStatusCode(); + //Execute DELETE request + HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); + //Return response + await DeserializeObject(response); } - - - /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) { @@ -14958,12 +16741,14 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/plans"); +URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("GET"); +con.setRequestMethod("DELETE"); + +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -14974,146 +16759,113 @@ System.out.println(response.toString()); ``` -`GET /~/billing/catalog/plans` +`DELETE /~/billing/catalog/prices/{id}` -*List all Moesif Plans* +*Delete a Moesif Price* -

Parameters

+> `DELETE https://api.moesif.com/v1/~/billing/catalog/prices/{id}` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|provider|query|string|false|none| -|includes|query|string|false|none| - -> Example responses - -> 200 Response - -```json -[ - { - "name": "string", - "prices": [ - { - "name": "string", - "transform_quantity": { - "divide_by": 0, - "round": "string" - }, - "provider": "string", - "price_in_decimal": "string", - "tiers": [ - { - "up_to": null, - "unit_price_in_decimal": "string", - "flat_price_in_decimal": "string" - } - ], - "period_units": "string", - "plan_id": "string", - "id": "string", - "status": "string", - "pricing_model": "string", - "tax_behavior": "string", - "currency": "string", - "metadata": null, - "created_at": "2019-08-24T14:15:22Z", - "unit": "string", - "usage_aggregator": "string", - "period": 0 - } - ], - "provider": "string", - "description": "string", - "id": "string", - "status": "string", - "product_id": "string", - "metadata": null, - "created_at": "2019-08-24T14:15:22Z", - "unit": "string", - "updated_at": "2019-08-24T14:15:22Z" - } -] -``` +|id|path|string|true|none| +|provider|query|string|true|none| -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|Inline| - -

Response Schema

- -Status Code **200** - -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|*anonymous*|[[MoesifPlan](#schemamoesifplan)]|false|none|none| -|» name|string|false|none|none| -|» prices|[[MoesifPrice](#schemamoesifprice)]|false|none|none| -|»» name|string|false|none|none| -|»» transform_quantity|object|false|none|none| -|»»» divide_by|integer(int64)|true|none|none| -|»»» round|string|true|none|none| -|»» provider|string|false|none|none| -|»» price_in_decimal|string|false|none|none| -|»» tiers|[[MoesifPriceTier](#schemamoesifpricetier)]|false|none|none| -|»»» up_to|util.either[scala.long,string]|true|none|none| -|»»» unit_price_in_decimal|string|false|none|none| -|»»» flat_price_in_decimal|string|false|none|none| -|»» period_units|string|false|none|none| -|»» plan_id|string|false|none|none| -|»» id|string|false|none|none| -|»» status|string|false|none|none| -|»» pricing_model|string|false|none|none| -|»» tax_behavior|string|false|none|none| -|»» currency|string|false|none|none| -|»» metadata|collection.immutable.map[string,string]|false|none|none| -|»» created_at|string(date-time)|false|none|none| -|»» unit|string|false|none|none| -|»» usage_aggregator|string|false|none|none| -|»» period|integer(int64)|false|none|none| -|» provider|string|false|none|none| -|» description|string|false|none|none| -|» id|string|false|none|none| -|» status|string|false|none|none| -|» product_id|string|false|none|none| -|» metadata|collection.immutable.map[string,string]|false|none|none| -|» created_at|string(date-time)|false|none|none| -|» unit|string|false|none|none| -|» updated_at|string(date-time)|false|none|none| +|204|[No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5)|no content|None| -## getMoesifPlan +## updateMoesifPrice - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string \ +curl -X PUT https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string \ + -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + -d '{ + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 +}' ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = { + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 +}; const headers = { + 'Content-Type':'application/json', 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string', +fetch('https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string', { - method: 'GET', - + method: 'PUT', + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -15127,13 +16879,43 @@ fetch('https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string', ```python import requests headers = { + 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = { + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 +} -r = requests.get('https://api.moesif.com/v1/~/billing/catalog/plans/{id}', params={ +r = requests.put('https://api.moesif.com/v1/~/billing/catalog/prices/{id}', params={ 'provider': 'string' -}, headers = headers) + +}, headers = headers, json = input_data) print(r.json()) @@ -15144,14 +16926,46 @@ require 'rest-client' require 'json' headers = { + 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/~/billing/catalog/plans/{id}', +input_payload = JSON.parse('{ + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 +}') + +result = RestClient.put 'https://api.moesif.com/v1/~/billing/catalog/prices/{id}', params: { 'provider' => 'string' -}, headers: headers + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -15163,19 +16977,46 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('{ + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 +}') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('GET','https://api.moesif.com/v1/~/billing/catalog/plans/{id}', array( + $response = $client->request('PUT','https://api.moesif.com/v1/~/billing/catalog/prices/{id}', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -15200,12 +17041,40 @@ import ( func main() { headers := map[string][]string{ + "Content-Type": []string{"application/json"}, "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/billing/catalog/plans/{id}", data) + jsonPayload := `{ + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 +}` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("PUT", "https://api.moesif.com/v1/~/billing/catalog/prices/{id}", data) req.Header = headers client := &http.Client{} @@ -15239,26 +17108,72 @@ public class HttpExample Client = new HttpClient(); } + + /// Make a dummy request - public async Task MakeGetRequest() + public async Task MakePutRequest() { - string url = "https://api.moesif.com/v1/~/billing/catalog/plans/{id}"; - var result = await GetAsync(url); + int id = 1; + string url = "https://api.moesif.com/v1/~/billing/catalog/prices/{id}"; + + + string json = @"{ + ""name"": ""string"", + ""transform_quantity"": { + ""divide_by"": 0, + ""round"": ""string"" + }, + ""provider"": ""string"", + ""price_in_decimal"": ""string"", + ""tiers"": [ + { + ""up_to"": null, + ""unit_price_in_decimal"": ""string"", + ""flat_price_in_decimal"": ""string"" + } + ], + ""period_units"": ""string"", + ""plan_id"": ""string"", + ""id"": ""string"", + ""status"": ""string"", + ""pricing_model"": ""string"", + ""tax_behavior"": ""string"", + ""currency"": ""string"", + ""metadata"": null, + ""created_at"": ""2024-04-11T04:01:35.090Z"", + ""unit"": ""string"", + ""usage_aggregator"": ""string"", + ""period"": 0 +}"; + var content = JsonConvert.DeserializeObject(json); + var result = await PutAsync(id, content, url); + + } - /// Performs a GET Request - public async Task GetAsync(string url) + /// Performs a PUT Request + public async Task PutAsync(int id, MoesifPrice content, string url) { - //Start the request - HttpResponseMessage response = await Client.GetAsync(url); + //Serialize Object + StringContent jsonContent = SerializeObject(content); - //Validate result - response.EnsureSuccessStatusCode(); + //Execute PUT request + HttpResponseMessage response = await Client.PutAsync(url + $"/{id}", jsonContent); + //Return response + return await DeserializeObject(response); } - + /// Serialize an object to Json + private StringContent SerializeObject(MoesifPrice content) + { + //Serialize Object + string jsonObject = JsonConvert.SerializeObject(content); + + //Create Json UTF8 String Content + return new StringContent(jsonObject, Encoding.UTF8, "application/json"); + } /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) @@ -15274,12 +17189,54 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string"); +URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/prices/{id}?provider=string"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("GET"); +con.setRequestMethod("PUT"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """{ + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 +}"""; + +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -15290,18 +17247,52 @@ System.out.println(response.toString()); ``` -`GET /~/billing/catalog/plans/{id}` +`PUT /~/billing/catalog/prices/{id}` -*Get a Moesif Plan* +*Update a Moesif Price* -Get the Moesif Plan for authenticated users +> `PUT https://api.moesif.com/v1/~/billing/catalog/prices/{id}` -

Parameters

+> Example Request + +```json +{ + "name": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ + { + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" + } + ], + "period_units": "string", + "plan_id": "string", + "id": "string", + "status": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", + "metadata": null, + "created_at": "2024-04-11T04:01:35.090Z", + "unit": "string", + "usage_aggregator": "string", + "period": 0 +} +``` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| |id|path|string|true|none| |provider|query|string|true|none| +|body|body|[MoesifPrice](#schemamoesifprice)|true|none| > Example responses @@ -15310,68 +17301,57 @@ Get the Moesif Plan for authenticated users ```json { "name": "string", - "prices": [ + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "provider": "string", + "price_in_decimal": "string", + "tiers": [ { - "name": "string", - "transform_quantity": { - "divide_by": 0, - "round": "string" - }, - "provider": "string", - "price_in_decimal": "string", - "tiers": [ - { - "up_to": null, - "unit_price_in_decimal": "string", - "flat_price_in_decimal": "string" - } - ], - "period_units": "string", - "plan_id": "string", - "id": "string", - "status": "string", - "pricing_model": "string", - "tax_behavior": "string", - "currency": "string", - "metadata": null, - "created_at": "2019-08-24T14:15:22Z", - "unit": "string", - "usage_aggregator": "string", - "period": 0 + "up_to": null, + "unit_price_in_decimal": "string", + "flat_price_in_decimal": "string" } ], - "provider": "string", - "description": "string", + "period_units": "string", + "plan_id": "string", "id": "string", "status": "string", - "product_id": "string", + "pricing_model": "string", + "tax_behavior": "string", + "currency": "string", "metadata": null, - "created_at": "2019-08-24T14:15:22Z", + "created_at": "2024-04-11T04:01:35.090Z", "unit": "string", - "updated_at": "2019-08-24T14:15:22Z" + "usage_aggregator": "string", + "period": 0 } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[MoesifPlan](#schemamoesifplan)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[MoesifPrice](#schemamoesifprice)| -## deleteMoesifPlan +

Billing Meters

- +## listMeters + + > Code samples ```shell # You can also use wget -curl -X DELETE https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string \ +curl -X GET https://api.moesif.com/v1/~/billing/meters \ + -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -15380,12 +17360,13 @@ curl -X DELETE https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=s const fetch = require('node-fetch'); const headers = { + 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string', +fetch('https://api.moesif.com/v1/~/billing/meters', { - method: 'DELETE', + method: 'GET', headers: headers }) @@ -15400,12 +17381,11 @@ fetch('https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string', ```python import requests headers = { + 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.delete('https://api.moesif.com/v1/~/billing/catalog/plans/{id}', params={ - 'provider': 'string' -}, headers = headers) +r = requests.get('https://api.moesif.com/v1/~/billing/meters', headers = headers) print(r.json()) @@ -15416,13 +17396,14 @@ require 'rest-client' require 'json' headers = { + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.delete 'https://api.moesif.com/v1/~/billing/catalog/plans/{id}', +result = RestClient.get 'https://api.moesif.com/v1/~/billing/meters', params: { - 'provider' => 'string' -}, headers: headers + }, + headers: headers p JSON.parse(result) @@ -15434,18 +17415,15 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('DELETE','https://api.moesif.com/v1/~/billing/catalog/plans/{id}', array( + $response = $client->request('GET','https://api.moesif.com/v1/~/billing/meters', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -15470,11 +17448,12 @@ import ( func main() { headers := map[string][]string{ + "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/billing/catalog/plans/{id}", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/billing/meters") req.Header = headers client := &http.Client{} @@ -15508,28 +17487,27 @@ public class HttpExample Client = new HttpClient(); } - - - /// Make a dummy request - public async Task MakeDeleteRequest() + public async Task MakeGetRequest() { - int id = 1; - string url = "https://api.moesif.com/v1/~/billing/catalog/plans/{id}"; - - await DeleteAsync(id, url); + string url = "https://api.moesif.com/v1/~/billing/meters"; + var result = await GetAsync(url); } - /// Performs a DELETE Request - public async Task DeleteAsync(int id, string url) + /// Performs a GET Request + public async Task GetAsync(string url) { - //Execute DELETE request - HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); + //Start the request + HttpResponseMessage response = await Client.GetAsync(url); + + //Validate result + response.EnsureSuccessStatusCode(); - //Return response - await DeserializeObject(response); } + + + /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) { @@ -15544,12 +17522,15 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string"); +URL obj = new URL("https://api.moesif.com/v1/~/billing/meters"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("DELETE"); +con.setRequestMethod("GET"); + +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -15560,37 +17541,247 @@ System.out.println(response.toString()); ``` -`DELETE /~/billing/catalog/plans/{id}` +`GET /~/billing/meters` -*Delete a Moesif Plan* +*List Billing Meters* -

Parameters

+List Billing Meters + +> `GET https://api.moesif.com/v1/~/billing/meters` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|id|path|string|true|none| -|provider|query|string|true|none| -

Responses

+> Example responses + +> 200 Response + +```json +[ + { + "name": "string", + "billing_plan": { + "provider_slug": "string", + "friendly_name": "string", + "params": { + "usage_rounding_mode": "string", + "webhook_params": { + "reporting": {}, + "channel_ids": [ + null + ], + "custom_plan": {} + }, + "recurly_params": { + "plan": {}, + "add_on": {}, + "add_ons": [ + null + ] + }, + "chargebee_params": { + "item_plan": {}, + "item_price": {}, + "item_prices": [ + null + ], + "reporting": {} + }, + "stripe_params": { + "product": {}, + "price": {}, + "prices": [ + null + ], + "reporting": {} + }, + "zuora_params": { + "plan_id": "string", + "price_id": "string", + "price_ids": [ + null + ] + }, + "usage_multiplier": null + } + }, + "url_query": "string", + "_id": "string", + "slug": "string", + "status": "string", + "modified_at": "2024-04-11T04:01:35.090Z", + "es_query": "string", + "created_at": "2024-04-11T04:01:35.090Z", + "app_id": "string", + "org_id": "string" + } +] +``` + +

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|204|[No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5)|no content|None| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|Inline| + +

Response Schema

+ +Status Code **200** + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|*anonymous*|[[BillingMeterDocument](#schemabillingmeterdocument)]|false|none|none| +|» name|string|true|none|none| +|» billing_plan|object|true|none|none| +|»» provider_slug|string|true|none|none| +|»» friendly_name|string|false|none|none| +|»» params|object|false|none|none| +|»»» usage_rounding_mode|string|false|none|none| +|»»» webhook_params|object|false|none|none| +|»»»» reporting|object|false|none|none| +|»»»»» report_when|[string]|true|none|none| +|»»»» channel_ids|[string]|true|none|none| +|»»»» custom_plan|object|true|none|none| +|»»»»» plan_id|string|true|none|none| +|»»» recurly_params|object|false|none|none| +|»»»» plan|object|false|none|none| +|»»»»» name|string|false|none|none| +|»»»»» id|string|false|none|none| +|»»»»» code|string|true|none|none| +|»»»» add_on|object|false|none|none| +|»»»»» name|string|false|none|none| +|»»»»» currencies|[[RecurlyCurrencyAmount](#schemarecurlycurrencyamount)]|false|none|none| +|»»»»»» currency|string|true|none|none| +|»»»»»» unit_amount|double|false|none|none| +|»»»»»» unit_amount_decimal|string|false|none|none| +|»»»»» usage_percentage|double|false|none|none| +|»»»»» add_on_type|string|false|none|none| +|»»»»» external_sku|string|false|none|none| +|»»»»» state|string|false|none|none| +|»»»»» tiers|[[RecurlyAddOnTier](#schemarecurlyaddontier)]|false|none|none| +|»»»»»» ending_quantity|integer(int64)|false|none|none| +|»»»»»» currencies|[[RecurlyCurrencyAmount](#schemarecurlycurrencyamount)]|true|none|none| +|»»»»» tier_type|string|false|none|none| +|»»»»» code|string|true|none|none| +|»»»»» plan_id|string|false|none|none| +|»»»»» id|string|false|none|none| +|»»»»» percentage_tiers|[[RecurlyAddOnPercentageTiers](#schemarecurlyaddonpercentagetiers)]|false|none|none| +|»»»»»» tiers|[[RecurlyAddOnPercentageTier](#schemarecurlyaddonpercentagetier)]|false|none|none| +|»»»»»»» ending_amount|double|false|none|none| +|»»»»»»» usage_percent|string|false|none|none| +|»»»»»» currency|string|false|none|none| +|»»»»» usage_type|string|false|none|none| +|»»»»» created_at|string|false|none|none| +|»»»»» usage_calculation_type|string|false|none|none| +|»»»»» updated_at|string|false|none|none| +|»»»»» deleted_at|string|false|none|none| +|»»»» add_ons|[[RecurlyPlanAddOn](#schemarecurlyplanaddon)]|false|none|none| +|»»» chargebee_params|object|false|none|none| +|»»»» item_plan|object|false|none|none| +|»»»»» name|string|false|none|none| +|»»»»» item_family_id|string|false|none|none| +|»»»»» description|string|false|none|none| +|»»»»» usage_calculation|string|false|none|none| +|»»»»» external_name|string|false|none|none| +|»»»»» metered|boolean|false|none|none| +|»»»»» id|string|true|none|none| +|»»»»» status|string|false|none|none| +|»»»»» unit|string|false|none|none| +|»»»»» updated_at|integer(int64)|false|none|none| +|»»»»» archived_at|integer(int64)|false|none|none| +|»»»» item_price|object|false|none|none| +|»»»»» name|string|false|none|none| +|»»»»» item_id|string|false|none|none| +|»»»»» description|string|false|none|none| +|»»»»» price|integer(int64)|false|none|none| +|»»»»» price_in_decimal|string|false|none|none| +|»»»»» external_name|string|false|none|none| +|»»»»» tiers|[[ChargebeeItemPriceTier](#schemachargebeeitempricetier)]|false|none|none| +|»»»»»» starting_unit|integer(int32)|true|none|none| +|»»»»»» ending_unit|integer(int32)|false|none|none| +|»»»»»» price|integer(int32)|true|none|none| +|»»»»» trial_end_action|string|false|none|none| +|»»»»» trial_period|integer(int64)|false|none|none| +|»»»»» id|string|true|none|none| +|»»»»» status|string|false|none|none| +|»»»»» pricing_model|string|false|none|none| +|»»»»» created_at|integer(int64)|false|none|none| +|»»»»» period_unit|string|false|none|none| +|»»»»» updated_at|integer(int64)|false|none|none| +|»»»»» trial_period_unit|string|false|none|none| +|»»»»» item_type|string|false|none|none| +|»»»»» currency_code|string|false|none|none| +|»»»»» archived_at|integer(int64)|false|none|none| +|»»»»» free_quantity|integer(int64)|false|none|none| +|»»»»» period|integer(int64)|false|none|none| +|»»»» item_prices|[[ChargebeeItemPrice](#schemachargebeeitemprice)]|false|none|none| +|»»»» reporting|object|false|none|none| +|»»»»» reporting_period|string|false|none|none| +|»»» stripe_params|object|false|none|none| +|»»»» product|object|false|none|none| +|»»»»» name|string|true|none|none| +|»»»»» description|string|false|none|none| +|»»»»» unit_label|string|false|none|none| +|»»»»» id|string|true|none|none| +|»»»»» usage_type|string|false|none|none| +|»»»» price|object|false|none|none| +|»»»»» tiers_mode|string|false|none|none| +|»»»»» transform_quantity|object|false|none|none| +|»»»»»» divide_by|integer(int64)|false|none|none| +|»»»»»» round|string|false|none|none| +|»»»»» price_id|string|true|none|none| +|»»»»» tiers|[[StripeTier](#schemastripetier)]|false|none|none| +|»»»»»» flat_amount_decimal|string|false|none|none| +|»»»»»» up_to|integer(int64)|false|none|none| +|»»»»»» unit_amount_decimal|string|false|none|none| +|»»»»»» flat_amount|integer(int64)|false|none|none| +|»»»»»» unit_amount|integer(int64)|false|none|none| +|»»»»» recurring|object|false|none|none| +|»»»»»» trial_period_days|integer(int64)|false|none|none| +|»»»»»» interval|string|false|none|none| +|»»»»»» usage_type|string|false|none|none| +|»»»»»» interval_count|integer(int64)|false|none|none| +|»»»»»» aggregate_usage|string|false|none|none| +|»»»»» unit_amount_decimal|string|false|none|none| +|»»»»» price_nickname|string|false|none|none| +|»»»»» currency|string|false|none|none| +|»»»»» billing_scheme|string|false|none|none| +|»»»»» unit_amount|integer(int64)|false|none|none| +|»»»»» created|integer(int64)|false|none|none| +|»»»»» active|boolean|false|none|none| +|»»»» prices|[[StripePrice](#schemastripeprice)]|false|none|none| +|»»»» reporting|object|false|none|none| +|»»» zuora_params|object|false|none|none| +|»»»» plan_id|string|false|none|none| +|»»»» price_id|string|false|none|none| +|»»»» price_ids|[string]|false|none|none| +|»»» usage_multiplier|double|false|none|none| +|» url_query|string|true|none|none| +|» _id|string|false|none|none| +|» slug|string|true|none|none| +|» status|string|true|none|none| +|» modified_at|string(date-time)|true|none|none| +|» es_query|string|true|none|none| +|» created_at|string(date-time)|true|none|none| +|» app_id|string|true|none|none| +|» org_id|string|true|none|none| -## updateMoesifPlan +## getMeter - + > Code samples ```shell # You can also use wget -curl -X PUT https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string \ +curl -X GET https://api.moesif.com/v1/~/billing/meters/{meterId} \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' @@ -15604,9 +17795,9 @@ const headers = { 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string', +fetch('https://api.moesif.com/v1/~/billing/meters/{meterId}', { - method: 'PUT', + method: 'GET', headers: headers }) @@ -15625,9 +17816,7 @@ headers = { 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.put('https://api.moesif.com/v1/~/billing/catalog/plans/{id}', params={ - 'provider': 'string' -}, headers = headers) +r = requests.get('https://api.moesif.com/v1/~/billing/meters/{meterId}', headers = headers) print(r.json()) @@ -15642,10 +17831,10 @@ headers = { 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.put 'https://api.moesif.com/v1/~/billing/catalog/plans/{id}', +result = RestClient.get 'https://api.moesif.com/v1/~/billing/meters/{meterId}', params: { - 'provider' => 'string' -}, headers: headers + }, + headers: headers p JSON.parse(result) @@ -15663,13 +17852,9 @@ $headers = array( $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('PUT','https://api.moesif.com/v1/~/billing/catalog/plans/{id}', array( + $response = $client->request('GET','https://api.moesif.com/v1/~/billing/meters/{meterId}', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -15697,9 +17882,9 @@ func main() { "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("PUT", "https://api.moesif.com/v1/~/billing/catalog/plans/{id}", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/billing/meters/{meterId}") req.Header = headers client := &http.Client{} @@ -15733,43 +17918,26 @@ public class HttpExample Client = new HttpClient(); } - - /// Make a dummy request - public async Task MakePutRequest() + public async Task MakeGetRequest() { - int id = 1; - string url = "https://api.moesif.com/v1/~/billing/catalog/plans/{id}"; - - - - var result = await PutAsync(id, null, url); - + string url = "https://api.moesif.com/v1/~/billing/meters/{meterId}"; + var result = await GetAsync(url); } - /// Performs a PUT Request - public async Task PutAsync(int id, undefined content, string url) + /// Performs a GET Request + public async Task GetAsync(string url) { - //Serialize Object - StringContent jsonContent = SerializeObject(content); + //Start the request + HttpResponseMessage response = await Client.GetAsync(url); - //Execute PUT request - HttpResponseMessage response = await Client.PutAsync(url + $"/{id}", jsonContent); + //Validate result + response.EnsureSuccessStatusCode(); - //Return response - return await DeserializeObject(response); } - /// Serialize an object to Json - private StringContent SerializeObject(undefined content) - { - //Serialize Object - string jsonObject = JsonConvert.SerializeObject(content); - - //Create Json UTF8 String Content - return new StringContent(jsonObject, Encoding.UTF8, "application/json"); - } + /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) @@ -15785,12 +17953,15 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/plans/{id}?provider=string"); +URL obj = new URL("https://api.moesif.com/v1/~/billing/meters/{meterId}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("PUT"); +con.setRequestMethod("GET"); + +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -15801,17 +17972,19 @@ System.out.println(response.toString()); ``` -`PUT /~/billing/catalog/plans/{id}` +`GET /~/billing/meters/{meterId}` -*Update a Moesif Plan* +*Get Billing Meter by id* -

Parameters

+Get Billing Meter by id + +> `GET https://api.moesif.com/v1/~/billing/meters/{meterId}` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|id|path|string|true|none| -|provider|query|string|true|none| -|body|body|[MoesifPlan](#schemamoesifplan)|false|none| +|meterId|path|string|true|none| > Example responses @@ -15820,69 +17993,166 @@ System.out.println(response.toString()); ```json { "name": "string", - "prices": [ - { - "name": "string", - "transform_quantity": { - "divide_by": 0, - "round": "string" + "billing_plan": { + "provider_slug": "string", + "friendly_name": "string", + "params": { + "usage_rounding_mode": "string", + "webhook_params": { + "reporting": { + "report_when": null + }, + "channel_ids": [ + "string" + ], + "custom_plan": { + "plan_id": null + } }, - "provider": "string", - "price_in_decimal": "string", - "tiers": [ - { - "up_to": null, - "unit_price_in_decimal": "string", - "flat_price_in_decimal": "string" + "recurly_params": { + "plan": { + "name": null, + "id": null, + "code": null + }, + "add_on": { + "name": null, + "currencies": null, + "usage_percentage": null, + "add_on_type": null, + "external_sku": null, + "state": null, + "tiers": null, + "tier_type": null, + "code": null, + "plan_id": null, + "id": null, + "percentage_tiers": null, + "usage_type": null, + "created_at": null, + "usage_calculation_type": null, + "updated_at": null, + "deleted_at": null + }, + "add_ons": [ + {} + ] + }, + "chargebee_params": { + "item_plan": { + "name": null, + "item_family_id": null, + "description": null, + "usage_calculation": null, + "external_name": null, + "metered": null, + "id": null, + "status": null, + "unit": null, + "updated_at": null, + "archived_at": null + }, + "item_price": { + "name": null, + "item_id": null, + "description": null, + "price": null, + "price_in_decimal": null, + "external_name": null, + "tiers": null, + "trial_end_action": null, + "trial_period": null, + "id": null, + "status": null, + "pricing_model": null, + "created_at": null, + "period_unit": null, + "updated_at": null, + "trial_period_unit": null, + "item_type": null, + "currency_code": null, + "archived_at": null, + "free_quantity": null, + "period": null + }, + "item_prices": [ + {} + ], + "reporting": { + "reporting_period": null } - ], - "period_units": "string", - "plan_id": "string", - "id": "string", - "status": "string", - "pricing_model": "string", - "tax_behavior": "string", - "currency": "string", - "metadata": null, - "created_at": "2019-08-24T14:15:22Z", - "unit": "string", - "usage_aggregator": "string", - "period": 0 + }, + "stripe_params": { + "product": { + "name": null, + "description": null, + "unit_label": null, + "id": null, + "usage_type": null + }, + "price": { + "tiers_mode": null, + "transform_quantity": null, + "price_id": null, + "tiers": null, + "recurring": null, + "unit_amount_decimal": null, + "price_nickname": null, + "currency": null, + "billing_scheme": null, + "unit_amount": null, + "created": null, + "active": null + }, + "prices": [ + {} + ], + "reporting": { + "reporting_period": null + } + }, + "zuora_params": { + "plan_id": "string", + "price_id": "string", + "price_ids": [ + "string" + ] + }, + "usage_multiplier": null } - ], - "provider": "string", - "description": "string", - "id": "string", + }, + "url_query": "string", + "_id": "string", + "slug": "string", "status": "string", - "product_id": "string", - "metadata": null, - "created_at": "2019-08-24T14:15:22Z", - "unit": "string", - "updated_at": "2019-08-24T14:15:22Z" + "modified_at": "2024-04-11T04:01:35.090Z", + "es_query": "string", + "created_at": "2024-04-11T04:01:35.090Z", + "app_id": "string", + "org_id": "string" } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[MoesifPlan](#schemamoesifplan)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[BillingMeterDocument](#schemabillingmeterdocument)| -## createMoesifPrice +## deleteMeter - + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/~/billing/catalog/prices?provider=string \ - -H 'Accept: application/json' \ +curl -X DELETE https://api.moesif.com/v1/~/billing/meters/{meterId} \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -15891,13 +18161,12 @@ curl -X POST https://api.moesif.com/v1/~/billing/catalog/prices?provider=string const fetch = require('node-fetch'); const headers = { - 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/billing/catalog/prices?provider=string', +fetch('https://api.moesif.com/v1/~/billing/meters/{meterId}', { - method: 'POST', + method: 'DELETE', headers: headers }) @@ -15912,13 +18181,10 @@ fetch('https://api.moesif.com/v1/~/billing/catalog/prices?provider=string', ```python import requests headers = { - 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.post('https://api.moesif.com/v1/~/billing/catalog/prices', params={ - 'provider': 'string' -}, headers = headers) +r = requests.delete('https://api.moesif.com/v1/~/billing/meters/{meterId}', headers = headers) print(r.json()) @@ -15929,14 +18195,13 @@ require 'rest-client' require 'json' headers = { - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/~/billing/catalog/prices', +result = RestClient.delete 'https://api.moesif.com/v1/~/billing/meters/{meterId}', params: { - 'provider' => 'string' -}, headers: headers + }, + headers: headers p JSON.parse(result) @@ -15948,19 +18213,14 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('POST','https://api.moesif.com/v1/~/billing/catalog/prices', array( + $response = $client->request('DELETE','https://api.moesif.com/v1/~/billing/meters/{meterId}', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -15985,12 +18245,11 @@ import ( func main() { headers := map[string][]string{ - "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/billing/catalog/prices", data) + + + req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/billing/meters/{meterId}") req.Header = headers client := &http.Client{} @@ -16025,36 +18284,25 @@ public class HttpExample } + + /// Make a dummy request - public async Task MakePostRequest() - { - string url = "https://api.moesif.com/v1/~/billing/catalog/prices"; - - - await PostAsync(null, url); - - } - - /// Performs a POST Request - public async Task PostAsync(undefined content, string url) + public async Task MakeDeleteRequest() { - //Serialize Object - StringContent jsonContent = SerializeObject(content); + int id = 1; + string url = "https://api.moesif.com/v1/~/billing/meters/{meterId}"; - //Execute POST request - HttpResponseMessage response = await Client.PostAsync(url, jsonContent); + await DeleteAsync(id, url); } - - - - /// Serialize an object to Json - private StringContent SerializeObject(undefined content) + + /// Performs a DELETE Request + public async Task DeleteAsync(int id, string url) { - //Serialize Object - string jsonObject = JsonConvert.SerializeObject(content); + //Execute DELETE request + HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); - //Create Json UTF8 String Content - return new StringContent(jsonObject, Encoding.UTF8, "application/json"); + //Return response + await DeserializeObject(response); } /// Deserialize object from request response @@ -16071,12 +18319,14 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/prices?provider=string"); +URL obj = new URL("https://api.moesif.com/v1/~/billing/meters/{meterId}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("POST"); +con.setRequestMethod("DELETE"); + +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -16087,72 +18337,42 @@ System.out.println(response.toString()); ``` -`POST /~/billing/catalog/prices` - -*Create a new Moesif Price* +`DELETE /~/billing/meters/{meterId}` -

Parameters

+*Delete Billing Meter by id* -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|provider|query|string|true|none| -|body|body|[MoesifPrice](#schemamoesifprice)|false|none| +Delete Billing Meter by id -> Example responses +> `DELETE https://api.moesif.com/v1/~/billing/meters/{meterId}` -> 201 Response +

Parameters

-```json -{ - "name": "string", - "transform_quantity": { - "divide_by": 0, - "round": "string" - }, - "provider": "string", - "price_in_decimal": "string", - "tiers": [ - { - "up_to": null, - "unit_price_in_decimal": "string", - "flat_price_in_decimal": "string" - } - ], - "period_units": "string", - "plan_id": "string", - "id": "string", - "status": "string", - "pricing_model": "string", - "tax_behavior": "string", - "currency": "string", - "metadata": null, - "created_at": "2019-08-24T14:15:22Z", - "unit": "string", - "usage_aggregator": "string", - "period": 0 -} -``` +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|meterId|path|string|true|none| -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|created|[MoesifPrice](#schemamoesifprice)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| -## listMoesifPrices +

Billing Reports

- +## getBillingReports + + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/~/billing/catalog/prices \ +curl -X GET https://api.moesif.com/v1/~/billing/reports \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' @@ -16166,7 +18386,7 @@ const headers = { 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/billing/catalog/prices', +fetch('https://api.moesif.com/v1/~/billing/reports', { method: 'GET', @@ -16187,7 +18407,7 @@ headers = { 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.get('https://api.moesif.com/v1/~/billing/catalog/prices', headers = headers) +r = requests.get('https://api.moesif.com/v1/~/billing/reports', headers = headers) print(r.json()) @@ -16202,9 +18422,10 @@ headers = { 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/~/billing/catalog/prices', +result = RestClient.get 'https://api.moesif.com/v1/~/billing/reports', params: { - }, headers: headers + }, + headers: headers p JSON.parse(result) @@ -16222,13 +18443,9 @@ $headers = array( $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('GET','https://api.moesif.com/v1/~/billing/catalog/prices', array( + $response = $client->request('GET','https://api.moesif.com/v1/~/billing/reports', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -16256,9 +18473,9 @@ func main() { "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/billing/catalog/prices", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/billing/reports") req.Header = headers client := &http.Client{} @@ -16295,7 +18512,7 @@ public class HttpExample /// Make a dummy request public async Task MakeGetRequest() { - string url = "https://api.moesif.com/v1/~/billing/catalog/prices"; + string url = "https://api.moesif.com/v1/~/billing/reports"; var result = await GetAsync(url); } @@ -16327,12 +18544,15 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/billing/catalog/prices"); +URL obj = new URL("https://api.moesif.com/v1/~/billing/reports"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); + +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -16343,15 +18563,28 @@ System.out.println(response.toString()); ``` -`GET /~/billing/catalog/prices` +`GET /~/billing/reports` -*List all Moesif Prices for a specific Plan* +*Get BillingReports* -

Parameters

+Query audit history of billing reports to external billing providers + +> `GET https://api.moesif.com/v1/~/billing/reports` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| +|from|query|string(date-time)|false|none| +|to|query|string(date-time)|false|none| +|billing_meter_id|query|string|false|none| +|company_id|query|string|false|none| |provider|query|string|false|none| +|subscription_id|query|string|false|none| +|success|query|boolean|false|none| +|status_code|query|integer(int32)|false|none| +|error_code|query|string|false|none| +|`type`|query|string|false|none| > Example responses @@ -16360,88 +18593,160 @@ System.out.println(response.toString()); ```json [ { - "name": "string", - "transform_quantity": { - "divide_by": 0, - "round": "string" + "ending_balance": { + "sequence_id": 0, + "current_balance": 0.1, + "pending_activity": 0.1, + "available_balance": 0.1 }, + "company_id": "string", + "success": true, "provider": "string", - "price_in_decimal": "string", - "tiers": [ + "report_version": 0, + "usage_end_time": "2024-04-11T04:01:35.090Z", + "usage": { + "invoice": { + "period_start": "2024-04-11T04:01:35.090Z", + "period_end": "2024-04-11T04:01:35.090Z", + "id": "string" + }, + "aggregator": "string" + }, + "_id": "string", + "meter_usage": 0, + "last_success_time": "2024-04-11T04:01:35.090Z", + "beginning_balance": { + "sequence_id": 0, + "current_balance": 0.1, + "pending_activity": 0.1, + "available_balance": 0.1 + }, + "billing_meter_id": "string", + "amount": 0.1, + "usage_start_time": "2024-04-11T04:01:35.090Z", + "status": "string", + "provider_requests": [ { - "up_to": null, - "unit_price_in_decimal": "string", - "flat_price_in_decimal": "string" + "success": true, + "status_code": 0, + "job_id": "string", + "error_message": "string", + "error_code": "string", + "request_time": "2024-04-11T04:01:35.090Z" } ], - "period_units": "string", - "plan_id": "string", - "id": "string", - "status": "string", - "pricing_model": "string", - "tax_behavior": "string", "currency": "string", - "metadata": null, - "created_at": "2019-08-24T14:15:22Z", - "unit": "string", - "usage_aggregator": "string", - "period": 0 + "report_total_usage": 0, + "channel_requests": [ + { + "channel_id": "string", + "channel_name": "string", + "provider_requests": [ + { + "success": true, + "status_code": 0, + "job_id": "string", + "error_message": "string", + "error_code": "string", + "request_time": "2024-04-11T04:01:35.090Z" + } + ] + } + ], + "created_at": "2024-04-11T04:01:35.090Z", + "app_id": "string", + "subscription_id": "string", + "subscription_period_start": "2024-04-11T04:01:35.090Z", + "balance_changes": [ + { + "amount": 0.1 + } + ], + "type": "string", + "updated_at": "2024-04-11T04:01:35.090Z", + "org_id": "string", + "subscription_period_end": "2024-04-11T04:01:35.090Z", + "meter_metric": 0 } ] ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|Inline| -

Response Schema

+

Response Schema

Status Code **200** |Name|Type|Required|Restrictions|Description| |---|---|---|---|---| -|*anonymous*|[[MoesifPrice](#schemamoesifprice)]|false|none|none| -|» name|string|false|none|none| -|» transform_quantity|object|false|none|none| -|»» divide_by|integer(int64)|true|none|none| -|»» round|string|true|none|none| -|» provider|string|false|none|none| -|» price_in_decimal|string|false|none|none| -|» tiers|[[MoesifPriceTier](#schemamoesifpricetier)]|false|none|none| -|»» up_to|util.either[scala.long,string]|true|none|none| -|»» unit_price_in_decimal|string|false|none|none| -|»» flat_price_in_decimal|string|false|none|none| -|» period_units|string|false|none|none| -|» plan_id|string|false|none|none| -|» id|string|false|none|none| +|*anonymous*|[[BillingReport](#schemabillingreport)]|false|none|none| +|» ending_balance|object|false|none|none| +|»» sequence_id|integer(int32)|true|none|none| +|»» current_balance|number(double)|true|none|none| +|»» pending_activity|number(double)|true|none|none| +|»» available_balance|number(double)|true|none|none| +|» company_id|string|true|none|none| +|» success|boolean|true|none|none| +|» provider|string|true|none|none| +|» report_version|integer(int32)|false|none|none| +|» usage_end_time|string(date-time)|true|none|none| +|» usage|object|false|none|none| +|»» invoice|object|false|none|none| +|»»» period_start|string(date-time)|false|none|none| +|»»» period_end|string(date-time)|false|none|none| +|»»» id|string|true|none|none| +|»» aggregator|string|false|none|none| +|» _id|string|false|none|none| +|» meter_usage|integer(int64)|true|none|none| +|» last_success_time|string(date-time)|false|none|none| +|» beginning_balance|object|false|none|none| +|» billing_meter_id|string|true|none|none| +|» amount|number(double)|false|none|none| +|» usage_start_time|string(date-time)|true|none|none| |» status|string|false|none|none| -|» pricing_model|string|false|none|none| -|» tax_behavior|string|false|none|none| +|» provider_requests|[[ProviderRequest](#schemaproviderrequest)]|true|none|none| +|»» success|boolean|true|none|none| +|»» status_code|integer(int32)|true|none|none| +|»» job_id|string|true|none|none| +|»» error_message|string|true|none|none| +|»» error_code|string|true|none|none| +|»» request_time|string(date-time)|true|none|none| |» currency|string|false|none|none| -|» metadata|collection.immutable.map[string,string]|false|none|none| +|» report_total_usage|integer(int64)|true|none|none| +|» channel_requests|[[ChannelRequest](#schemachannelrequest)]|false|none|none| +|»» channel_id|string|true|none|none| +|»» channel_name|string|true|none|none| +|»» provider_requests|[[ProviderRequest](#schemaproviderrequest)]|true|none|none| |» created_at|string(date-time)|false|none|none| -|» unit|string|false|none|none| -|» usage_aggregator|string|false|none|none| -|» period|integer(int64)|false|none|none| +|» app_id|string|true|none|none| +|» subscription_id|string|true|none|none| +|» subscription_period_start|string(date-time)|false|none|none| +|» balance_changes|[[BalanceChange](#schemabalancechange)]|false|none|none| +|»» amount|number(double)|true|none|none| +|» type|string|false|none|none| +|» updated_at|string(date-time)|false|none|none| +|» org_id|string|true|none|none| +|» subscription_period_end|string(date-time)|false|none|none| +|» meter_metric|integer(int64)|true|none|none| -

Emails

- -## createEmailTemplate +## getBillingReportsMetrics - + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/~/emails/templates \ +curl -X GET https://api.moesif.com/v1/~/billing/reports/metrics?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' @@ -16455,9 +18760,9 @@ const headers = { 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/emails/templates', +fetch('https://api.moesif.com/v1/~/billing/reports/metrics?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z', { - method: 'POST', + method: 'GET', headers: headers }) @@ -16476,7 +18781,10 @@ headers = { 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.post('https://api.moesif.com/v1/~/emails/templates', headers = headers) +r = requests.get('https://api.moesif.com/v1/~/billing/reports/metrics', params={ + 'from': '2024-04-11T04:01:35.090Z', 'to': '2024-04-11T04:01:35.090Z' + +}, headers = headers) print(r.json()) @@ -16491,9 +18799,12 @@ headers = { 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/~/emails/templates', +result = RestClient.get 'https://api.moesif.com/v1/~/billing/reports/metrics', params: { - }, headers: headers + 'from' => 'string(date-time)', + 'to' => 'string(date-time)' + }, + headers: headers p JSON.parse(result) @@ -16511,13 +18822,9 @@ $headers = array( $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('POST','https://api.moesif.com/v1/~/emails/templates', array( + $response = $client->request('GET','https://api.moesif.com/v1/~/billing/reports/metrics', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -16545,9 +18852,9 @@ func main() { "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/emails/templates", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/billing/reports/metrics") req.Header = headers client := &http.Client{} @@ -16581,38 +18888,26 @@ public class HttpExample Client = new HttpClient(); } - /// Make a dummy request - public async Task MakePostRequest() + public async Task MakeGetRequest() { - string url = "https://api.moesif.com/v1/~/emails/templates"; - - - await PostAsync(null, url); - + string url = "https://api.moesif.com/v1/~/billing/reports/metrics"; + var result = await GetAsync(url); } - /// Performs a POST Request - public async Task PostAsync(undefined content, string url) + /// Performs a GET Request + public async Task GetAsync(string url) { - //Serialize Object - StringContent jsonContent = SerializeObject(content); + //Start the request + HttpResponseMessage response = await Client.GetAsync(url); + + //Validate result + response.EnsureSuccessStatusCode(); - //Execute POST request - HttpResponseMessage response = await Client.PostAsync(url, jsonContent); } - /// Serialize an object to Json - private StringContent SerializeObject(undefined content) - { - //Serialize Object - string jsonObject = JsonConvert.SerializeObject(content); - - //Create Json UTF8 String Content - return new StringContent(jsonObject, Encoding.UTF8, "application/json"); - } /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) @@ -16628,12 +18923,15 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/emails/templates"); +URL obj = new URL("https://api.moesif.com/v1/~/billing/reports/metrics?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("POST"); +con.setRequestMethod("GET"); + +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -16644,55 +18942,107 @@ System.out.println(response.toString()); ``` -`POST /~/emails/templates` +`GET /~/billing/reports/metrics` -*Create New Email Template* +*Get BillingReports' values for a given meter and time range for a single company or all companies* -

Parameters

+Get BillingReports' values for a given meter and time range for a single company or all companies + +> `GET https://api.moesif.com/v1/~/billing/reports/metrics` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|body|body|[EmailTemplateCreateItem](#schemaemailtemplatecreateitem)|false|none| +|from|query|string(date-time)|true|none| +|to|query|string(date-time)|true|none| +|billing_meter_id|query|string|false|none| +|success|query|boolean|false|none| +|aggregator|query|string|false|none| +|interval|query|string|false|none| +|company_id|query|string|false|none| +|subscription_id|query|string|false|none| +|`type`|query|array[string]|false|none| > Example responses -

Responses

+> 200 Response + +```json +{ + "buckets": [ + { + "start": "2024-04-11T04:01:35.090Z", + "metric": 0.1, + "amounts": null, + "ending_balance": { + "current_balance": 0.1, + "pending_activity": 0.1, + "available_balance": 0.1 + } + } + ] +} +``` + +

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|None| - -

Response Schema

+|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|three buckets of aggregates for the given meter and time range including Metric Value, Reported Usage, and list of errors.|[BillingMetricResponse](#schemabillingmetricresponse)| -## getEmailTemplates +

Balance Transactions

- +## createBalanceTransaction + + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/~/emails/templates \ +curl -X POST https://api.moesif.com/v1/~/billing/reports/balance_transactions \ + -H 'Content-Type: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + -d '{ + "company_id": "string", + "description": "string", + "expire_at": "2024-04-11T04:01:35.090Z", + "active_at": "2024-04-11T04:01:35.090Z", + "amount": 0.1, + "transaction_id": "string", + "subscription_id": "string", + "type": "string" +}' ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = { + "company_id": "string", + "description": "string", + "expire_at": "2024-04-11T04:01:35.090Z", + "active_at": "2024-04-11T04:01:35.090Z", + "amount": 0.1, + "transaction_id": "string", + "subscription_id": "string", + "type": "string" +}; const headers = { + 'Content-Type':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/emails/templates', +fetch('https://api.moesif.com/v1/~/billing/reports/balance_transactions', { - method: 'GET', - + method: 'POST', + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -16706,10 +19056,21 @@ fetch('https://api.moesif.com/v1/~/emails/templates', ```python import requests headers = { + 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = { + "company_id": "string", + "description": "string", + "expire_at": "2024-04-11T04:01:35.090Z", + "active_at": "2024-04-11T04:01:35.090Z", + "amount": 0.1, + "transaction_id": "string", + "subscription_id": "string", + "type": "string" +} -r = requests.get('https://api.moesif.com/v1/~/emails/templates', headers = headers) +r = requests.post('https://api.moesif.com/v1/~/billing/reports/balance_transactions', headers = headers, json = input_data) print(r.json()) @@ -16720,12 +19081,26 @@ require 'rest-client' require 'json' headers = { + 'Content-Type' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/~/emails/templates', +input_payload = JSON.parse('{ + "company_id": "string", + "description": "string", + "expire_at": "2024-04-11T04:01:35.090Z", + "active_at": "2024-04-11T04:01:35.090Z", + "amount": 0.1, + "transaction_id": "string", + "subscription_id": "string", + "type": "string" +}') + +result = RestClient.post 'https://api.moesif.com/v1/~/billing/reports/balance_transactions', params: { - }, headers: headers + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -16737,18 +19112,27 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Content-Type' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('{ + "company_id": "string", + "description": "string", + "expire_at": "2024-04-11T04:01:35.090Z", + "active_at": "2024-04-11T04:01:35.090Z", + "amount": 0.1, + "transaction_id": "string", + "subscription_id": "string", + "type": "string" +}') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('GET','https://api.moesif.com/v1/~/emails/templates', array( + $response = $client->request('POST','https://api.moesif.com/v1/~/billing/reports/balance_transactions', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -16773,11 +19157,21 @@ import ( func main() { headers := map[string][]string{ + "Content-Type": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/emails/templates", data) + jsonPayload := `{ + "company_id": "string", + "description": "string", + "expire_at": "2024-04-11T04:01:35.090Z", + "active_at": "2024-04-11T04:01:35.090Z", + "amount": 0.1, + "transaction_id": "string", + "subscription_id": "string", + "type": "string" +}` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/billing/reports/balance_transactions", data) req.Header = headers client := &http.Client{} @@ -16811,26 +19205,49 @@ public class HttpExample Client = new HttpClient(); } + /// Make a dummy request - public async Task MakeGetRequest() + public async Task MakePostRequest() { - string url = "https://api.moesif.com/v1/~/emails/templates"; - var result = await GetAsync(url); + string url = "https://api.moesif.com/v1/~/billing/reports/balance_transactions"; + + string json = @"{ + ""company_id"": ""string"", + ""description"": ""string"", + ""expire_at"": ""2024-04-11T04:01:35.090Z"", + ""active_at"": ""2024-04-11T04:01:35.090Z"", + ""amount"": 0.1, + ""transaction_id"": ""string"", + ""subscription_id"": ""string"", + ""type"": ""string"" +}"; + var content = JsonConvert.DeserializeObject(json); + await PostAsync(content, url); + + } - /// Performs a GET Request - public async Task GetAsync(string url) + /// Performs a POST Request + public async Task PostAsync(BillingReportBalanceTransCreate content, string url) { - //Start the request - HttpResponseMessage response = await Client.GetAsync(url); - - //Validate result - response.EnsureSuccessStatusCode(); + //Serialize Object + StringContent jsonContent = SerializeObject(content); + //Execute POST request + HttpResponseMessage response = await Client.PostAsync(url, jsonContent); } + /// Serialize an object to Json + private StringContent SerializeObject(BillingReportBalanceTransCreate content) + { + //Serialize Object + string jsonObject = JsonConvert.SerializeObject(content); + + //Create Json UTF8 String Content + return new StringContent(jsonObject, Encoding.UTF8, "application/json"); + } /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) @@ -16846,12 +19263,35 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/emails/templates"); +URL obj = new URL("https://api.moesif.com/v1/~/billing/reports/balance_transactions"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("GET"); +con.setRequestMethod("POST"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """{ + "company_id": "string", + "description": "string", + "expire_at": "2024-04-11T04:01:35.090Z", + "active_at": "2024-04-11T04:01:35.090Z", + "amount": 0.1, + "transaction_id": "string", + "subscription_id": "string", + "type": "string" +}"""; + +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -16862,51 +19302,117 @@ System.out.println(response.toString()); ``` -`GET /~/emails/templates` +`POST /~/billing/reports/balance_transactions` -*Get Email Templates* +*Post BillingReports Balance Transactions* + +Post a billing report of type balance_transaction + +> `POST https://api.moesif.com/v1/~/billing/reports/balance_transactions` + +> Example Request + +```json +{ + "company_id": "string", + "description": "string", + "expire_at": "2024-04-11T04:01:35.090Z", + "active_at": "2024-04-11T04:01:35.090Z", + "amount": 0.1, + "transaction_id": "string", + "subscription_id": "string", + "type": "string" +} +``` -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|cohort_id|query|string|false|none| +|body|body|[BillingReportBalanceTransCreate](#schemabillingreportbalancetranscreate)|true|none| -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| +|204|[No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5)|success, no content and BillingReports were created or updated|None| -## updateEmailTemplate +

Cohorts

- +## createCohort + + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/~/emails/templates/{id} \ +curl -X POST https://api.moesif.com/v1/~/cohorts \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + -d '{ + "channels": null, + "priority": 0, + "url_query": "string", + "criteria": {}, + "notification_rule": { + "send_on_addition": true, + "send_on_removal": true, + "period": "string", + "fields": [ + "string" + ] + }, + "cohort_name": "string", + "to": "string", + "week_starts_on": 0, + "locked_by": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" +}' ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = { + "channels": null, + "priority": 0, + "url_query": "string", + "criteria": {}, + "notification_rule": { + "send_on_addition": true, + "send_on_removal": true, + "period": "string", + "fields": [ + "string" + ] + }, + "cohort_name": "string", + "to": "string", + "week_starts_on": 0, + "locked_by": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" +}; const headers = { + 'Content-Type':'application/json', + 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/emails/templates/{id}', +fetch('https://api.moesif.com/v1/~/cohorts', { method: 'POST', - + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -16920,10 +19426,33 @@ fetch('https://api.moesif.com/v1/~/emails/templates/{id}', ```python import requests headers = { + 'Content-Type': 'application/json', + 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = { + "channels": null, + "priority": 0, + "url_query": "string", + "criteria": {}, + "notification_rule": { + "send_on_addition": true, + "send_on_removal": true, + "period": "string", + "fields": [ + "string" + ] + }, + "cohort_name": "string", + "to": "string", + "week_starts_on": 0, + "locked_by": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" +} -r = requests.post('https://api.moesif.com/v1/~/emails/templates/{id}', headers = headers) +r = requests.post('https://api.moesif.com/v1/~/cohorts', headers = headers, json = input_data) print(r.json()) @@ -16934,12 +19463,38 @@ require 'rest-client' require 'json' headers = { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/~/emails/templates/{id}', +input_payload = JSON.parse('{ + "channels": null, + "priority": 0, + "url_query": "string", + "criteria": {}, + "notification_rule": { + "send_on_addition": true, + "send_on_removal": true, + "period": "string", + "fields": [ + "string" + ] + }, + "cohort_name": "string", + "to": "string", + "week_starts_on": 0, + "locked_by": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" +}') + +result = RestClient.post 'https://api.moesif.com/v1/~/cohorts', params: { - }, headers: headers + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -16951,18 +19506,39 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Content-Type' => 'application/json', + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('{ + "channels": null, + "priority": 0, + "url_query": "string", + "criteria": {}, + "notification_rule": { + "send_on_addition": true, + "send_on_removal": true, + "period": "string", + "fields": [ + "string" + ] + }, + "cohort_name": "string", + "to": "string", + "week_starts_on": 0, + "locked_by": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" +}') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('POST','https://api.moesif.com/v1/~/emails/templates/{id}', array( + $response = $client->request('POST','https://api.moesif.com/v1/~/cohorts', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -16987,11 +19563,33 @@ import ( func main() { headers := map[string][]string{ + "Content-Type": []string{"application/json"}, + "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/emails/templates/{id}", data) + jsonPayload := `{ + "channels": null, + "priority": 0, + "url_query": "string", + "criteria": {}, + "notification_rule": { + "send_on_addition": true, + "send_on_removal": true, + "period": "string", + "fields": [ + "string" + ] + }, + "cohort_name": "string", + "to": "string", + "week_starts_on": 0, + "locked_by": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" +}` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/cohorts", data) req.Header = headers client := &http.Client{} @@ -17029,15 +19627,37 @@ public class HttpExample /// Make a dummy request public async Task MakePostRequest() { - string url = "https://api.moesif.com/v1/~/emails/templates/{id}"; + string url = "https://api.moesif.com/v1/~/cohorts"; + string json = @"{ + ""channels"": null, + ""priority"": 0, + ""url_query"": ""string"", + ""criteria"": {}, + ""notification_rule"": { + ""send_on_addition"": true, + ""send_on_removal"": true, + ""period"": ""string"", + ""fields"": [ + ""string"" + ] + }, + ""cohort_name"": ""string"", + ""to"": ""string"", + ""week_starts_on"": 0, + ""locked_by"": ""string"", + ""from"": ""string"", + ""cohort_type"": ""string"", + ""time_zone"": ""string"" +}"; + var content = JsonConvert.DeserializeObject(json); + await PostAsync(content, url); - await PostAsync(null, url); } /// Performs a POST Request - public async Task PostAsync(undefined content, string url) + public async Task PostAsync(CohortCreateItem content, string url) { //Serialize Object StringContent jsonContent = SerializeObject(content); @@ -17049,7 +19669,7 @@ public class HttpExample /// Serialize an object to Json - private StringContent SerializeObject(undefined content) + private StringContent SerializeObject(CohortCreateItem content) { //Serialize Object string jsonObject = JsonConvert.SerializeObject(content); @@ -17072,12 +19692,47 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/emails/templates/{id}"); +URL obj = new URL("https://api.moesif.com/v1/~/cohorts"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """{ + "channels": null, + "priority": 0, + "url_query": "string", + "criteria": {}, + "notification_rule": { + "send_on_addition": true, + "send_on_removal": true, + "period": "string", + "fields": [ + "string" + ] + }, + "cohort_name": "string", + "to": "string", + "week_starts_on": 0, + "locked_by": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" +}"""; + +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -17088,37 +19743,98 @@ System.out.println(response.toString()); ``` -`POST /~/emails/templates/{id}` - -*Update an Email Template* - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|id|path|string|true|none| -|body|body|[EmailTemplateUpdateItem](#schemaemailtemplateupdateitem)|false|none| - -

Responses

+`POST /~/cohorts` + +*Create New Cohort* + +> `POST https://api.moesif.com/v1/~/cohorts` + +> Example Request + +```json +{ + "channels": null, + "priority": 0, + "url_query": "string", + "criteria": {}, + "notification_rule": { + "send_on_addition": true, + "send_on_removal": true, + "period": "string", + "fields": [ + "string" + ] + }, + "cohort_name": "string", + "to": "string", + "week_starts_on": 0, + "locked_by": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" +} +``` + +

Parameters

+ +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|body|body|[CohortCreateItem](#schemacohortcreateitem)|true|none| + +> Example responses + +> 201 Response + +```json +{ + "channels": null, + "priority": 0, + "url_query": "string", + "criteria": "string", + "_id": "string", + "sample_rate": 0, + "notification_rule": { + "send_on_addition": true, + "send_on_removal": true, + "period": "string", + "fields": [ + "string" + ] + }, + "cohort_name": "string", + "to": "string", + "week_starts_on": 0, + "locked_by": "string", + "modified_at": "2024-04-11T04:01:35.090Z", + "from": "string", + "created_at": "2024-04-11T04:01:35.090Z", + "app_id": "string", + "cohort_type": "string", + "time_zone": "string", + "org_id": "string" +} +``` + +

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| +|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|[CohortDocument](#schemacohortdocument)| -## getEmailTemplate +## getCohorts - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/~/emails/templates/{id} \ +curl -X GET https://api.moesif.com/v1/~/cohorts?cohort_type=string \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -17130,7 +19846,7 @@ const headers = { 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/emails/templates/{id}', +fetch('https://api.moesif.com/v1/~/cohorts?cohort_type=string', { method: 'GET', @@ -17150,7 +19866,10 @@ headers = { 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.get('https://api.moesif.com/v1/~/emails/templates/{id}', headers = headers) +r = requests.get('https://api.moesif.com/v1/~/cohorts', params={ + 'cohort_type': 'string' + +}, headers = headers) print(r.json()) @@ -17164,9 +19883,11 @@ headers = { 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/~/emails/templates/{id}', +result = RestClient.get 'https://api.moesif.com/v1/~/cohorts', params: { - }, headers: headers + 'cohort_type' => 'string' + }, + headers: headers p JSON.parse(result) @@ -17183,13 +19904,9 @@ $headers = array( $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('GET','https://api.moesif.com/v1/~/emails/templates/{id}', array( + $response = $client->request('GET','https://api.moesif.com/v1/~/cohorts', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -17216,9 +19933,9 @@ func main() { headers := map[string][]string{ "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/emails/templates/{id}", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/cohorts") req.Header = headers client := &http.Client{} @@ -17255,7 +19972,7 @@ public class HttpExample /// Make a dummy request public async Task MakeGetRequest() { - string url = "https://api.moesif.com/v1/~/emails/templates/{id}"; + string url = "https://api.moesif.com/v1/~/cohorts"; var result = await GetAsync(url); } @@ -17287,12 +20004,14 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/~/emails/templates/{id}"); +URL obj = new URL("https://api.moesif.com/v1/~/cohorts?cohort_type=string"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); + +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -17303,17 +20022,19 @@ System.out.println(response.toString()); ``` -`GET /~/emails/templates/{id}` +`GET /~/cohorts` -*Get Email Template* +*Get Cohorts* -

Parameters

+> `GET https://api.moesif.com/v1/~/cohorts` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|id|path|string|true|none| +|cohort_type|query|string|true|none| -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| @@ -17321,33 +20042,78 @@ System.out.println(response.toString()); -## deleteEmailTemplate +## updateCohort - + > Code samples ```shell # You can also use wget -curl -X DELETE https://api.moesif.com/v1/~/emails/templates/{id} \ +curl -X POST https://api.moesif.com/v1/~/cohorts/{cohortId} \ + -H 'Content-Type: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + -d '{ + "channels": null, + "priority": 0, + "url_query": "string", + "criteria": {}, + "sample_rate": 0, + "notification_rule": { + "send_on_addition": true, + "send_on_removal": true, + "period": "string", + "fields": [ + "string" + ] + }, + "cohort_name": "string", + "to": "string", + "week_starts_on": 0, + "locked_by": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" +}' ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = { + "channels": null, + "priority": 0, + "url_query": "string", + "criteria": {}, + "sample_rate": 0, + "notification_rule": { + "send_on_addition": true, + "send_on_removal": true, + "period": "string", + "fields": [ + "string" + ] + }, + "cohort_name": "string", + "to": "string", + "week_starts_on": 0, + "locked_by": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" +}; const headers = { + 'Content-Type':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/~/emails/templates/{id}', +fetch('https://api.moesif.com/v1/~/cohorts/{cohortId}', { - method: 'DELETE', - + method: 'POST', + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -17361,10 +20127,33 @@ fetch('https://api.moesif.com/v1/~/emails/templates/{id}', ```python import requests headers = { + 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = { + "channels": null, + "priority": 0, + "url_query": "string", + "criteria": {}, + "sample_rate": 0, + "notification_rule": { + "send_on_addition": true, + "send_on_removal": true, + "period": "string", + "fields": [ + "string" + ] + }, + "cohort_name": "string", + "to": "string", + "week_starts_on": 0, + "locked_by": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" +} -r = requests.delete('https://api.moesif.com/v1/~/emails/templates/{id}', headers = headers) +r = requests.post('https://api.moesif.com/v1/~/cohorts/{cohortId}', headers = headers, json = input_data) print(r.json()) @@ -17375,12 +20164,38 @@ require 'rest-client' require 'json' headers = { + 'Content-Type' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.delete 'https://api.moesif.com/v1/~/emails/templates/{id}', +input_payload = JSON.parse('{ + "channels": null, + "priority": 0, + "url_query": "string", + "criteria": {}, + "sample_rate": 0, + "notification_rule": { + "send_on_addition": true, + "send_on_removal": true, + "period": "string", + "fields": [ + "string" + ] + }, + "cohort_name": "string", + "to": "string", + "week_starts_on": 0, + "locked_by": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" +}') + +result = RestClient.post 'https://api.moesif.com/v1/~/cohorts/{cohortId}', params: { - }, headers: headers + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -17392,18 +20207,39 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Content-Type' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('{ + "channels": null, + "priority": 0, + "url_query": "string", + "criteria": {}, + "sample_rate": 0, + "notification_rule": { + "send_on_addition": true, + "send_on_removal": true, + "period": "string", + "fields": [ + "string" + ] + }, + "cohort_name": "string", + "to": "string", + "week_starts_on": 0, + "locked_by": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" +}') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('DELETE','https://api.moesif.com/v1/~/emails/templates/{id}', array( + $response = $client->request('POST','https://api.moesif.com/v1/~/cohorts/{cohortId}', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -17428,11 +20264,33 @@ import ( func main() { headers := map[string][]string{ + "Content-Type": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/emails/templates/{id}", data) + jsonPayload := `{ + "channels": null, + "priority": 0, + "url_query": "string", + "criteria": {}, + "sample_rate": 0, + "notification_rule": { + "send_on_addition": true, + "send_on_removal": true, + "period": "string", + "fields": [ + "string" + ] + }, + "cohort_name": "string", + "to": "string", + "week_starts_on": 0, + "locked_by": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" +}` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/cohorts/{cohortId}", data) req.Header = headers client := &http.Client{} @@ -17467,25 +20325,59 @@ public class HttpExample } - - /// Make a dummy request - public async Task MakeDeleteRequest() + public async Task MakePostRequest() { - int id = 1; - string url = "https://api.moesif.com/v1/~/emails/templates/{id}"; - - await DeleteAsync(id, url); + string url = "https://api.moesif.com/v1/~/cohorts/{cohortId}"; + + string json = @"{ + ""channels"": null, + ""priority"": 0, + ""url_query"": ""string"", + ""criteria"": {}, + ""sample_rate"": 0, + ""notification_rule"": { + ""send_on_addition"": true, + ""send_on_removal"": true, + ""period"": ""string"", + ""fields"": [ + ""string"" + ] + }, + ""cohort_name"": ""string"", + ""to"": ""string"", + ""week_starts_on"": 0, + ""locked_by"": ""string"", + ""from"": ""string"", + ""cohort_type"": ""string"", + ""time_zone"": ""string"" +}"; + var content = JsonConvert.DeserializeObject(json); + await PostAsync(content, url); + + } - /// Performs a DELETE Request - public async Task DeleteAsync(int id, string url) + /// Performs a POST Request + public async Task PostAsync(CohortUpdateItem content, string url) { - //Execute DELETE request - HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); + //Serialize Object + StringContent jsonContent = SerializeObject(content); - //Return response - await DeserializeObject(response); + //Execute POST request + HttpResponseMessage response = await Client.PostAsync(url, jsonContent); + } + + + + /// Serialize an object to Json + private StringContent SerializeObject(CohortUpdateItem content) + { + //Serialize Object + string jsonObject = JsonConvert.SerializeObject(content); + + //Create Json UTF8 String Content + return new StringContent(jsonObject, Encoding.UTF8, "application/json"); } /// Deserialize object from request response @@ -17494,20 +20386,55 @@ public class HttpExample //Read body string responseBody = await response.Content.ReadAsStringAsync(); - //Deserialize Body to object - var result = JsonConvert.DeserializeObject(responseBody); - } + //Deserialize Body to object + var result = JsonConvert.DeserializeObject(responseBody); + } +} + +``` + +```java +URL obj = new URL("https://api.moesif.com/v1/~/cohorts/{cohortId}"); +HttpURLConnection con = (HttpURLConnection) obj.openConnection(); +con.setRequestMethod("POST"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """{ + "channels": null, + "priority": 0, + "url_query": "string", + "criteria": {}, + "sample_rate": 0, + "notification_rule": { + "send_on_addition": true, + "send_on_removal": true, + "period": "string", + "fields": [ + "string" + ] + }, + "cohort_name": "string", + "to": "string", + "week_starts_on": 0, + "locked_by": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" +}"""; + +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); } -``` - -```java -URL obj = new URL("https://api.moesif.com/v1/~/emails/templates/{id}"); -HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("DELETE"); int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -17518,17 +20445,47 @@ System.out.println(response.toString()); ``` -`DELETE /~/emails/templates/{id}` +`POST /~/cohorts/{cohortId}` -*Delete Email Template* +*Update a Cohort* -

Parameters

+> `POST https://api.moesif.com/v1/~/cohorts/{cohortId}` + +> Example Request + +```json +{ + "channels": null, + "priority": 0, + "url_query": "string", + "criteria": {}, + "sample_rate": 0, + "notification_rule": { + "send_on_addition": true, + "send_on_removal": true, + "period": "string", + "fields": [ + "string" + ] + }, + "cohort_name": "string", + "to": "string", + "week_starts_on": 0, + "locked_by": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" +} +``` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|id|path|string|true|none| +|cohortId|path|string|true|none| +|body|body|[CohortUpdateItem](#schemacohortupdateitem)|true|none| -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| @@ -17536,25 +20493,18 @@ System.out.println(response.toString()); -

Companies

- -## searchCompanyMetrics - - +## getCohort - + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/search/~/search/companymetrics/companies \ - -H 'Accept: 0' \ +curl -X GET https://api.moesif.com/v1/~/cohorts/{cohortId}?cohort_type=string \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -17563,13 +20513,12 @@ curl -X POST https://api.moesif.com/v1/search/~/search/companymetrics/companies const fetch = require('node-fetch'); const headers = { - 'Accept':'0', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/search/~/search/companymetrics/companies', +fetch('https://api.moesif.com/v1/~/cohorts/{cohortId}?cohort_type=string', { - method: 'POST', + method: 'GET', headers: headers }) @@ -17584,11 +20533,13 @@ fetch('https://api.moesif.com/v1/search/~/search/companymetrics/companies', ```python import requests headers = { - 'Accept': '0', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.post('https://api.moesif.com/v1/search/~/search/companymetrics/companies', headers = headers) +r = requests.get('https://api.moesif.com/v1/~/cohorts/{cohortId}', params={ + 'cohort_type': 'string' + +}, headers = headers) print(r.json()) @@ -17599,13 +20550,14 @@ require 'rest-client' require 'json' headers = { - 'Accept' => '0', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/search/~/search/companymetrics/companies', +result = RestClient.get 'https://api.moesif.com/v1/~/cohorts/{cohortId}', params: { - }, headers: headers + 'cohort_type' => 'string' + }, + headers: headers p JSON.parse(result) @@ -17617,19 +20569,14 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( - 'Accept' => '0', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('POST','https://api.moesif.com/v1/search/~/search/companymetrics/companies', array( + $response = $client->request('GET','https://api.moesif.com/v1/~/cohorts/{cohortId}', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -17654,12 +20601,11 @@ import ( func main() { headers := map[string][]string{ - "Accept": []string{"0"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/search/companymetrics/companies", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/cohorts/{cohortId}") req.Header = headers client := &http.Client{} @@ -17693,38 +20639,26 @@ public class HttpExample Client = new HttpClient(); } - /// Make a dummy request - public async Task MakePostRequest() + public async Task MakeGetRequest() { - string url = "https://api.moesif.com/v1/search/~/search/companymetrics/companies"; - - - await PostAsync(null, url); - + string url = "https://api.moesif.com/v1/~/cohorts/{cohortId}"; + var result = await GetAsync(url); } - /// Performs a POST Request - public async Task PostAsync(undefined content, string url) + /// Performs a GET Request + public async Task GetAsync(string url) { - //Serialize Object - StringContent jsonContent = SerializeObject(content); + //Start the request + HttpResponseMessage response = await Client.GetAsync(url); + + //Validate result + response.EnsureSuccessStatusCode(); - //Execute POST request - HttpResponseMessage response = await Client.PostAsync(url, jsonContent); } - /// Serialize an object to Json - private StringContent SerializeObject(undefined content) - { - //Serialize Object - string jsonObject = JsonConvert.SerializeObject(content); - - //Create Json UTF8 String Content - return new StringContent(jsonObject, Encoding.UTF8, "application/json"); - } /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) @@ -17740,12 +20674,14 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/search/~/search/companymetrics/companies"); +URL obj = new URL("https://api.moesif.com/v1/~/cohorts/{cohortId}?cohort_type=string"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("POST"); +con.setRequestMethod("GET"); + +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -17756,43 +20692,39 @@ System.out.println(response.toString()); ``` -`POST /search/~/search/companymetrics/companies` +`GET /~/cohorts/{cohortId}` -*Search CompanyMetrics/Companies* +*Get Cohort* -

Parameters

+> `GET https://api.moesif.com/v1/~/cohorts/{cohortId}` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|from|query|string(date-time)|false|The start date, which can be absolute such as 2023-07-01T00:00:00Z or relative such as -24h| -|to|query|string(date-time)|false|The end date, which can be absolute such as 2023-07-02T00:00:00Z or relative such as now| -|body|body|undefined|false|The search definition using the Elasticsearch Query DSL| - -> Example responses +|cohort_type|query|string|true|none| +|cohortId|path|string|true|none| -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| -

Response Schema

- -## getCompany +## deleteCohort - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/search/~/companies/{id} \ - -H 'Accept: application/json' \ +curl -X DELETE https://api.moesif.com/v1/~/cohorts/{cohortId} \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -17801,13 +20733,12 @@ curl -X GET https://api.moesif.com/v1/search/~/companies/{id} \ const fetch = require('node-fetch'); const headers = { - 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/search/~/companies/{id}', +fetch('https://api.moesif.com/v1/~/cohorts/{cohortId}', { - method: 'GET', + method: 'DELETE', headers: headers }) @@ -17822,11 +20753,10 @@ fetch('https://api.moesif.com/v1/search/~/companies/{id}', ```python import requests headers = { - 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.get('https://api.moesif.com/v1/search/~/companies/{id}', headers = headers) +r = requests.delete('https://api.moesif.com/v1/~/cohorts/{cohortId}', headers = headers) print(r.json()) @@ -17837,13 +20767,13 @@ require 'rest-client' require 'json' headers = { - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/search/~/companies/{id}', +result = RestClient.delete 'https://api.moesif.com/v1/~/cohorts/{cohortId}', params: { - }, headers: headers + }, + headers: headers p JSON.parse(result) @@ -17855,19 +20785,14 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('GET','https://api.moesif.com/v1/search/~/companies/{id}', array( + $response = $client->request('DELETE','https://api.moesif.com/v1/~/cohorts/{cohortId}', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -17892,12 +20817,11 @@ import ( func main() { headers := map[string][]string{ - "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/search/~/companies/{id}", data) + + + req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/cohorts/{cohortId}") req.Header = headers client := &http.Client{} @@ -17931,27 +20855,28 @@ public class HttpExample Client = new HttpClient(); } + + + /// Make a dummy request - public async Task MakeGetRequest() + public async Task MakeDeleteRequest() { - string url = "https://api.moesif.com/v1/search/~/companies/{id}"; - var result = await GetAsync(url); + int id = 1; + string url = "https://api.moesif.com/v1/~/cohorts/{cohortId}"; + + await DeleteAsync(id, url); } - /// Performs a GET Request - public async Task GetAsync(string url) + /// Performs a DELETE Request + public async Task DeleteAsync(int id, string url) { - //Start the request - HttpResponseMessage response = await Client.GetAsync(url); - - //Validate result - response.EnsureSuccessStatusCode(); + //Execute DELETE request + HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); + //Return response + await DeserializeObject(response); } - - - /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) { @@ -17966,12 +20891,14 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/search/~/companies/{id}"); +URL obj = new URL("https://api.moesif.com/v1/~/cohorts/{cohortId}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("GET"); +con.setRequestMethod("DELETE"); + +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -17982,40 +20909,38 @@ System.out.println(response.toString()); ``` -`GET /search/~/companies/{id}` +`DELETE /~/cohorts/{cohortId}` -*Get a Company* +*Delete Cohort* -

Parameters

+> `DELETE https://api.moesif.com/v1/~/cohorts/{cohortId}` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|id|path|string|true|none| - -> Example responses +|cohortId|path|string|true|none| -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| -

Response Schema

- -## deleteCompany +## deleteCohortSampleRate - + > Code samples ```shell # You can also use wget -curl -X DELETE https://api.moesif.com/v1/search/~/companies/{id} \ +curl -X DELETE https://api.moesif.com/v1/~/cohorts/{cohortId}/sample_rate \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -18027,7 +20952,7 @@ const headers = { 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/search/~/companies/{id}', +fetch('https://api.moesif.com/v1/~/cohorts/{cohortId}/sample_rate', { method: 'DELETE', @@ -18047,7 +20972,7 @@ headers = { 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.delete('https://api.moesif.com/v1/search/~/companies/{id}', headers = headers) +r = requests.delete('https://api.moesif.com/v1/~/cohorts/{cohortId}/sample_rate', headers = headers) print(r.json()) @@ -18061,9 +20986,10 @@ headers = { 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.delete 'https://api.moesif.com/v1/search/~/companies/{id}', +result = RestClient.delete 'https://api.moesif.com/v1/~/cohorts/{cohortId}/sample_rate', params: { - }, headers: headers + }, + headers: headers p JSON.parse(result) @@ -18080,13 +21006,9 @@ $headers = array( $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('DELETE','https://api.moesif.com/v1/search/~/companies/{id}', array( + $response = $client->request('DELETE','https://api.moesif.com/v1/~/cohorts/{cohortId}/sample_rate', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -18113,9 +21035,9 @@ func main() { headers := map[string][]string{ "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/search/~/companies/{id}", data) + + + req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/cohorts/{cohortId}/sample_rate") req.Header = headers client := &http.Client{} @@ -18156,7 +21078,7 @@ public class HttpExample public async Task MakeDeleteRequest() { int id = 1; - string url = "https://api.moesif.com/v1/search/~/companies/{id}"; + string url = "https://api.moesif.com/v1/~/cohorts/{cohortId}/sample_rate"; await DeleteAsync(id, url); } @@ -18185,12 +21107,14 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/search/~/companies/{id}"); +URL obj = new URL("https://api.moesif.com/v1/~/cohorts/{cohortId}/sample_rate"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("DELETE"); + +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -18201,18 +21125,19 @@ System.out.println(response.toString()); ``` -`DELETE /search/~/companies/{id}` +`DELETE /~/cohorts/{cohortId}/sample_rate` -*Delete a Company* +*Delete Sample Rate for a Cohort* -

Parameters

+> `DELETE https://api.moesif.com/v1/~/cohorts/{cohortId}/sample_rate` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|id|path|string|true|none| -|delete_events|query|boolean|false|Delete events associated with the company which can be set to true or false(default)| +|cohortId|path|string|true|none| -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| @@ -18220,19 +21145,20 @@ System.out.println(response.toString()); -## updateCompanies +

Dashboards

- +## deleteDashboards + + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/search/~/companies \ - -H 'Accept: application/json' \ +curl -X DELETE https://api.moesif.com/v1/~/dashboard/{dashId} \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -18241,13 +21167,12 @@ curl -X POST https://api.moesif.com/v1/search/~/companies \ const fetch = require('node-fetch'); const headers = { - 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/search/~/companies', +fetch('https://api.moesif.com/v1/~/dashboard/{dashId}', { - method: 'POST', + method: 'DELETE', headers: headers }) @@ -18262,11 +21187,10 @@ fetch('https://api.moesif.com/v1/search/~/companies', ```python import requests headers = { - 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.post('https://api.moesif.com/v1/search/~/companies', headers = headers) +r = requests.delete('https://api.moesif.com/v1/~/dashboard/{dashId}', headers = headers) print(r.json()) @@ -18277,13 +21201,13 @@ require 'rest-client' require 'json' headers = { - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/search/~/companies', +result = RestClient.delete 'https://api.moesif.com/v1/~/dashboard/{dashId}', params: { - }, headers: headers + }, + headers: headers p JSON.parse(result) @@ -18295,19 +21219,14 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('POST','https://api.moesif.com/v1/search/~/companies', array( + $response = $client->request('DELETE','https://api.moesif.com/v1/~/dashboard/{dashId}', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -18332,12 +21251,11 @@ import ( func main() { headers := map[string][]string{ - "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/companies", data) + + + req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/dashboard/{dashId}") req.Header = headers client := &http.Client{} @@ -18372,36 +21290,25 @@ public class HttpExample } + + /// Make a dummy request - public async Task MakePostRequest() - { - string url = "https://api.moesif.com/v1/search/~/companies"; - - - await PostAsync(null, url); - - } - - /// Performs a POST Request - public async Task PostAsync(undefined content, string url) + public async Task MakeDeleteRequest() { - //Serialize Object - StringContent jsonContent = SerializeObject(content); + int id = 1; + string url = "https://api.moesif.com/v1/~/dashboard/{dashId}"; - //Execute POST request - HttpResponseMessage response = await Client.PostAsync(url, jsonContent); + await DeleteAsync(id, url); } - - - - /// Serialize an object to Json - private StringContent SerializeObject(undefined content) + + /// Performs a DELETE Request + public async Task DeleteAsync(int id, string url) { - //Serialize Object - string jsonObject = JsonConvert.SerializeObject(content); + //Execute DELETE request + HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); - //Create Json UTF8 String Content - return new StringContent(jsonObject, Encoding.UTF8, "application/json"); + //Return response + await DeserializeObject(response); } /// Deserialize object from request response @@ -18418,12 +21325,14 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/search/~/companies"); +URL obj = new URL("https://api.moesif.com/v1/~/dashboard/{dashId}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("POST"); +con.setRequestMethod("DELETE"); + +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -18434,41 +21343,39 @@ System.out.println(response.toString()); ``` -`POST /search/~/companies` +`DELETE /~/dashboard/{dashId}` -*Update a Company* +*Delete a Dashboard* -

Parameters

+> `DELETE https://api.moesif.com/v1/~/dashboard/{dashId}` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|body|body|[CompanyUpdateDTO](#schemacompanyupdatedto)|false|none| - -> Example responses +|dashId|path|string|true|none| +|parent_id|query|string|false|none| -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| -

Response Schema

- -## batchUpdateCompanies +## copyDashboard - + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/search/~/companies/batch \ - -H 'Accept: application/json' \ +curl -X POST https://api.moesif.com/v1/~/dashboard/{id}/copy \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -18477,11 +21384,10 @@ curl -X POST https://api.moesif.com/v1/search/~/companies/batch \ const fetch = require('node-fetch'); const headers = { - 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/search/~/companies/batch', +fetch('https://api.moesif.com/v1/~/dashboard/{id}/copy', { method: 'POST', @@ -18498,11 +21404,10 @@ fetch('https://api.moesif.com/v1/search/~/companies/batch', ```python import requests headers = { - 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.post('https://api.moesif.com/v1/search/~/companies/batch', headers = headers) +r = requests.post('https://api.moesif.com/v1/~/dashboard/{id}/copy', headers = headers) print(r.json()) @@ -18513,13 +21418,13 @@ require 'rest-client' require 'json' headers = { - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/search/~/companies/batch', +result = RestClient.post 'https://api.moesif.com/v1/~/dashboard/{id}/copy', params: { - }, headers: headers + }, + headers: headers p JSON.parse(result) @@ -18531,19 +21436,14 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('POST','https://api.moesif.com/v1/search/~/companies/batch', array( + $response = $client->request('POST','https://api.moesif.com/v1/~/dashboard/{id}/copy', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -18568,12 +21468,11 @@ import ( func main() { headers := map[string][]string{ - "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/companies/batch", data) + + + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/dashboard/{id}/copy") req.Header = headers client := &http.Client{} @@ -18611,7 +21510,7 @@ public class HttpExample /// Make a dummy request public async Task MakePostRequest() { - string url = "https://api.moesif.com/v1/search/~/companies/batch"; + string url = "https://api.moesif.com/v1/~/dashboard/{id}/copy"; await PostAsync(null, url); @@ -18654,12 +21553,14 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/search/~/companies/batch"); +URL obj = new URL("https://api.moesif.com/v1/~/dashboard/{id}/copy"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); + +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -18670,40 +21571,38 @@ System.out.println(response.toString()); ``` -`POST /search/~/companies/batch` +`POST /~/dashboard/{id}/copy` -*Update Companies in Batch* +*Copy Dashboard* -

Parameters

+> `POST https://api.moesif.com/v1/~/dashboard/{id}/copy` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|body|body|array[object]|false|none| - -> Example responses +|id|path|string|true|none| -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| - -

Response Schema

+|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|None| -## countCompanies +## createDashboard - + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/search/~/count/companies?app_id=string \ +curl -X POST https://api.moesif.com/v1/~/dashboards \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' @@ -18717,7 +21616,7 @@ const headers = { 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/search/~/count/companies?app_id=string', +fetch('https://api.moesif.com/v1/~/dashboards', { method: 'POST', @@ -18738,9 +21637,7 @@ headers = { 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.post('https://api.moesif.com/v1/search/~/count/companies', params={ - 'app_id': 'string' -}, headers = headers) +r = requests.post('https://api.moesif.com/v1/~/dashboards', headers = headers) print(r.json()) @@ -18755,10 +21652,10 @@ headers = { 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/search/~/count/companies', +result = RestClient.post 'https://api.moesif.com/v1/~/dashboards', params: { - 'app_id' => 'string' -}, headers: headers + }, + headers: headers p JSON.parse(result) @@ -18776,13 +21673,9 @@ $headers = array( $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('POST','https://api.moesif.com/v1/search/~/count/companies', array( + $response = $client->request('POST','https://api.moesif.com/v1/~/dashboards', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -18810,9 +21703,9 @@ func main() { "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/count/companies", data) + + + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/dashboards") req.Header = headers client := &http.Client{} @@ -18850,7 +21743,7 @@ public class HttpExample /// Make a dummy request public async Task MakePostRequest() { - string url = "https://api.moesif.com/v1/search/~/count/companies"; + string url = "https://api.moesif.com/v1/~/dashboards"; await PostAsync(null, url); @@ -18893,12 +21786,15 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/search/~/count/companies?app_id=string"); +URL obj = new URL("https://api.moesif.com/v1/~/dashboards"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); + +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -18909,43 +21805,77 @@ System.out.println(response.toString()); ``` -`POST /search/~/count/companies` +`POST /~/dashboards` -*Count Companies* +*Create New Dashboard* -

Parameters

+> `POST https://api.moesif.com/v1/~/dashboards` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|body|body|undefined|false|A query to restrict the results specified with the Elasticsearch Query DSL| > Example responses -

Responses

+> 201 Response + +```json +{ + "parent": "string", + "name": "string", + "_id": "string", + "auth_user_id": "string", + "profile_view_promotion": "string", + "app_id": "string", + "workspace_ids": [ + [ + "string" + ] + ], + "sort_order": 0.1, + "dashboard_ids": [ + "string" + ], + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + }, + "org_id": "string", + "migration": {}, + "created": "2024-04-11T04:01:35.090Z" +} +``` + +

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| - -

Response Schema

+|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|[DashboardDocument](#schemadashboarddocument)| -

Mappings

- -## getProperties +## getDashboards - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/search/~/mappings/companymetrics/properties?app_id=string \ - -H 'Accept: application/json' \ +curl -X GET https://api.moesif.com/v1/~/dashboards \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -18954,11 +21884,10 @@ curl -X GET https://api.moesif.com/v1/search/~/mappings/companymetrics/propertie const fetch = require('node-fetch'); const headers = { - 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/search/~/mappings/companymetrics/properties?app_id=string', +fetch('https://api.moesif.com/v1/~/dashboards', { method: 'GET', @@ -18975,13 +21904,10 @@ fetch('https://api.moesif.com/v1/search/~/mappings/companymetrics/properties?app ```python import requests headers = { - 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.get('https://api.moesif.com/v1/search/~/mappings/companymetrics/properties', params={ - 'app_id': 'string' -}, headers = headers) +r = requests.get('https://api.moesif.com/v1/~/dashboards', headers = headers) print(r.json()) @@ -18992,14 +21918,13 @@ require 'rest-client' require 'json' headers = { - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/search/~/mappings/companymetrics/properties', +result = RestClient.get 'https://api.moesif.com/v1/~/dashboards', params: { - 'app_id' => 'string' -}, headers: headers + }, + headers: headers p JSON.parse(result) @@ -19011,19 +21936,14 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('GET','https://api.moesif.com/v1/search/~/mappings/companymetrics/properties', array( + $response = $client->request('GET','https://api.moesif.com/v1/~/dashboards', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -19048,12 +21968,11 @@ import ( func main() { headers := map[string][]string{ - "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/search/~/mappings/companymetrics/properties", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/dashboards") req.Header = headers client := &http.Client{} @@ -19090,7 +22009,7 @@ public class HttpExample /// Make a dummy request public async Task MakeGetRequest() { - string url = "https://api.moesif.com/v1/search/~/mappings/companymetrics/properties"; + string url = "https://api.moesif.com/v1/~/dashboards"; var result = await GetAsync(url); } @@ -19122,12 +22041,14 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/search/~/mappings/companymetrics/properties?app_id=string"); +URL obj = new URL("https://api.moesif.com/v1/~/dashboards"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); + +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -19138,41 +22059,37 @@ System.out.println(response.toString()); ``` -`GET /search/~/mappings/companymetrics/properties` +`GET /~/dashboards` + +*Get a Dashboard* -*Get Property Mapping for CompanyMetrics* +> `GET https://api.moesif.com/v1/~/dashboards` -

Parameters

+

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|from|query|string(date-time)|false|none| - -> Example responses -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| -

Response Schema

- -## getRequestBodyProperties +## copyAllDashboards - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/search/~/mappings/events/request/body/properties?app_id=string&from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z \ - -H 'Accept: application/json' \ +curl -X POST https://api.moesif.com/v1/~/dashboards/copy?app_id=string&to_app_id=string \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -19181,13 +22098,12 @@ curl -X GET https://api.moesif.com/v1/search/~/mappings/events/request/body/prop const fetch = require('node-fetch'); const headers = { - 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/search/~/mappings/events/request/body/properties?app_id=string&from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z', +fetch('https://api.moesif.com/v1/~/dashboards/copy?app_id=string&to_app_id=string', { - method: 'GET', + method: 'POST', headers: headers }) @@ -19202,12 +22118,12 @@ fetch('https://api.moesif.com/v1/search/~/mappings/events/request/body/propertie ```python import requests headers = { - 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.get('https://api.moesif.com/v1/search/~/mappings/events/request/body/properties', params={ - 'app_id': 'string', 'from': '2019-08-24T14:15:22Z', 'to': '2019-08-24T14:15:22Z' +r = requests.post('https://api.moesif.com/v1/~/dashboards/copy', params={ + 'app_id': 'string', 'to_app_id': 'string' + }, headers = headers) print(r.json()) @@ -19219,16 +22135,15 @@ require 'rest-client' require 'json' headers = { - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/search/~/mappings/events/request/body/properties', +result = RestClient.post 'https://api.moesif.com/v1/~/dashboards/copy', params: { 'app_id' => 'string', -'from' => 'string(date-time)', -'to' => 'string(date-time)' -}, headers: headers + 'to_app_id' => 'string' + }, + headers: headers p JSON.parse(result) @@ -19240,19 +22155,14 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('GET','https://api.moesif.com/v1/search/~/mappings/events/request/body/properties', array( + $response = $client->request('POST','https://api.moesif.com/v1/~/dashboards/copy', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -19277,12 +22187,11 @@ import ( func main() { headers := map[string][]string{ - "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/search/~/mappings/events/request/body/properties", data) + + + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/dashboards/copy") req.Header = headers client := &http.Client{} @@ -19316,26 +22225,38 @@ public class HttpExample Client = new HttpClient(); } + /// Make a dummy request - public async Task MakeGetRequest() + public async Task MakePostRequest() { - string url = "https://api.moesif.com/v1/search/~/mappings/events/request/body/properties"; - var result = await GetAsync(url); + string url = "https://api.moesif.com/v1/~/dashboards/copy"; + + + await PostAsync(null, url); + } - /// Performs a GET Request - public async Task GetAsync(string url) + /// Performs a POST Request + public async Task PostAsync(undefined content, string url) { - //Start the request - HttpResponseMessage response = await Client.GetAsync(url); - - //Validate result - response.EnsureSuccessStatusCode(); + //Serialize Object + StringContent jsonContent = SerializeObject(content); + //Execute POST request + HttpResponseMessage response = await Client.PostAsync(url, jsonContent); } + /// Serialize an object to Json + private StringContent SerializeObject(undefined content) + { + //Serialize Object + string jsonObject = JsonConvert.SerializeObject(content); + + //Create Json UTF8 String Content + return new StringContent(jsonObject, Encoding.UTF8, "application/json"); + } /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) @@ -19351,12 +22272,14 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/search/~/mappings/events/request/body/properties?app_id=string&from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z"); +URL obj = new URL("https://api.moesif.com/v1/~/dashboards/copy?app_id=string&to_app_id=string"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("GET"); +con.setRequestMethod("POST"); + +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -19367,60 +22290,107 @@ System.out.println(response.toString()); ``` -`GET /search/~/mappings/events/request/body/properties` +`POST /~/dashboards/copy` -*Get Property Mapping for Events Request Body* +*Copy All Dashboards* -

Parameters

+> `POST https://api.moesif.com/v1/~/dashboards/copy` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|from|query|string(date-time)|true|none| -|to|query|string(date-time)|true|none| -|include_values|query|boolean|false|none| -|key_path|query|string|false|none| - -> Example responses -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| - -

Response Schema

+|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|None| -## getResponseBodyProperties +## updateDashboard - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/search/~/mappings/events/response/body/properties?app_id=string&from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z \ - -H 'Accept: application/json' \ +curl -X POST https://api.moesif.com/v1/~/dashboards/{dashId} \ + -H 'Content-Type: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + -d '{ + "parent": "string", + "name": "string", + "dashboard_id": "string", + "workspace_ids": [ + [ + "string" + ] + ], + "sort_order": 0.1, + "dashboard_ids": [ + "string" + ], + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + } +}' ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = { + "parent": "string", + "name": "string", + "dashboard_id": "string", + "workspace_ids": [ + [ + "string" + ] + ], + "sort_order": 0.1, + "dashboard_ids": [ + "string" + ], + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + } +}; const headers = { - 'Accept':'application/json', + 'Content-Type':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/search/~/mappings/events/response/body/properties?app_id=string&from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z', +fetch('https://api.moesif.com/v1/~/dashboards/{dashId}', { - method: 'GET', - + method: 'POST', + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -19434,13 +22404,38 @@ fetch('https://api.moesif.com/v1/search/~/mappings/events/response/body/properti ```python import requests headers = { - 'Accept': 'application/json', + 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = { + "parent": "string", + "name": "string", + "dashboard_id": "string", + "workspace_ids": [ + [ + "string" + ] + ], + "sort_order": 0.1, + "dashboard_ids": [ + "string" + ], + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + } +} -r = requests.get('https://api.moesif.com/v1/search/~/mappings/events/response/body/properties', params={ - 'app_id': 'string', 'from': '2019-08-24T14:15:22Z', 'to': '2019-08-24T14:15:22Z' -}, headers = headers) +r = requests.post('https://api.moesif.com/v1/~/dashboards/{dashId}', headers = headers, json = input_data) print(r.json()) @@ -19451,16 +22446,43 @@ require 'rest-client' require 'json' headers = { - 'Accept' => 'application/json', + 'Content-Type' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/search/~/mappings/events/response/body/properties', +input_payload = JSON.parse('{ + "parent": "string", + "name": "string", + "dashboard_id": "string", + "workspace_ids": [ + [ + "string" + ] + ], + "sort_order": 0.1, + "dashboard_ids": [ + "string" + ], + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + } +}') + +result = RestClient.post 'https://api.moesif.com/v1/~/dashboards/{dashId}', params: { - 'app_id' => 'string', -'from' => 'string(date-time)', -'to' => 'string(date-time)' -}, headers: headers + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -19472,19 +22494,44 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( - 'Accept' => 'application/json', + 'Content-Type' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('{ + "parent": "string", + "name": "string", + "dashboard_id": "string", + "workspace_ids": [ + [ + "string" + ] + ], + "sort_order": 0.1, + "dashboard_ids": [ + "string" + ], + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + } +}') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('GET','https://api.moesif.com/v1/search/~/mappings/events/response/body/properties', array( + $response = $client->request('POST','https://api.moesif.com/v1/~/dashboards/{dashId}', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -19509,12 +22556,38 @@ import ( func main() { headers := map[string][]string{ - "Accept": []string{"application/json"}, + "Content-Type": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/search/~/mappings/events/response/body/properties", data) + jsonPayload := `{ + "parent": "string", + "name": "string", + "dashboard_id": "string", + "workspace_ids": [ + [ + "string" + ] + ], + "sort_order": 0.1, + "dashboard_ids": [ + "string" + ], + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + } +}` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/dashboards/{dashId}", data) req.Header = headers client := &http.Client{} @@ -19548,26 +22621,66 @@ public class HttpExample Client = new HttpClient(); } + /// Make a dummy request - public async Task MakeGetRequest() + public async Task MakePostRequest() { - string url = "https://api.moesif.com/v1/search/~/mappings/events/response/body/properties"; - var result = await GetAsync(url); + string url = "https://api.moesif.com/v1/~/dashboards/{dashId}"; + + string json = @"{ + ""parent"": ""string"", + ""name"": ""string"", + ""dashboard_id"": ""string"", + ""workspace_ids"": [ + [ + ""string"" + ] + ], + ""sort_order"": 0.1, + ""dashboard_ids"": [ + ""string"" + ], + ""policy"": { + ""acl"": [ + { + ""grantee"": ""string"", + ""permission"": ""string"" + } + ], + ""resource"": {}, + ""api_scopes"": [ + ""string"" + ], + ""original_encoded_resource"": ""string"" + } +}"; + var content = JsonConvert.DeserializeObject(json); + await PostAsync(content, url); + + } - /// Performs a GET Request - public async Task GetAsync(string url) + /// Performs a POST Request + public async Task PostAsync(DashboardUpdateItem content, string url) { - //Start the request - HttpResponseMessage response = await Client.GetAsync(url); - - //Validate result - response.EnsureSuccessStatusCode(); + //Serialize Object + StringContent jsonContent = SerializeObject(content); + //Execute POST request + HttpResponseMessage response = await Client.PostAsync(url, jsonContent); } + /// Serialize an object to Json + private StringContent SerializeObject(DashboardUpdateItem content) + { + //Serialize Object + string jsonObject = JsonConvert.SerializeObject(content); + + //Create Json UTF8 String Content + return new StringContent(jsonObject, Encoding.UTF8, "application/json"); + } /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) @@ -19583,12 +22696,52 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/search/~/mappings/events/response/body/properties?app_id=string&from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z"); +URL obj = new URL("https://api.moesif.com/v1/~/dashboards/{dashId}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("GET"); +con.setRequestMethod("POST"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """{ + "parent": "string", + "name": "string", + "dashboard_id": "string", + "workspace_ids": [ + [ + "string" + ] + ], + "sort_order": 0.1, + "dashboard_ids": [ + "string" + ], + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + } +}"""; + +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -19599,46 +22752,71 @@ System.out.println(response.toString()); ``` -`GET /search/~/mappings/events/response/body/properties` +`POST /~/dashboards/{dashId}` -*Get Property Mapping for Events Response Body* +*Update a Dashboard* -

Parameters

+> `POST https://api.moesif.com/v1/~/dashboards/{dashId}` + +> Example Request + +```json +{ + "parent": "string", + "name": "string", + "dashboard_id": "string", + "workspace_ids": [ + [ + "string" + ] + ], + "sort_order": 0.1, + "dashboard_ids": [ + "string" + ], + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + } +} +``` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|from|query|string(date-time)|true|none| -|to|query|string(date-time)|true|none| -|include_values|query|boolean|false|none| -|key_path|query|string|false|none| - -> Example responses +|dashId|path|string|true|none| +|body|body|[DashboardUpdateItem](#schemadashboardupdateitem)|true|none| -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| - -

Response Schema

+|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|None| -

Subscriptions

- -## getSubscription +## deleteDashboard - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/search/~/subscriptions/{id} \ - -H 'Accept: application/json' \ +curl -X DELETE https://api.moesif.com/v1/~/dashboards/{dashId} \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -19647,13 +22825,12 @@ curl -X GET https://api.moesif.com/v1/search/~/subscriptions/{id} \ const fetch = require('node-fetch'); const headers = { - 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/search/~/subscriptions/{id}', +fetch('https://api.moesif.com/v1/~/dashboards/{dashId}', { - method: 'GET', + method: 'DELETE', headers: headers }) @@ -19668,11 +22845,10 @@ fetch('https://api.moesif.com/v1/search/~/subscriptions/{id}', ```python import requests headers = { - 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.get('https://api.moesif.com/v1/search/~/subscriptions/{id}', headers = headers) +r = requests.delete('https://api.moesif.com/v1/~/dashboards/{dashId}', headers = headers) print(r.json()) @@ -19683,13 +22859,13 @@ require 'rest-client' require 'json' headers = { - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/search/~/subscriptions/{id}', +result = RestClient.delete 'https://api.moesif.com/v1/~/dashboards/{dashId}', params: { - }, headers: headers + }, + headers: headers p JSON.parse(result) @@ -19701,19 +22877,14 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('GET','https://api.moesif.com/v1/search/~/subscriptions/{id}', array( + $response = $client->request('DELETE','https://api.moesif.com/v1/~/dashboards/{dashId}', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -19738,12 +22909,11 @@ import ( func main() { headers := map[string][]string{ - "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/search/~/subscriptions/{id}", data) + + + req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/dashboards/{dashId}") req.Header = headers client := &http.Client{} @@ -19777,27 +22947,28 @@ public class HttpExample Client = new HttpClient(); } + + + /// Make a dummy request - public async Task MakeGetRequest() + public async Task MakeDeleteRequest() { - string url = "https://api.moesif.com/v1/search/~/subscriptions/{id}"; - var result = await GetAsync(url); + int id = 1; + string url = "https://api.moesif.com/v1/~/dashboards/{dashId}"; + + await DeleteAsync(id, url); } - /// Performs a GET Request - public async Task GetAsync(string url) + /// Performs a DELETE Request + public async Task DeleteAsync(int id, string url) { - //Start the request - HttpResponseMessage response = await Client.GetAsync(url); - - //Validate result - response.EnsureSuccessStatusCode(); + //Execute DELETE request + HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); + //Return response + await DeserializeObject(response); } - - - /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) { @@ -19812,12 +22983,14 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/search/~/subscriptions/{id}"); +URL obj = new URL("https://api.moesif.com/v1/~/dashboards/{dashId}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("GET"); +con.setRequestMethod("DELETE"); + +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -19825,81 +22998,41 @@ while ((inputLine = in.readLine()) != null) { } in.close(); System.out.println(response.toString()); - -``` - -`GET /search/~/subscriptions/{id}` - -*Get a Subscription* - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|id|path|string|true|none| - -> Example responses - -> 200 Response - -```json -{ - "trial_start": "2019-08-24T14:15:22Z", - "company_id": "string", - "start_date": "2019-08-24T14:15:22Z", - "collection_method": "string", - "provider": "string", - "items": [ - { - "item_price_id": "string", - "price_id": "string", - "is_metered": true, - "plan_id": "string", - "unit_of_measure": "string", - "status": "string", - "subscription_item_id": "string" - } - ], - "current_period_start": "2019-08-24T14:15:22Z", - "company_external_id": "string", - "payment_status": "string", - "modified_time": "2019-08-24T14:15:22Z", - "cancel_time": "2019-08-24T14:15:22Z", - "status": "string", - "trial_end": "2019-08-24T14:15:22Z", - "external_id": "string", - "metadata": {}, - "app_id": "string", - "subscription_id": "string", - "version_id": "string", - "type": "string", - "current_period_end": "2019-08-24T14:15:22Z", - "org_id": "string", - "created": "2019-08-24T14:15:22Z" -} + ``` -

Responses

+`DELETE /~/dashboards/{dashId}` + +*Delete a Dashboard* + +> `DELETE https://api.moesif.com/v1/~/dashboards/{dashId}` + +

Parameters

+ +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|dashId|path|string|true|none| + +

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[SubscriptionDTO](#schemasubscriptiondto)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| -## getCompanySubscriptions +## cascadeDeleteDashboard - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/search/~/companies/{id}/subscriptions \ - -H 'Accept: application/json' \ +curl -X DELETE https://api.moesif.com/v1/~/dashboards/{dashId}/cascade \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -19908,13 +23041,12 @@ curl -X GET https://api.moesif.com/v1/search/~/companies/{id}/subscriptions \ const fetch = require('node-fetch'); const headers = { - 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/search/~/companies/{id}/subscriptions', +fetch('https://api.moesif.com/v1/~/dashboards/{dashId}/cascade', { - method: 'GET', + method: 'DELETE', headers: headers }) @@ -19929,11 +23061,10 @@ fetch('https://api.moesif.com/v1/search/~/companies/{id}/subscriptions', ```python import requests headers = { - 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.get('https://api.moesif.com/v1/search/~/companies/{id}/subscriptions', headers = headers) +r = requests.delete('https://api.moesif.com/v1/~/dashboards/{dashId}/cascade', headers = headers) print(r.json()) @@ -19944,13 +23075,13 @@ require 'rest-client' require 'json' headers = { - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/search/~/companies/{id}/subscriptions', +result = RestClient.delete 'https://api.moesif.com/v1/~/dashboards/{dashId}/cascade', params: { - }, headers: headers + }, + headers: headers p JSON.parse(result) @@ -19962,19 +23093,14 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('GET','https://api.moesif.com/v1/search/~/companies/{id}/subscriptions', array( + $response = $client->request('DELETE','https://api.moesif.com/v1/~/dashboards/{dashId}/cascade', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -19999,12 +23125,11 @@ import ( func main() { headers := map[string][]string{ - "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/search/~/companies/{id}/subscriptions", data) + + + req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/dashboards/{dashId}/cascade") req.Header = headers client := &http.Client{} @@ -20038,27 +23163,28 @@ public class HttpExample Client = new HttpClient(); } + + + /// Make a dummy request - public async Task MakeGetRequest() + public async Task MakeDeleteRequest() { - string url = "https://api.moesif.com/v1/search/~/companies/{id}/subscriptions"; - var result = await GetAsync(url); + int id = 1; + string url = "https://api.moesif.com/v1/~/dashboards/{dashId}/cascade"; + + await DeleteAsync(id, url); } - /// Performs a GET Request - public async Task GetAsync(string url) + /// Performs a DELETE Request + public async Task DeleteAsync(int id, string url) { - //Start the request - HttpResponseMessage response = await Client.GetAsync(url); - - //Validate result - response.EnsureSuccessStatusCode(); + //Execute DELETE request + HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); + //Return response + await DeserializeObject(response); } - - - /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) { @@ -20073,12 +23199,14 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/search/~/companies/{id}/subscriptions"); +URL obj = new URL("https://api.moesif.com/v1/~/dashboards/{dashId}/cascade"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("GET"); +con.setRequestMethod("DELETE"); + +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -20089,41 +23217,38 @@ System.out.println(response.toString()); ``` -`GET /search/~/companies/{id}/subscriptions` +`DELETE /~/dashboards/{dashId}/cascade` -*Get the Subscriptions of a Company* +*Casccade delete a Dashboard* -

Parameters

+> `DELETE https://api.moesif.com/v1/~/dashboards/{dashId}/cascade` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|id|path|string|true|none| - -> Example responses +|dashId|path|string|true|none| -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| -

Response Schema

- -## batchCreateSubscriptions +## addACLPermissions - + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/search/~/subscriptions/batch \ - -H 'Accept: application/json' \ +curl -X POST https://api.moesif.com/v1/~/dashboards/{id}/policy/acl \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -20132,11 +23257,10 @@ curl -X POST https://api.moesif.com/v1/search/~/subscriptions/batch \ const fetch = require('node-fetch'); const headers = { - 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/search/~/subscriptions/batch', +fetch('https://api.moesif.com/v1/~/dashboards/{id}/policy/acl', { method: 'POST', @@ -20153,11 +23277,10 @@ fetch('https://api.moesif.com/v1/search/~/subscriptions/batch', ```python import requests headers = { - 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.post('https://api.moesif.com/v1/search/~/subscriptions/batch', headers = headers) +r = requests.post('https://api.moesif.com/v1/~/dashboards/{id}/policy/acl', headers = headers) print(r.json()) @@ -20168,13 +23291,13 @@ require 'rest-client' require 'json' headers = { - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/search/~/subscriptions/batch', +result = RestClient.post 'https://api.moesif.com/v1/~/dashboards/{id}/policy/acl', params: { - }, headers: headers + }, + headers: headers p JSON.parse(result) @@ -20186,19 +23309,14 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('POST','https://api.moesif.com/v1/search/~/subscriptions/batch', array( + $response = $client->request('POST','https://api.moesif.com/v1/~/dashboards/{id}/policy/acl', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -20223,12 +23341,11 @@ import ( func main() { headers := map[string][]string{ - "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/subscriptions/batch", data) + + + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/dashboards/{id}/policy/acl") req.Header = headers client := &http.Client{} @@ -20266,7 +23383,7 @@ public class HttpExample /// Make a dummy request public async Task MakePostRequest() { - string url = "https://api.moesif.com/v1/search/~/subscriptions/batch"; + string url = "https://api.moesif.com/v1/~/dashboards/{id}/policy/acl"; await PostAsync(null, url); @@ -20309,12 +23426,14 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/search/~/subscriptions/batch"); +URL obj = new URL("https://api.moesif.com/v1/~/dashboards/{id}/policy/acl"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); + +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -20325,78 +23444,40 @@ System.out.println(response.toString()); ``` -`POST /search/~/subscriptions/batch` +`POST /~/dashboards/{id}/policy/acl` -*Create or Update Subscriptions in Batch* +*Add Dashboards ACL permission* -

Parameters

+> `POST https://api.moesif.com/v1/~/dashboards/{id}/policy/acl` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|body|body|array[object]|false|none| - -> Example responses - -> 200 Response - -```json -{ - "trial_start": "2019-08-24T14:15:22Z", - "company_id": "string", - "start_date": "2019-08-24T14:15:22Z", - "collection_method": "string", - "provider": "string", - "items": [ - { - "item_price_id": "string", - "price_id": "string", - "is_metered": true, - "plan_id": "string", - "unit_of_measure": "string", - "status": "string", - "subscription_item_id": "string" - } - ], - "current_period_start": "2019-08-24T14:15:22Z", - "company_external_id": "string", - "payment_status": "string", - "modified_time": "2019-08-24T14:15:22Z", - "cancel_time": "2019-08-24T14:15:22Z", - "status": "string", - "trial_end": "2019-08-24T14:15:22Z", - "external_id": "string", - "metadata": {}, - "app_id": "string", - "subscription_id": "string", - "version_id": "string", - "type": "string", - "current_period_end": "2019-08-24T14:15:22Z", - "org_id": "string", - "created": "2019-08-24T14:15:22Z" -} -``` +|id|path|string|true|none| +|grantee|query|string|false|none| +|permission|query|string|false|none| -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[SubscriptionDTO](#schemasubscriptiondto)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| -## createSubscription +## deleteACLPermissions - + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/search/~/subscriptions \ - -H 'Accept: application/json' \ +curl -X DELETE https://api.moesif.com/v1/~/dashboards/{id}/policy/acl?grantee=string \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -20405,13 +23486,12 @@ curl -X POST https://api.moesif.com/v1/search/~/subscriptions \ const fetch = require('node-fetch'); const headers = { - 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/search/~/subscriptions', +fetch('https://api.moesif.com/v1/~/dashboards/{id}/policy/acl?grantee=string', { - method: 'POST', + method: 'DELETE', headers: headers }) @@ -20426,11 +23506,13 @@ fetch('https://api.moesif.com/v1/search/~/subscriptions', ```python import requests headers = { - 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.post('https://api.moesif.com/v1/search/~/subscriptions', headers = headers) +r = requests.delete('https://api.moesif.com/v1/~/dashboards/{id}/policy/acl', params={ + 'grantee': 'string' + +}, headers = headers) print(r.json()) @@ -20441,13 +23523,14 @@ require 'rest-client' require 'json' headers = { - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/search/~/subscriptions', +result = RestClient.delete 'https://api.moesif.com/v1/~/dashboards/{id}/policy/acl', params: { - }, headers: headers + 'grantee' => 'string' + }, + headers: headers p JSON.parse(result) @@ -20459,19 +23542,14 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('POST','https://api.moesif.com/v1/search/~/subscriptions', array( + $response = $client->request('DELETE','https://api.moesif.com/v1/~/dashboards/{id}/policy/acl', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -20496,12 +23574,11 @@ import ( func main() { headers := map[string][]string{ - "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/subscriptions", data) + + + req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/dashboards/{id}/policy/acl") req.Header = headers client := &http.Client{} @@ -20536,36 +23613,25 @@ public class HttpExample } + + /// Make a dummy request - public async Task MakePostRequest() - { - string url = "https://api.moesif.com/v1/search/~/subscriptions"; - - - await PostAsync(null, url); - - } - - /// Performs a POST Request - public async Task PostAsync(undefined content, string url) + public async Task MakeDeleteRequest() { - //Serialize Object - StringContent jsonContent = SerializeObject(content); + int id = 1; + string url = "https://api.moesif.com/v1/~/dashboards/{id}/policy/acl"; - //Execute POST request - HttpResponseMessage response = await Client.PostAsync(url, jsonContent); + await DeleteAsync(id, url); } - - - - /// Serialize an object to Json - private StringContent SerializeObject(undefined content) + + /// Performs a DELETE Request + public async Task DeleteAsync(int id, string url) { - //Serialize Object - string jsonObject = JsonConvert.SerializeObject(content); + //Execute DELETE request + HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); - //Create Json UTF8 String Content - return new StringContent(jsonObject, Encoding.UTF8, "application/json"); + //Return response + await DeserializeObject(response); } /// Deserialize object from request response @@ -20582,12 +23648,14 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/search/~/subscriptions"); +URL obj = new URL("https://api.moesif.com/v1/~/dashboards/{id}/policy/acl?grantee=string"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("POST"); +con.setRequestMethod("DELETE"); + +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -20598,96 +23666,151 @@ System.out.println(response.toString()); ``` -`POST /search/~/subscriptions` - -*Create or Update a Subscription* - -

Parameters

+`DELETE /~/dashboards/{id}/policy/acl` -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|body|body|[AddSubscriptionDTO](#schemaaddsubscriptiondto)|false|none| +*Delete Dashboards ACL permission* -> Example responses +> `DELETE https://api.moesif.com/v1/~/dashboards/{id}/policy/acl` -> 200 Response +

Parameters

-```json -{ - "trial_start": "2019-08-24T14:15:22Z", - "company_id": "string", - "start_date": "2019-08-24T14:15:22Z", - "collection_method": "string", - "provider": "string", - "items": [ - { - "item_price_id": "string", - "price_id": "string", - "is_metered": true, - "plan_id": "string", - "unit_of_measure": "string", - "status": "string", - "subscription_item_id": "string" - } - ], - "current_period_start": "2019-08-24T14:15:22Z", - "company_external_id": "string", - "payment_status": "string", - "modified_time": "2019-08-24T14:15:22Z", - "cancel_time": "2019-08-24T14:15:22Z", - "status": "string", - "trial_end": "2019-08-24T14:15:22Z", - "external_id": "string", - "metadata": {}, - "app_id": "string", - "subscription_id": "string", - "version_id": "string", - "type": "string", - "current_period_end": "2019-08-24T14:15:22Z", - "org_id": "string", - "created": "2019-08-24T14:15:22Z" -} -``` +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|id|path|string|true|none| +|grantee|query|string|true|none| -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[SubscriptionDTO](#schemasubscriptiondto)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| -

Metrics

+

Email Templates

-## countEvents +## createEmailTemplate - + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/search/~/count/events?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z \ +curl -X POST https://api.moesif.com/v1/~/emails/templates \ + -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + -d '{ + "name": "string", + "state": 0, + "cohorts": [ + { + "id": "string", + "type": "string", + "config": { + "url_query": "string", + "criteria": "string", + "cohort_name": "string", + "to": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" + } + } + ], + "dynamic_fields": [ + { + "token": "string", + "field": "string", + "aggregator": "avg" + } + ], + "content": { + "html": "string", + "chunks": {} + }, + "template": { + "subject": "string", + "editor": "string", + "design": {}, + "thumbnail_url": "string" + }, + "period": "string", + "addresses": { + "from": "string", + "cc": [ + "string" + ], + "bcc": [ + "string" + ] + } +}' ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = { + "name": "string", + "state": 0, + "cohorts": [ + { + "id": "string", + "type": "string", + "config": { + "url_query": "string", + "criteria": "string", + "cohort_name": "string", + "to": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" + } + } + ], + "dynamic_fields": [ + { + "token": "string", + "field": "string", + "aggregator": "avg" + } + ], + "content": { + "html": "string", + "chunks": {} + }, + "template": { + "subject": "string", + "editor": "string", + "design": {}, + "thumbnail_url": "string" + }, + "period": "string", + "addresses": { + "from": "string", + "cc": [ + "string" + ], + "bcc": [ + "string" + ] + } +}; const headers = { + 'Content-Type':'application/json', 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/search/~/count/events?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z', +fetch('https://api.moesif.com/v1/~/emails/templates', { method: 'POST', - + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -20701,13 +23824,58 @@ fetch('https://api.moesif.com/v1/search/~/count/events?from=2019-08-24T14%3A15%3 ```python import requests headers = { + 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = { + "name": "string", + "state": 0, + "cohorts": [ + { + "id": "string", + "type": "string", + "config": { + "url_query": "string", + "criteria": "string", + "cohort_name": "string", + "to": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" + } + } + ], + "dynamic_fields": [ + { + "token": "string", + "field": "string", + "aggregator": "avg" + } + ], + "content": { + "html": "string", + "chunks": {} + }, + "template": { + "subject": "string", + "editor": "string", + "design": {}, + "thumbnail_url": "string" + }, + "period": "string", + "addresses": { + "from": "string", + "cc": [ + "string" + ], + "bcc": [ + "string" + ] + } +} -r = requests.post('https://api.moesif.com/v1/search/~/count/events', params={ - 'from': '2019-08-24T14:15:22Z', 'to': '2019-08-24T14:15:22Z' -}, headers = headers) +r = requests.post('https://api.moesif.com/v1/~/emails/templates', headers = headers, json = input_data) print(r.json()) @@ -20718,15 +23886,63 @@ require 'rest-client' require 'json' headers = { + 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/search/~/count/events', +input_payload = JSON.parse('{ + "name": "string", + "state": 0, + "cohorts": [ + { + "id": "string", + "type": "string", + "config": { + "url_query": "string", + "criteria": "string", + "cohort_name": "string", + "to": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" + } + } + ], + "dynamic_fields": [ + { + "token": "string", + "field": "string", + "aggregator": "avg" + } + ], + "content": { + "html": "string", + "chunks": {} + }, + "template": { + "subject": "string", + "editor": "string", + "design": {}, + "thumbnail_url": "string" + }, + "period": "string", + "addresses": { + "from": "string", + "cc": [ + "string" + ], + "bcc": [ + "string" + ] + } +}') + +result = RestClient.post 'https://api.moesif.com/v1/~/emails/templates', params: { - 'from' => 'string(date-time)', -'to' => 'string(date-time)' -}, headers: headers + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -20738,19 +23954,64 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); +$inputPayload = json_decode('{ + "name": "string", + "state": 0, + "cohorts": [ + { + "id": "string", + "type": "string", + "config": { + "url_query": "string", + "criteria": "string", + "cohort_name": "string", + "to": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" + } + } + ], + "dynamic_fields": [ + { + "token": "string", + "field": "string", + "aggregator": "avg" + } + ], + "content": { + "html": "string", + "chunks": {} + }, + "template": { + "subject": "string", + "editor": "string", + "design": {}, + "thumbnail_url": "string" + }, + "period": "string", + "addresses": { + "from": "string", + "cc": [ + "string" + ], + "bcc": [ + "string" + ] + } +}') + $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('POST','https://api.moesif.com/v1/search/~/count/events', array( + $response = $client->request('POST','https://api.moesif.com/v1/~/emails/templates', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -20775,12 +24036,58 @@ import ( func main() { headers := map[string][]string{ + "Content-Type": []string{"application/json"}, "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/count/events", data) + jsonPayload := `{ + "name": "string", + "state": 0, + "cohorts": [ + { + "id": "string", + "type": "string", + "config": { + "url_query": "string", + "criteria": "string", + "cohort_name": "string", + "to": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" + } + } + ], + "dynamic_fields": [ + { + "token": "string", + "field": "string", + "aggregator": "avg" + } + ], + "content": { + "html": "string", + "chunks": {} + }, + "template": { + "subject": "string", + "editor": "string", + "design": {}, + "thumbnail_url": "string" + }, + "period": "string", + "addresses": { + "from": "string", + "cc": [ + "string" + ], + "bcc": [ + "string" + ] + } +}` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/emails/templates", data) req.Header = headers client := &http.Client{} @@ -20818,15 +24125,62 @@ public class HttpExample /// Make a dummy request public async Task MakePostRequest() { - string url = "https://api.moesif.com/v1/search/~/count/events"; + string url = "https://api.moesif.com/v1/~/emails/templates"; + string json = @"{ + ""name"": ""string"", + ""state"": 0, + ""cohorts"": [ + { + ""id"": ""string"", + ""type"": ""string"", + ""config"": { + ""url_query"": ""string"", + ""criteria"": ""string"", + ""cohort_name"": ""string"", + ""to"": ""string"", + ""from"": ""string"", + ""cohort_type"": ""string"", + ""time_zone"": ""string"" + } + } + ], + ""dynamic_fields"": [ + { + ""token"": ""string"", + ""field"": ""string"", + ""aggregator"": ""avg"" + } + ], + ""content"": { + ""html"": ""string"", + ""chunks"": {} + }, + ""template"": { + ""subject"": ""string"", + ""editor"": ""string"", + ""design"": {}, + ""thumbnail_url"": ""string"" + }, + ""period"": ""string"", + ""addresses"": { + ""from"": ""string"", + ""cc"": [ + ""string"" + ], + ""bcc"": [ + ""string"" + ] + } +}"; + var content = JsonConvert.DeserializeObject(json); + await PostAsync(content, url); - await PostAsync(null, url); } /// Performs a POST Request - public async Task PostAsync(undefined content, string url) + public async Task PostAsync(EmailTemplateCreateItem content, string url) { //Serialize Object StringContent jsonContent = SerializeObject(content); @@ -20838,7 +24192,7 @@ public class HttpExample /// Serialize an object to Json - private StringContent SerializeObject(undefined content) + private StringContent SerializeObject(EmailTemplateCreateItem content) { //Serialize Object string jsonObject = JsonConvert.SerializeObject(content); @@ -20861,12 +24215,72 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/search/~/count/events?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z"); +URL obj = new URL("https://api.moesif.com/v1/~/emails/templates"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """{ + "name": "string", + "state": 0, + "cohorts": [ + { + "id": "string", + "type": "string", + "config": { + "url_query": "string", + "criteria": "string", + "cohort_name": "string", + "to": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" + } + } + ], + "dynamic_fields": [ + { + "token": "string", + "field": "string", + "aggregator": "avg" + } + ], + "content": { + "html": "string", + "chunks": {} + }, + "template": { + "subject": "string", + "editor": "string", + "design": {}, + "thumbnail_url": "string" + }, + "period": "string", + "addresses": { + "from": "string", + "cc": [ + "string" + ], + "bcc": [ + "string" + ] + } +}"""; + +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -20877,48 +24291,93 @@ System.out.println(response.toString()); ``` -`POST /search/~/count/events` +`POST /~/emails/templates` -*Count Events* +*Create New Email Template* -

Parameters

+> `POST https://api.moesif.com/v1/~/emails/templates` + +> Example Request + +```json +{ + "name": "string", + "state": 0, + "cohorts": [ + { + "id": "string", + "type": "string", + "config": { + "url_query": "string", + "criteria": "string", + "cohort_name": "string", + "to": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" + } + } + ], + "dynamic_fields": [ + { + "token": "string", + "field": "string", + "aggregator": "avg" + } + ], + "content": { + "html": "string", + "chunks": {} + }, + "template": { + "subject": "string", + "editor": "string", + "design": {}, + "thumbnail_url": "string" + }, + "period": "string", + "addresses": { + "from": "string", + "cc": [ + "string" + ], + "bcc": [ + "string" + ] + } +} +``` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|from|query|string(date-time)|true|The start date, which can be absolute such as 2019-07-01T00:00:00Z or relative such as -24h| -|to|query|string(date-time)|true|The end date, which can be absolute such as 2019-07-02T00:00:00Z or relative such as now| -|track_total_hits|query|boolean|false|none| -|body|body|undefined|false|The search definition using the Elasticsearch Query DSL| +|body|body|[EmailTemplateCreateItem](#schemaemailtemplatecreateitem)|true|none| > Example responses -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| +|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|None| -

Response Schema

+

Response Schema

-## searchEvents - - +## getEmailTemplates - + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/search/~/search/events?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z \ - -H 'Accept: application/json' \ +curl -X GET https://api.moesif.com/v1/~/emails/templates \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -20927,13 +24386,12 @@ curl -X POST https://api.moesif.com/v1/search/~/search/events?from=2019-08-24T14 const fetch = require('node-fetch'); const headers = { - 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/search/~/search/events?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z', +fetch('https://api.moesif.com/v1/~/emails/templates', { - method: 'POST', + method: 'GET', headers: headers }) @@ -20948,13 +24406,10 @@ fetch('https://api.moesif.com/v1/search/~/search/events?from=2019-08-24T14%3A15% ```python import requests headers = { - 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.post('https://api.moesif.com/v1/search/~/search/events', params={ - 'from': '2019-08-24T14:15:22Z', 'to': '2019-08-24T14:15:22Z' -}, headers = headers) +r = requests.get('https://api.moesif.com/v1/~/emails/templates', headers = headers) print(r.json()) @@ -20965,15 +24420,13 @@ require 'rest-client' require 'json' headers = { - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/search/~/search/events', +result = RestClient.get 'https://api.moesif.com/v1/~/emails/templates', params: { - 'from' => 'string(date-time)', -'to' => 'string(date-time)' -}, headers: headers + }, + headers: headers p JSON.parse(result) @@ -20985,19 +24438,14 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('POST','https://api.moesif.com/v1/search/~/search/events', array( + $response = $client->request('GET','https://api.moesif.com/v1/~/emails/templates', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -21022,12 +24470,11 @@ import ( func main() { headers := map[string][]string{ - "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/search/events", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/emails/templates") req.Header = headers client := &http.Client{} @@ -21061,38 +24508,26 @@ public class HttpExample Client = new HttpClient(); } - /// Make a dummy request - public async Task MakePostRequest() + public async Task MakeGetRequest() { - string url = "https://api.moesif.com/v1/search/~/search/events"; - - - await PostAsync(null, url); - + string url = "https://api.moesif.com/v1/~/emails/templates"; + var result = await GetAsync(url); } - /// Performs a POST Request - public async Task PostAsync(undefined content, string url) + /// Performs a GET Request + public async Task GetAsync(string url) { - //Serialize Object - StringContent jsonContent = SerializeObject(content); + //Start the request + HttpResponseMessage response = await Client.GetAsync(url); + + //Validate result + response.EnsureSuccessStatusCode(); - //Execute POST request - HttpResponseMessage response = await Client.PostAsync(url, jsonContent); } - /// Serialize an object to Json - private StringContent SerializeObject(undefined content) - { - //Serialize Object - string jsonObject = JsonConvert.SerializeObject(content); - - //Create Json UTF8 String Content - return new StringContent(jsonObject, Encoding.UTF8, "application/json"); - } /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) @@ -21108,12 +24543,14 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/search/~/search/events?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z"); +URL obj = new URL("https://api.moesif.com/v1/~/emails/templates"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("POST"); +con.setRequestMethod("GET"); + +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -21124,135 +24561,146 @@ System.out.println(response.toString()); ``` -`POST /search/~/search/events` +`GET /~/emails/templates` -*Search Events* +*Get Email Templates* -

Parameters

+> `GET https://api.moesif.com/v1/~/emails/templates` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|from|query|string(date-time)|true|The start date, which can be absolute such as 2023-07-01T00:00:00Z or relative such as -24h| -|to|query|string(date-time)|true|The end date, which can be absolute such as 2023-07-02T00:00:00Z or relative such as now| -|body|body|undefined|false|The search definition using the Elasticsearch Query DSL| - -> Example responses - -> 201 Response - -```json -{ - "took": 358, - "timed_out": false, - "hits": { - "total": 947, - "hits": [ - { - "_id": "AWF5M-FDTqLFD8l5y2f4", - "_source": { - "company_id": "67890", - "duration_ms": 76, - "request": { - "body": "json", - "uri": "https://api.github.com", - "user_agent": { - "patch": "1", - "major": "7", - "minor": "1", - "name": "PostmanRuntime" - }, - "geo_ip": { - "ip": "73.189.235.253", - "region_name": "CA", - "continent_code": "NA", - "location": [ - -122.393 - ], - "latitude": 37.769, - "timezone": "America/Los_Angeles", - "area_code": 415, - "longitude": -122.393, - "real_region_name": "California", - "dma_code": 807, - "postal_code": "94107", - "city_name": "San Francisco", - "country_code2": "US", - "country_code3": "USA", - "country_name": "United States" - }, - "ip_address": "73.189.235.253", - "verb": "GET", - "route": "/", - "time": "2023-07-09T06:14:58.550", - "headers": {} - }, - "user_id": "123454", - "company": {}, - "response": { - "body": {}, - "transfer_encoding": "json", - "status": 200, - "time": "2023-07-09T06:14:58.626", - "headers": {} - }, - "id": "AWF5M-FDTqLFD8l5y2f4", - "event_type": "api_call", - "session_token": "rdfmnw3fu24309efjc534nb421UZ9-]2JDO[ME", - "metadata": {}, - "app_id": "198:3", - "org_id": "177:3", - "user": {} - }, - "sort": [ - 0 - ] - } - ] - } -} -``` +|cohort_id|query|string|false|none| -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|[searchEventsResponseDTO](#schemasearcheventsresponsedto)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| -## searchPublicWorkspaces - - +## updateEmailTemplate - + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z \ - -H 'Accept: application/json' \ +curl -X POST https://api.moesif.com/v1/~/emails/templates/{id} \ + -H 'Content-Type: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + -d '{ + "name": "string", + "state": 0, + "cohorts": [ + { + "id": "string", + "type": "string", + "config": { + "url_query": "string", + "criteria": "string", + "cohort_name": "string", + "to": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" + } + } + ], + "dynamic_fields": [ + { + "token": "string", + "field": "string", + "aggregator": "avg" + } + ], + "content": { + "html": "string", + "chunks": {} + }, + "template": { + "subject": "string", + "editor": "string", + "design": {}, + "thumbnail_url": "string" + }, + "period": "string", + "addresses": { + "from": "string", + "cc": [ + "string" + ], + "bcc": [ + "string" + ] + } +}' ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = { + "name": "string", + "state": 0, + "cohorts": [ + { + "id": "string", + "type": "string", + "config": { + "url_query": "string", + "criteria": "string", + "cohort_name": "string", + "to": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" + } + } + ], + "dynamic_fields": [ + { + "token": "string", + "field": "string", + "aggregator": "avg" + } + ], + "content": { + "html": "string", + "chunks": {} + }, + "template": { + "subject": "string", + "editor": "string", + "design": {}, + "thumbnail_url": "string" + }, + "period": "string", + "addresses": { + "from": "string", + "cc": [ + "string" + ], + "bcc": [ + "string" + ] + } +}; const headers = { - 'Accept':'application/json', + 'Content-Type':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z', +fetch('https://api.moesif.com/v1/~/emails/templates/{id}', { method: 'POST', - + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -21266,13 +24714,57 @@ fetch('https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search?from=2 ```python import requests headers = { - 'Accept': 'application/json', + 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = { + "name": "string", + "state": 0, + "cohorts": [ + { + "id": "string", + "type": "string", + "config": { + "url_query": "string", + "criteria": "string", + "cohort_name": "string", + "to": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" + } + } + ], + "dynamic_fields": [ + { + "token": "string", + "field": "string", + "aggregator": "avg" + } + ], + "content": { + "html": "string", + "chunks": {} + }, + "template": { + "subject": "string", + "editor": "string", + "design": {}, + "thumbnail_url": "string" + }, + "period": "string", + "addresses": { + "from": "string", + "cc": [ + "string" + ], + "bcc": [ + "string" + ] + } +} -r = requests.post('https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search', params={ - 'from': '2019-08-24T14:15:22Z', 'to': '2019-08-24T14:15:22Z' -}, headers = headers) +r = requests.post('https://api.moesif.com/v1/~/emails/templates/{id}', headers = headers, json = input_data) print(r.json()) @@ -21283,15 +24775,62 @@ require 'rest-client' require 'json' headers = { - 'Accept' => 'application/json', + 'Content-Type' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search', +input_payload = JSON.parse('{ + "name": "string", + "state": 0, + "cohorts": [ + { + "id": "string", + "type": "string", + "config": { + "url_query": "string", + "criteria": "string", + "cohort_name": "string", + "to": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" + } + } + ], + "dynamic_fields": [ + { + "token": "string", + "field": "string", + "aggregator": "avg" + } + ], + "content": { + "html": "string", + "chunks": {} + }, + "template": { + "subject": "string", + "editor": "string", + "design": {}, + "thumbnail_url": "string" + }, + "period": "string", + "addresses": { + "from": "string", + "cc": [ + "string" + ], + "bcc": [ + "string" + ] + } +}') + +result = RestClient.post 'https://api.moesif.com/v1/~/emails/templates/{id}', params: { - 'from' => 'string(date-time)', -'to' => 'string(date-time)' -}, headers: headers + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -21303,19 +24842,63 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( - 'Accept' => 'application/json', + 'Content-Type' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('{ + "name": "string", + "state": 0, + "cohorts": [ + { + "id": "string", + "type": "string", + "config": { + "url_query": "string", + "criteria": "string", + "cohort_name": "string", + "to": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" + } + } + ], + "dynamic_fields": [ + { + "token": "string", + "field": "string", + "aggregator": "avg" + } + ], + "content": { + "html": "string", + "chunks": {} + }, + "template": { + "subject": "string", + "editor": "string", + "design": {}, + "thumbnail_url": "string" + }, + "period": "string", + "addresses": { + "from": "string", + "cc": [ + "string" + ], + "bcc": [ + "string" + ] + } +}') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('POST','https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search', array( + $response = $client->request('POST','https://api.moesif.com/v1/~/emails/templates/{id}', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -21340,12 +24923,57 @@ import ( func main() { headers := map[string][]string{ - "Accept": []string{"application/json"}, + "Content-Type": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search", data) + jsonPayload := `{ + "name": "string", + "state": 0, + "cohorts": [ + { + "id": "string", + "type": "string", + "config": { + "url_query": "string", + "criteria": "string", + "cohort_name": "string", + "to": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" + } + } + ], + "dynamic_fields": [ + { + "token": "string", + "field": "string", + "aggregator": "avg" + } + ], + "content": { + "html": "string", + "chunks": {} + }, + "template": { + "subject": "string", + "editor": "string", + "design": {}, + "thumbnail_url": "string" + }, + "period": "string", + "addresses": { + "from": "string", + "cc": [ + "string" + ], + "bcc": [ + "string" + ] + } +}` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/emails/templates/{id}", data) req.Header = headers client := &http.Client{} @@ -21383,15 +25011,62 @@ public class HttpExample /// Make a dummy request public async Task MakePostRequest() { - string url = "https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search"; + string url = "https://api.moesif.com/v1/~/emails/templates/{id}"; + string json = @"{ + ""name"": ""string"", + ""state"": 0, + ""cohorts"": [ + { + ""id"": ""string"", + ""type"": ""string"", + ""config"": { + ""url_query"": ""string"", + ""criteria"": ""string"", + ""cohort_name"": ""string"", + ""to"": ""string"", + ""from"": ""string"", + ""cohort_type"": ""string"", + ""time_zone"": ""string"" + } + } + ], + ""dynamic_fields"": [ + { + ""token"": ""string"", + ""field"": ""string"", + ""aggregator"": ""avg"" + } + ], + ""content"": { + ""html"": ""string"", + ""chunks"": {} + }, + ""template"": { + ""subject"": ""string"", + ""editor"": ""string"", + ""design"": {}, + ""thumbnail_url"": ""string"" + }, + ""period"": ""string"", + ""addresses"": { + ""from"": ""string"", + ""cc"": [ + ""string"" + ], + ""bcc"": [ + ""string"" + ] + } +}"; + var content = JsonConvert.DeserializeObject(json); + await PostAsync(content, url); - await PostAsync(null, url); } /// Performs a POST Request - public async Task PostAsync(undefined content, string url) + public async Task PostAsync(EmailTemplateUpdateItem content, string url) { //Serialize Object StringContent jsonContent = SerializeObject(content); @@ -21403,7 +25078,7 @@ public class HttpExample /// Serialize an object to Json - private StringContent SerializeObject(undefined content) + private StringContent SerializeObject(EmailTemplateUpdateItem content) { //Serialize Object string jsonObject = JsonConvert.SerializeObject(content); @@ -21426,12 +25101,71 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z"); +URL obj = new URL("https://api.moesif.com/v1/~/emails/templates/{id}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """{ + "name": "string", + "state": 0, + "cohorts": [ + { + "id": "string", + "type": "string", + "config": { + "url_query": "string", + "criteria": "string", + "cohort_name": "string", + "to": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" + } + } + ], + "dynamic_fields": [ + { + "token": "string", + "field": "string", + "aggregator": "avg" + } + ], + "content": { + "html": "string", + "chunks": {} + }, + "template": { + "subject": "string", + "editor": "string", + "design": {}, + "thumbnail_url": "string" + }, + "period": "string", + "addresses": { + "from": "string", + "cc": [ + "string" + ], + "bcc": [ + "string" + ] + } +}"""; + +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -21442,118 +25176,90 @@ System.out.println(response.toString()); ``` -`POST /search/~/workspaces/{workspaceId}/search` - -*Search Events in saved public Workspace* - -

Parameters

+`POST /~/emails/templates/{id}` -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|from|query|string(date-time)|true|The start date, which can be absolute such as 2023-07-01T00:00:00Z or relative such as -24h| -|to|query|string(date-time)|true|The end date, which can be absolute such as 2023-07-02T00:00:00Z or relative such as now| -|workspaceId|path|string|true|none| -|include_details|query|boolean|false|none| -|take|query|integer(int32)|false|none| -|body|body|undefined|false|The search definition using the Elasticsearch Query DSL| +*Update an Email Template* -> Example responses +> `POST https://api.moesif.com/v1/~/emails/templates/{id}` -> 201 Response +> Example Request ```json { - "took": 358, - "timed_out": false, - "hits": { - "total": 947, - "hits": [ - { - "_id": "AWF5M-FDTqLFD8l5y2f4", - "_source": { - "company_id": "67890", - "duration_ms": 76, - "request": { - "body": "json", - "uri": "https://api.github.com", - "user_agent": { - "patch": "1", - "major": "7", - "minor": "1", - "name": "PostmanRuntime" - }, - "geo_ip": { - "ip": "73.189.235.253", - "region_name": "CA", - "continent_code": "NA", - "location": [ - -122.393 - ], - "latitude": 37.769, - "timezone": "America/Los_Angeles", - "area_code": 415, - "longitude": -122.393, - "real_region_name": "California", - "dma_code": 807, - "postal_code": "94107", - "city_name": "San Francisco", - "country_code2": "US", - "country_code3": "USA", - "country_name": "United States" - }, - "ip_address": "73.189.235.253", - "verb": "GET", - "route": "/", - "time": "2023-07-09T06:14:58.550", - "headers": {} - }, - "user_id": "123454", - "company": {}, - "response": { - "body": {}, - "transfer_encoding": "json", - "status": 200, - "time": "2023-07-09T06:14:58.626", - "headers": {} - }, - "id": "AWF5M-FDTqLFD8l5y2f4", - "event_type": "api_call", - "session_token": "rdfmnw3fu24309efjc534nb421UZ9-]2JDO[ME", - "metadata": {}, - "app_id": "198:3", - "org_id": "177:3", - "user": {} - }, - "sort": [ - 0 - ] + "name": "string", + "state": 0, + "cohorts": [ + { + "id": "string", + "type": "string", + "config": { + "url_query": "string", + "criteria": "string", + "cohort_name": "string", + "to": "string", + "from": "string", + "cohort_type": "string", + "time_zone": "string" } + } + ], + "dynamic_fields": [ + { + "token": "string", + "field": "string", + "aggregator": "avg" + } + ], + "content": { + "html": "string", + "chunks": {} + }, + "template": { + "subject": "string", + "editor": "string", + "design": {}, + "thumbnail_url": "string" + }, + "period": "string", + "addresses": { + "from": "string", + "cc": [ + "string" + ], + "bcc": [ + "string" ] } } ``` -

Responses

+

Parameters

+ +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|id|path|string|true|none| +|body|body|[EmailTemplateUpdateItem](#schemaemailtemplateupdateitem)|true|none| + +

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|[searchEventsResponseDTO](#schemasearcheventsresponsedto)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| -## getEvent +## getEmailTemplate - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/search/~/events/{id}?event_time=2019-08-24T14%3A15%3A22Z \ - -H 'Accept: application/json' \ +curl -X GET https://api.moesif.com/v1/~/emails/templates/{id} \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -21562,11 +25268,10 @@ curl -X GET https://api.moesif.com/v1/search/~/events/{id}?event_time=2019-08-24 const fetch = require('node-fetch'); const headers = { - 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/search/~/events/{id}?event_time=2019-08-24T14%3A15%3A22Z', +fetch('https://api.moesif.com/v1/~/emails/templates/{id}', { method: 'GET', @@ -21583,13 +25288,10 @@ fetch('https://api.moesif.com/v1/search/~/events/{id}?event_time=2019-08-24T14%3 ```python import requests headers = { - 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.get('https://api.moesif.com/v1/search/~/events/{id}', params={ - 'event_time': '2019-08-24T14:15:22Z' -}, headers = headers) +r = requests.get('https://api.moesif.com/v1/~/emails/templates/{id}', headers = headers) print(r.json()) @@ -21600,14 +25302,13 @@ require 'rest-client' require 'json' headers = { - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/search/~/events/{id}', +result = RestClient.get 'https://api.moesif.com/v1/~/emails/templates/{id}', params: { - 'event_time' => 'string(date-time)' -}, headers: headers + }, + headers: headers p JSON.parse(result) @@ -21619,19 +25320,14 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('GET','https://api.moesif.com/v1/search/~/events/{id}', array( + $response = $client->request('GET','https://api.moesif.com/v1/~/emails/templates/{id}', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -21656,12 +25352,11 @@ import ( func main() { headers := map[string][]string{ - "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/search/~/events/{id}", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/emails/templates/{id}") req.Header = headers client := &http.Client{} @@ -21698,7 +25393,7 @@ public class HttpExample /// Make a dummy request public async Task MakeGetRequest() { - string url = "https://api.moesif.com/v1/search/~/events/{id}"; + string url = "https://api.moesif.com/v1/~/emails/templates/{id}"; var result = await GetAsync(url); } @@ -21730,12 +25425,14 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/search/~/events/{id}?event_time=2019-08-24T14%3A15%3A22Z"); +URL obj = new URL("https://api.moesif.com/v1/~/emails/templates/{id}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); + +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -21746,107 +25443,38 @@ System.out.println(response.toString()); ``` -`GET /search/~/events/{id}` +`GET /~/emails/templates/{id}` -*Get an Event* +*Get Email Template* -

Parameters

+> `GET https://api.moesif.com/v1/~/emails/templates/{id}` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| |id|path|string|true|none| -|event_time|query|string(date-time)|true|none| - -> Example responses - -> 200 Response - -```json -{ - "_id": "AWF5M-FDTqLFD8l5y2f4", - "_source": { - "company_id": "67890", - "duration_ms": 76, - "request": { - "body": "json", - "uri": "https://api.github.com", - "user_agent": { - "patch": "1", - "major": "7", - "minor": "1", - "name": "PostmanRuntime" - }, - "geo_ip": { - "ip": "73.189.235.253", - "region_name": "CA", - "continent_code": "NA", - "location": [ - -122.393 - ], - "latitude": 37.769, - "timezone": "America/Los_Angeles", - "area_code": 415, - "longitude": -122.393, - "real_region_name": "California", - "dma_code": 807, - "postal_code": "94107", - "city_name": "San Francisco", - "country_code2": "US", - "country_code3": "USA", - "country_name": "United States" - }, - "ip_address": "73.189.235.253", - "verb": "GET", - "route": "/", - "time": "2023-07-09T06:14:58.550", - "headers": {} - }, - "user_id": "123454", - "company": {}, - "response": { - "body": {}, - "transfer_encoding": "json", - "status": 200, - "time": "2023-07-09T06:14:58.626", - "headers": {} - }, - "id": "AWF5M-FDTqLFD8l5y2f4", - "event_type": "api_call", - "session_token": "rdfmnw3fu24309efjc534nb421UZ9-]2JDO[ME", - "metadata": {}, - "app_id": "198:3", - "org_id": "177:3", - "user": {} - }, - "sort": [ - 0 - ] -} -``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[eventResponseDTO](#schemaeventresponsedto)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| -

Users

- -## countUsers +## deleteEmailTemplate - + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/search/~/count/users?app_id=string \ - -H 'Accept: application/json' \ +curl -X DELETE https://api.moesif.com/v1/~/emails/templates/{id} \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -21855,13 +25483,12 @@ curl -X POST https://api.moesif.com/v1/search/~/count/users?app_id=string \ const fetch = require('node-fetch'); const headers = { - 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/search/~/count/users?app_id=string', +fetch('https://api.moesif.com/v1/~/emails/templates/{id}', { - method: 'POST', + method: 'DELETE', headers: headers }) @@ -21876,13 +25503,10 @@ fetch('https://api.moesif.com/v1/search/~/count/users?app_id=string', ```python import requests headers = { - 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.post('https://api.moesif.com/v1/search/~/count/users', params={ - 'app_id': 'string' -}, headers = headers) +r = requests.delete('https://api.moesif.com/v1/~/emails/templates/{id}', headers = headers) print(r.json()) @@ -21893,14 +25517,13 @@ require 'rest-client' require 'json' headers = { - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/search/~/count/users', +result = RestClient.delete 'https://api.moesif.com/v1/~/emails/templates/{id}', params: { - 'app_id' => 'string' -}, headers: headers + }, + headers: headers p JSON.parse(result) @@ -21912,19 +25535,14 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( - 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('POST','https://api.moesif.com/v1/search/~/count/users', array( + $response = $client->request('DELETE','https://api.moesif.com/v1/~/emails/templates/{id}', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -21949,12 +25567,11 @@ import ( func main() { headers := map[string][]string{ - "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/count/users", data) + + + req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/emails/templates/{id}") req.Header = headers client := &http.Client{} @@ -21989,36 +25606,25 @@ public class HttpExample } + + /// Make a dummy request - public async Task MakePostRequest() - { - string url = "https://api.moesif.com/v1/search/~/count/users"; - - - await PostAsync(null, url); - - } - - /// Performs a POST Request - public async Task PostAsync(undefined content, string url) + public async Task MakeDeleteRequest() { - //Serialize Object - StringContent jsonContent = SerializeObject(content); + int id = 1; + string url = "https://api.moesif.com/v1/~/emails/templates/{id}"; - //Execute POST request - HttpResponseMessage response = await Client.PostAsync(url, jsonContent); + await DeleteAsync(id, url); } - - - - /// Serialize an object to Json - private StringContent SerializeObject(undefined content) + + /// Performs a DELETE Request + public async Task DeleteAsync(int id, string url) { - //Serialize Object - string jsonObject = JsonConvert.SerializeObject(content); + //Execute DELETE request + HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}"); - //Create Json UTF8 String Content - return new StringContent(jsonObject, Encoding.UTF8, "application/json"); + //Return response + await DeserializeObject(response); } /// Deserialize object from request response @@ -22035,12 +25641,14 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/search/~/count/users?app_id=string"); +URL obj = new URL("https://api.moesif.com/v1/~/emails/templates/{id}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("POST"); +con.setRequestMethod("DELETE"); + +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -22051,57 +25659,148 @@ System.out.println(response.toString()); ``` -`POST /search/~/count/users` +`DELETE /~/emails/templates/{id}` -*Count Users* +*Delete Email Template* -

Parameters

+> `DELETE https://api.moesif.com/v1/~/emails/templates/{id}` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|body|body|undefined|false|A query to restrict the results specified with the Elasticsearch Query DSL| - -> Example responses +|id|path|string|true|none| -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| -

Response Schema

- -## updateUsers +

Governance Rules

- +## createGovernanceRule + + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/search/~/users \ +curl -X POST https://api.moesif.com/v1/~/governance/rules \ + -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + -d '{ + "name": "string", + "priority": 0, + "model": "string", + "state": 0, + "cohorts": [ + {} + ], + "variables": [ + { + "name": "string", + "path": "string" + } + ], + "applied_to": "string", + "block": true, + "response": { + "status": 0, + "headers": null, + "body": {}, + "original_encoded_body": "string" + }, + "applied_to_unidentified": true, + "regex_config": [ + { + "conditions": [ + { + "path": "string", + "value": "string" + } + ], + "sample_rate": 0 + } + ], + "plans": [ + { + "provider": "string", + "plan_id": "string", + "price_ids": [ + "string" + ] + } + ], + "type": "string" +}' ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = { + "name": "string", + "priority": 0, + "model": "string", + "state": 0, + "cohorts": [ + {} + ], + "variables": [ + { + "name": "string", + "path": "string" + } + ], + "applied_to": "string", + "block": true, + "response": { + "status": 0, + "headers": null, + "body": {}, + "original_encoded_body": "string" + }, + "applied_to_unidentified": true, + "regex_config": [ + { + "conditions": [ + { + "path": "string", + "value": "string" + } + ], + "sample_rate": 0 + } + ], + "plans": [ + { + "provider": "string", + "plan_id": "string", + "price_ids": [ + "string" + ] + } + ], + "type": "string" +}; const headers = { + 'Content-Type':'application/json', 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/search/~/users', +fetch('https://api.moesif.com/v1/~/governance/rules', { method: 'POST', - + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -22115,11 +25814,57 @@ fetch('https://api.moesif.com/v1/search/~/users', ```python import requests headers = { + 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = { + "name": "string", + "priority": 0, + "model": "string", + "state": 0, + "cohorts": [ + {} + ], + "variables": [ + { + "name": "string", + "path": "string" + } + ], + "applied_to": "string", + "block": true, + "response": { + "status": 0, + "headers": null, + "body": {}, + "original_encoded_body": "string" + }, + "applied_to_unidentified": true, + "regex_config": [ + { + "conditions": [ + { + "path": "string", + "value": "string" + } + ], + "sample_rate": 0 + } + ], + "plans": [ + { + "provider": "string", + "plan_id": "string", + "price_ids": [ + "string" + ] + } + ], + "type": "string" +} -r = requests.post('https://api.moesif.com/v1/search/~/users', headers = headers) +r = requests.post('https://api.moesif.com/v1/~/governance/rules', headers = headers, json = input_data) print(r.json()) @@ -22130,13 +25875,62 @@ require 'rest-client' require 'json' headers = { + 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/search/~/users', +input_payload = JSON.parse('{ + "name": "string", + "priority": 0, + "model": "string", + "state": 0, + "cohorts": [ + {} + ], + "variables": [ + { + "name": "string", + "path": "string" + } + ], + "applied_to": "string", + "block": true, + "response": { + "status": 0, + "headers": null, + "body": {}, + "original_encoded_body": "string" + }, + "applied_to_unidentified": true, + "regex_config": [ + { + "conditions": [ + { + "path": "string", + "value": "string" + } + ], + "sample_rate": 0 + } + ], + "plans": [ + { + "provider": "string", + "plan_id": "string", + "price_ids": [ + "string" + ] + } + ], + "type": "string" +}') + +result = RestClient.post 'https://api.moesif.com/v1/~/governance/rules', params: { - }, headers: headers + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -22148,19 +25942,63 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('{ + "name": "string", + "priority": 0, + "model": "string", + "state": 0, + "cohorts": [ + {} + ], + "variables": [ + { + "name": "string", + "path": "string" + } + ], + "applied_to": "string", + "block": true, + "response": { + "status": 0, + "headers": null, + "body": {}, + "original_encoded_body": "string" + }, + "applied_to_unidentified": true, + "regex_config": [ + { + "conditions": [ + { + "path": "string", + "value": "string" + } + ], + "sample_rate": 0 + } + ], + "plans": [ + { + "provider": "string", + "plan_id": "string", + "price_ids": [ + "string" + ] + } + ], + "type": "string" +}') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('POST','https://api.moesif.com/v1/search/~/users', array( + $response = $client->request('POST','https://api.moesif.com/v1/~/governance/rules', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -22185,12 +26023,57 @@ import ( func main() { headers := map[string][]string{ + "Content-Type": []string{"application/json"}, "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/users", data) + jsonPayload := `{ + "name": "string", + "priority": 0, + "model": "string", + "state": 0, + "cohorts": [ + {} + ], + "variables": [ + { + "name": "string", + "path": "string" + } + ], + "applied_to": "string", + "block": true, + "response": { + "status": 0, + "headers": null, + "body": {}, + "original_encoded_body": "string" + }, + "applied_to_unidentified": true, + "regex_config": [ + { + "conditions": [ + { + "path": "string", + "value": "string" + } + ], + "sample_rate": 0 + } + ], + "plans": [ + { + "provider": "string", + "plan_id": "string", + "price_ids": [ + "string" + ] + } + ], + "type": "string" +}` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/governance/rules", data) req.Header = headers client := &http.Client{} @@ -22228,15 +26111,61 @@ public class HttpExample /// Make a dummy request public async Task MakePostRequest() { - string url = "https://api.moesif.com/v1/search/~/users"; + string url = "https://api.moesif.com/v1/~/governance/rules"; + string json = @"{ + ""name"": ""string"", + ""priority"": 0, + ""model"": ""string"", + ""state"": 0, + ""cohorts"": [ + {} + ], + ""variables"": [ + { + ""name"": ""string"", + ""path"": ""string"" + } + ], + ""applied_to"": ""string"", + ""block"": true, + ""response"": { + ""status"": 0, + ""headers"": null, + ""body"": {}, + ""original_encoded_body"": ""string"" + }, + ""applied_to_unidentified"": true, + ""regex_config"": [ + { + ""conditions"": [ + { + ""path"": ""string"", + ""value"": ""string"" + } + ], + ""sample_rate"": 0 + } + ], + ""plans"": [ + { + ""provider"": ""string"", + ""plan_id"": ""string"", + ""price_ids"": [ + ""string"" + ] + } + ], + ""type"": ""string"" +}"; + var content = JsonConvert.DeserializeObject(json); + await PostAsync(content, url); - await PostAsync(null, url); } /// Performs a POST Request - public async Task PostAsync(undefined content, string url) + public async Task PostAsync(GovernanceRuleCreateItem content, string url) { //Serialize Object StringContent jsonContent = SerializeObject(content); @@ -22248,7 +26177,7 @@ public class HttpExample /// Serialize an object to Json - private StringContent SerializeObject(undefined content) + private StringContent SerializeObject(GovernanceRuleCreateItem content) { //Serialize Object string jsonObject = JsonConvert.SerializeObject(content); @@ -22271,12 +26200,71 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/search/~/users"); +URL obj = new URL("https://api.moesif.com/v1/~/governance/rules"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """{ + "name": "string", + "priority": 0, + "model": "string", + "state": 0, + "cohorts": [ + {} + ], + "variables": [ + { + "name": "string", + "path": "string" + } + ], + "applied_to": "string", + "block": true, + "response": { + "status": 0, + "headers": null, + "body": {}, + "original_encoded_body": "string" + }, + "applied_to_unidentified": true, + "regex_config": [ + { + "conditions": [ + { + "path": "string", + "value": "string" + } + ], + "sample_rate": 0 + } + ], + "plans": [ + { + "provider": "string", + "plan_id": "string", + "price_ids": [ + "string" + ] + } + ], + "type": "string" +}"""; + +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -22287,99 +26275,145 @@ System.out.println(response.toString()); ``` -`POST /search/~/users` +`POST /~/governance/rules` -*Update a User* +*Create New Governance Rules* -

Parameters

+> `POST https://api.moesif.com/v1/~/governance/rules` + +> Example Request + +```json +{ + "name": "string", + "priority": 0, + "model": "string", + "state": 0, + "cohorts": [ + {} + ], + "variables": [ + { + "name": "string", + "path": "string" + } + ], + "applied_to": "string", + "block": true, + "response": { + "status": 0, + "headers": null, + "body": {}, + "original_encoded_body": "string" + }, + "applied_to_unidentified": true, + "regex_config": [ + { + "conditions": [ + { + "path": "string", + "value": "string" + } + ], + "sample_rate": 0 + } + ], + "plans": [ + { + "provider": "string", + "plan_id": "string", + "price_ids": [ + "string" + ] + } + ], + "type": "string" +} +``` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|body|body|[UserUpdateDTO](#schemauserupdatedto)|false|none| +|body|body|[GovernanceRuleCreateItem](#schemagovernancerulecreateitem)|true|none| > Example responses -> 200 Response +> 201 Response ```json { - "_id": "123456", - "_source": { - "first_name": "John", + "name": "string", + "priority": 0, + "model": "string", + "state": 0, + "cohorts": [ + {} + ], + "_id": "string", + "variables": [ + { + "name": "string", + "path": "string" + } + ], + "applied_to": "string", + "block": true, + "response": { + "status": 0, + "headers": null, "body": {}, - "name": "John Doe", - "email": "john.doe@gmail.com", - "first_seen_time": "2023-07-27T21:52:58.0990000Z", - "user_agent": { - "name": "Android", - "os_major": "7", - "os": "Android 7.0", - "os_name": "Android", - "os_minor": "0", - "major": "7", - "device": "Samsung SM-G955U", - "minor": "0" - }, - "geo_ip": { - "ip": "107.200.85.196", - "region_name": "South Carolina", - "continent_code": "NA", - "location": { - "lon": -79.85489654541016, - "lat": 32.822898864746094 - }, - "latitude": 32.822898864746094, - "timezone": "America/New_York", - "longitude": -79.85489654541016, - "dma_code": 519, - "postal_code": "29464", - "region_code": "SC", - "city_name": "Mt. Pleasant", - "country_code2": "US", - "country_code3": "US", - "country_name": "United States" - }, - "modified_time": "2023-07-27T21:55:19.464", - "last_name": "Doe", - "ip_address": "107.200.85.196", - "session_token": [ - "e93u2jiry8fij8q09-tfZ9SIK9DERDXUYMF" - ], - "last_seen_time": "2023-07-27T21:52:58.0990000Z", - "app_id": "198:3", - "org_id": "177:3" + "original_encoded_body": "string" }, - "sort": [ - 1519768519464 - ] + "applied_to_unidentified": true, + "regex_config": [ + { + "conditions": [ + { + "path": "string", + "value": "string" + } + ], + "sample_rate": 0 + } + ], + "created_at": "2024-04-11T04:01:35.090Z", + "app_id": "string", + "plans": [ + { + "provider": "string", + "plan_id": "string", + "price_ids": [ + "string" + ] + } + ], + "type": "string", + "org_id": "string" } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[userResponseDTO](#schemauserresponsedto)| +|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|[GovernanceRulesDocument](#schemagovernancerulesdocument)| -## searchUserMetrics - - +## getGovernanceRules - + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/search/~/search/usermetrics/users \ - -H 'Accept: 0' \ +curl -X GET https://api.moesif.com/v1/~/governance/rules \ + -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -22388,13 +26422,13 @@ curl -X POST https://api.moesif.com/v1/search/~/search/usermetrics/users \ const fetch = require('node-fetch'); const headers = { - 'Accept':'0', + 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/search/~/search/usermetrics/users', +fetch('https://api.moesif.com/v1/~/governance/rules', { - method: 'POST', + method: 'GET', headers: headers }) @@ -22409,11 +26443,11 @@ fetch('https://api.moesif.com/v1/search/~/search/usermetrics/users', ```python import requests headers = { - 'Accept': '0', + 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.post('https://api.moesif.com/v1/search/~/search/usermetrics/users', headers = headers) +r = requests.get('https://api.moesif.com/v1/~/governance/rules', headers = headers) print(r.json()) @@ -22424,13 +26458,14 @@ require 'rest-client' require 'json' headers = { - 'Accept' => '0', + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/search/~/search/usermetrics/users', +result = RestClient.get 'https://api.moesif.com/v1/~/governance/rules', params: { - }, headers: headers + }, + headers: headers p JSON.parse(result) @@ -22442,19 +26477,15 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( - 'Accept' => '0', + 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('POST','https://api.moesif.com/v1/search/~/search/usermetrics/users', array( + $response = $client->request('GET','https://api.moesif.com/v1/~/governance/rules', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -22479,12 +26510,12 @@ import ( func main() { headers := map[string][]string{ - "Accept": []string{"0"}, + "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/search/usermetrics/users", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/governance/rules") req.Header = headers client := &http.Client{} @@ -22518,38 +26549,26 @@ public class HttpExample Client = new HttpClient(); } - /// Make a dummy request - public async Task MakePostRequest() + public async Task MakeGetRequest() { - string url = "https://api.moesif.com/v1/search/~/search/usermetrics/users"; - - - await PostAsync(null, url); - + string url = "https://api.moesif.com/v1/~/governance/rules"; + var result = await GetAsync(url); } - /// Performs a POST Request - public async Task PostAsync(undefined content, string url) + /// Performs a GET Request + public async Task GetAsync(string url) { - //Serialize Object - StringContent jsonContent = SerializeObject(content); + //Start the request + HttpResponseMessage response = await Client.GetAsync(url); + + //Validate result + response.EnsureSuccessStatusCode(); - //Execute POST request - HttpResponseMessage response = await Client.PostAsync(url, jsonContent); } - /// Serialize an object to Json - private StringContent SerializeObject(undefined content) - { - //Serialize Object - string jsonObject = JsonConvert.SerializeObject(content); - - //Create Json UTF8 String Content - return new StringContent(jsonObject, Encoding.UTF8, "application/json"); - } /// Deserialize object from request response private async Task DeserializeObject(HttpResponseMessage response) @@ -22565,12 +26584,15 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/search/~/search/usermetrics/users"); +URL obj = new URL("https://api.moesif.com/v1/~/governance/rules"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); -con.setRequestMethod("POST"); +con.setRequestMethod("GET"); + +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -22581,59 +26603,201 @@ System.out.println(response.toString()); ``` -`POST /search/~/search/usermetrics/users` +`GET /~/governance/rules` -*Search UserMetrics/Users* +*Get Governance Rules* -

Parameters

+> `GET https://api.moesif.com/v1/~/governance/rules` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|from|query|string(date-time)|false|The start date, which can be absolute such as 2023-07-01T00:00:00Z or relative such as -24h| -|to|query|string(date-time)|false|The end date, which can be absolute such as 2023-07-02T00:00:00Z or relative such as now| -|body|body|undefined|false|The search definition using the Elasticsearch Query DSL| > Example responses -

Responses

+> 200 Response + +```json +{ + "name": "string", + "priority": 0, + "model": "string", + "state": 0, + "cohorts": [ + {} + ], + "_id": "string", + "variables": [ + { + "name": "string", + "path": "string" + } + ], + "applied_to": "string", + "block": true, + "response": { + "status": 0, + "headers": null, + "body": {}, + "original_encoded_body": "string" + }, + "applied_to_unidentified": true, + "regex_config": [ + { + "conditions": [ + { + "path": "string", + "value": "string" + } + ], + "sample_rate": 0 + } + ], + "created_at": "2024-04-11T04:01:35.090Z", + "app_id": "string", + "plans": [ + { + "provider": "string", + "plan_id": "string", + "price_ids": [ + "string" + ] + } + ], + "type": "string", + "org_id": "string" +} +``` + +

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| - -

Response Schema

+|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[GovernanceRulesDocument](#schemagovernancerulesdocument)| -## batchUpdateUsers +## updateGovernanceRule - + > Code samples ```shell # You can also use wget -curl -X POST https://api.moesif.com/v1/search/~/users/batch \ +curl -X POST https://api.moesif.com/v1/~/governance/rules/{id} \ + -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' + -d '{ + "name": "string", + "priority": 0, + "model": "string", + "state": 0, + "cohorts": [ + {} + ], + "variables": [ + { + "name": "string", + "path": "string" + } + ], + "applied_to": "string", + "block": true, + "response": { + "status": 0, + "headers": null, + "body": {}, + "original_encoded_body": "string" + }, + "applied_to_unidentified": true, + "regex_config": [ + { + "conditions": [ + { + "path": "string", + "value": "string" + } + ], + "sample_rate": 0 + } + ], + "plans": [ + { + "provider": "string", + "plan_id": "string", + "price_ids": [ + "string" + ] + } + ], + "type": "string" +}' ``` ```javascript--nodejs const fetch = require('node-fetch'); - +const inputBody = { + "name": "string", + "priority": 0, + "model": "string", + "state": 0, + "cohorts": [ + {} + ], + "variables": [ + { + "name": "string", + "path": "string" + } + ], + "applied_to": "string", + "block": true, + "response": { + "status": 0, + "headers": null, + "body": {}, + "original_encoded_body": "string" + }, + "applied_to_unidentified": true, + "regex_config": [ + { + "conditions": [ + { + "path": "string", + "value": "string" + } + ], + "sample_rate": 0 + } + ], + "plans": [ + { + "provider": "string", + "plan_id": "string", + "price_ids": [ + "string" + ] + } + ], + "type": "string" +}; const headers = { + 'Content-Type':'application/json', 'Accept':'application/json', 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/search/~/users/batch', +fetch('https://api.moesif.com/v1/~/governance/rules/{id}', { method: 'POST', - + body: JSON.stringify(inputBody), headers: headers }) .then(function(res) { @@ -22647,11 +26811,57 @@ fetch('https://api.moesif.com/v1/search/~/users/batch', ```python import requests headers = { + 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } +input_body = { + "name": "string", + "priority": 0, + "model": "string", + "state": 0, + "cohorts": [ + {} + ], + "variables": [ + { + "name": "string", + "path": "string" + } + ], + "applied_to": "string", + "block": true, + "response": { + "status": 0, + "headers": null, + "body": {}, + "original_encoded_body": "string" + }, + "applied_to_unidentified": true, + "regex_config": [ + { + "conditions": [ + { + "path": "string", + "value": "string" + } + ], + "sample_rate": 0 + } + ], + "plans": [ + { + "provider": "string", + "plan_id": "string", + "price_ids": [ + "string" + ] + } + ], + "type": "string" +} -r = requests.post('https://api.moesif.com/v1/search/~/users/batch', headers = headers) +r = requests.post('https://api.moesif.com/v1/~/governance/rules/{id}', headers = headers, json = input_data) print(r.json()) @@ -22662,13 +26872,62 @@ require 'rest-client' require 'json' headers = { + 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.post 'https://api.moesif.com/v1/search/~/users/batch', +input_payload = JSON.parse('{ + "name": "string", + "priority": 0, + "model": "string", + "state": 0, + "cohorts": [ + {} + ], + "variables": [ + { + "name": "string", + "path": "string" + } + ], + "applied_to": "string", + "block": true, + "response": { + "status": 0, + "headers": null, + "body": {}, + "original_encoded_body": "string" + }, + "applied_to_unidentified": true, + "regex_config": [ + { + "conditions": [ + { + "path": "string", + "value": "string" + } + ], + "sample_rate": 0 + } + ], + "plans": [ + { + "provider": "string", + "plan_id": "string", + "price_ids": [ + "string" + ] + } + ], + "type": "string" +}') + +result = RestClient.post 'https://api.moesif.com/v1/~/governance/rules/{id}', params: { - }, headers: headers + }, + payload: input_payload.to_json, + headers: headers p JSON.parse(result) @@ -22680,19 +26939,63 @@ p JSON.parse(result) require 'vendor/autoload.php'; $headers = array( + 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY', ); -$client = new \GuzzleHttp\Client(); +$inputPayload = json_decode('{ + "name": "string", + "priority": 0, + "model": "string", + "state": 0, + "cohorts": [ + {} + ], + "variables": [ + { + "name": "string", + "path": "string" + } + ], + "applied_to": "string", + "block": true, + "response": { + "status": 0, + "headers": null, + "body": {}, + "original_encoded_body": "string" + }, + "applied_to_unidentified": true, + "regex_config": [ + { + "conditions": [ + { + "path": "string", + "value": "string" + } + ], + "sample_rate": 0 + } + ], + "plans": [ + { + "provider": "string", + "plan_id": "string", + "price_ids": [ + "string" + ] + } + ], + "type": "string" +}') -// Define array of request body. -$request_body = array(); +$client = new \GuzzleHttp\Client(); try { - $response = $client->request('POST','https://api.moesif.com/v1/search/~/users/batch', array( + $response = $client->request('POST','https://api.moesif.com/v1/~/governance/rules/{id}', array( 'headers' => $headers, - 'json' => $request_body, + 'json' => $inputPayload, ) ); print_r($response->getBody()->getContents()); @@ -22717,12 +27020,57 @@ import ( func main() { headers := map[string][]string{ + "Content-Type": []string{"application/json"}, "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/users/batch", data) + jsonPayload := `{ + "name": "string", + "priority": 0, + "model": "string", + "state": 0, + "cohorts": [ + {} + ], + "variables": [ + { + "name": "string", + "path": "string" + } + ], + "applied_to": "string", + "block": true, + "response": { + "status": 0, + "headers": null, + "body": {}, + "original_encoded_body": "string" + }, + "applied_to_unidentified": true, + "regex_config": [ + { + "conditions": [ + { + "path": "string", + "value": "string" + } + ], + "sample_rate": 0 + } + ], + "plans": [ + { + "provider": "string", + "plan_id": "string", + "price_ids": [ + "string" + ] + } + ], + "type": "string" +}` + data := bytes.NewBuffer([]byte(jsonPayload)) + req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/governance/rules/{id}", data) req.Header = headers client := &http.Client{} @@ -22760,15 +27108,61 @@ public class HttpExample /// Make a dummy request public async Task MakePostRequest() { - string url = "https://api.moesif.com/v1/search/~/users/batch"; + string url = "https://api.moesif.com/v1/~/governance/rules/{id}"; + string json = @"{ + ""name"": ""string"", + ""priority"": 0, + ""model"": ""string"", + ""state"": 0, + ""cohorts"": [ + {} + ], + ""variables"": [ + { + ""name"": ""string"", + ""path"": ""string"" + } + ], + ""applied_to"": ""string"", + ""block"": true, + ""response"": { + ""status"": 0, + ""headers"": null, + ""body"": {}, + ""original_encoded_body"": ""string"" + }, + ""applied_to_unidentified"": true, + ""regex_config"": [ + { + ""conditions"": [ + { + ""path"": ""string"", + ""value"": ""string"" + } + ], + ""sample_rate"": 0 + } + ], + ""plans"": [ + { + ""provider"": ""string"", + ""plan_id"": ""string"", + ""price_ids"": [ + ""string"" + ] + } + ], + ""type"": ""string"" +}"; + var content = JsonConvert.DeserializeObject(json); + await PostAsync(content, url); - await PostAsync(null, url); } /// Performs a POST Request - public async Task PostAsync(undefined content, string url) + public async Task PostAsync(GovernanceRuleUpdateItem content, string url) { //Serialize Object StringContent jsonContent = SerializeObject(content); @@ -22780,7 +27174,7 @@ public class HttpExample /// Serialize an object to Json - private StringContent SerializeObject(undefined content) + private StringContent SerializeObject(GovernanceRuleUpdateItem content) { //Serialize Object string jsonObject = JsonConvert.SerializeObject(content); @@ -22803,12 +27197,71 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/search/~/users/batch"); +URL obj = new URL("https://api.moesif.com/v1/~/governance/rules/{id}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); + +con.setRequestProperty("Content-Type",'application/json'); +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + +// Enable sending a request body +con.setDoOutput(true); + +String jsonPayload = """{ + "name": "string", + "priority": 0, + "model": "string", + "state": 0, + "cohorts": [ + {} + ], + "variables": [ + { + "name": "string", + "path": "string" + } + ], + "applied_to": "string", + "block": true, + "response": { + "status": 0, + "headers": null, + "body": {}, + "original_encoded_body": "string" + }, + "applied_to_unidentified": true, + "regex_config": [ + { + "conditions": [ + { + "path": "string", + "value": "string" + } + ], + "sample_rate": 0 + } + ], + "plans": [ + { + "provider": "string", + "plan_id": "string", + "price_ids": [ + "string" + ] + } + ], + "type": "string" +}"""; + +// Write payload to the request +try(OutputStream os = con.getOutputStream()) { + byte[] input = jsonPayload.getBytes("utf-8"); + os.write(input, 0, input.length); +} + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -22819,94 +27272,145 @@ System.out.println(response.toString()); ``` -`POST /search/~/users/batch` +`POST /~/governance/rules/{id}` -*Update Users in Batch* +*Update a Governance Rule* -

Parameters

+> `POST https://api.moesif.com/v1/~/governance/rules/{id}` + +> Example Request + +```json +{ + "name": "string", + "priority": 0, + "model": "string", + "state": 0, + "cohorts": [ + {} + ], + "variables": [ + { + "name": "string", + "path": "string" + } + ], + "applied_to": "string", + "block": true, + "response": { + "status": 0, + "headers": null, + "body": {}, + "original_encoded_body": "string" + }, + "applied_to_unidentified": true, + "regex_config": [ + { + "conditions": [ + { + "path": "string", + "value": "string" + } + ], + "sample_rate": 0 + } + ], + "plans": [ + { + "provider": "string", + "plan_id": "string", + "price_ids": [ + "string" + ] + } + ], + "type": "string" +} +``` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| -|body|body|array[object]|false|none| +|id|path|string|true|none| +|body|body|[GovernanceRuleUpdateItem](#schemagovernanceruleupdateitem)|true|none| > Example responses -> 200 Response +> 201 Response ```json { - "_id": "123456", - "_source": { - "first_name": "John", + "name": "string", + "priority": 0, + "model": "string", + "state": 0, + "cohorts": [ + {} + ], + "_id": "string", + "variables": [ + { + "name": "string", + "path": "string" + } + ], + "applied_to": "string", + "block": true, + "response": { + "status": 0, + "headers": null, "body": {}, - "name": "John Doe", - "email": "john.doe@gmail.com", - "first_seen_time": "2023-07-27T21:52:58.0990000Z", - "user_agent": { - "name": "Android", - "os_major": "7", - "os": "Android 7.0", - "os_name": "Android", - "os_minor": "0", - "major": "7", - "device": "Samsung SM-G955U", - "minor": "0" - }, - "geo_ip": { - "ip": "107.200.85.196", - "region_name": "South Carolina", - "continent_code": "NA", - "location": { - "lon": -79.85489654541016, - "lat": 32.822898864746094 - }, - "latitude": 32.822898864746094, - "timezone": "America/New_York", - "longitude": -79.85489654541016, - "dma_code": 519, - "postal_code": "29464", - "region_code": "SC", - "city_name": "Mt. Pleasant", - "country_code2": "US", - "country_code3": "US", - "country_name": "United States" - }, - "modified_time": "2023-07-27T21:55:19.464", - "last_name": "Doe", - "ip_address": "107.200.85.196", - "session_token": [ - "e93u2jiry8fij8q09-tfZ9SIK9DERDXUYMF" - ], - "last_seen_time": "2023-07-27T21:52:58.0990000Z", - "app_id": "198:3", - "org_id": "177:3" + "original_encoded_body": "string" }, - "sort": [ - 1519768519464 - ] + "applied_to_unidentified": true, + "regex_config": [ + { + "conditions": [ + { + "path": "string", + "value": "string" + } + ], + "sample_rate": 0 + } + ], + "created_at": "2024-04-11T04:01:35.090Z", + "app_id": "string", + "plans": [ + { + "provider": "string", + "plan_id": "string", + "price_ids": [ + "string" + ] + } + ], + "type": "string", + "org_id": "string" } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[userResponseDTO](#schemauserresponsedto)| +|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|[GovernanceRulesDocument](#schemagovernancerulesdocument)| -## getUser +## getGovernanceRule - + > Code samples ```shell # You can also use wget -curl -X GET https://api.moesif.com/v1/search/~/users/{id} \ +curl -X GET https://api.moesif.com/v1/~/governance/rules/{id} \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' @@ -22920,7 +27424,7 @@ const headers = { 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/search/~/users/{id}', +fetch('https://api.moesif.com/v1/~/governance/rules/{id}', { method: 'GET', @@ -22941,7 +27445,7 @@ headers = { 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.get('https://api.moesif.com/v1/search/~/users/{id}', headers = headers) +r = requests.get('https://api.moesif.com/v1/~/governance/rules/{id}', headers = headers) print(r.json()) @@ -22956,9 +27460,10 @@ headers = { 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.get 'https://api.moesif.com/v1/search/~/users/{id}', +result = RestClient.get 'https://api.moesif.com/v1/~/governance/rules/{id}', params: { - }, headers: headers + }, + headers: headers p JSON.parse(result) @@ -22976,13 +27481,9 @@ $headers = array( $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('GET','https://api.moesif.com/v1/search/~/users/{id}', array( + $response = $client->request('GET','https://api.moesif.com/v1/~/governance/rules/{id}', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -23010,9 +27511,9 @@ func main() { "Accept": []string{"application/json"}, "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("GET", "https://api.moesif.com/v1/search/~/users/{id}", data) + + + req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/governance/rules/{id}") req.Header = headers client := &http.Client{} @@ -23049,7 +27550,7 @@ public class HttpExample /// Make a dummy request public async Task MakeGetRequest() { - string url = "https://api.moesif.com/v1/search/~/users/{id}"; + string url = "https://api.moesif.com/v1/~/governance/rules/{id}"; var result = await GetAsync(url); } @@ -23081,12 +27582,15 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/search/~/users/{id}"); +URL obj = new URL("https://api.moesif.com/v1/~/governance/rules/{id}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); + +con.setRequestProperty("Accept",'application/json'); +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -23097,11 +27601,13 @@ System.out.println(response.toString()); ``` -`GET /search/~/users/{id}` +`GET /~/governance/rules/{id}` -*Get a User* +*Get a Governance Rule* -

Parameters

+> `GET https://api.moesif.com/v1/~/governance/rules/{id}` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| @@ -23113,78 +27619,76 @@ System.out.println(response.toString()); ```json { - "_id": "123456", - "_source": { - "first_name": "John", + "name": "string", + "priority": 0, + "model": "string", + "state": 0, + "cohorts": [ + {} + ], + "_id": "string", + "variables": [ + { + "name": "string", + "path": "string" + } + ], + "applied_to": "string", + "block": true, + "response": { + "status": 0, + "headers": null, "body": {}, - "name": "John Doe", - "email": "john.doe@gmail.com", - "first_seen_time": "2023-07-27T21:52:58.0990000Z", - "user_agent": { - "name": "Android", - "os_major": "7", - "os": "Android 7.0", - "os_name": "Android", - "os_minor": "0", - "major": "7", - "device": "Samsung SM-G955U", - "minor": "0" - }, - "geo_ip": { - "ip": "107.200.85.196", - "region_name": "South Carolina", - "continent_code": "NA", - "location": { - "lon": -79.85489654541016, - "lat": 32.822898864746094 - }, - "latitude": 32.822898864746094, - "timezone": "America/New_York", - "longitude": -79.85489654541016, - "dma_code": 519, - "postal_code": "29464", - "region_code": "SC", - "city_name": "Mt. Pleasant", - "country_code2": "US", - "country_code3": "US", - "country_name": "United States" - }, - "modified_time": "2023-07-27T21:55:19.464", - "last_name": "Doe", - "ip_address": "107.200.85.196", - "session_token": [ - "e93u2jiry8fij8q09-tfZ9SIK9DERDXUYMF" - ], - "last_seen_time": "2023-07-27T21:52:58.0990000Z", - "app_id": "198:3", - "org_id": "177:3" + "original_encoded_body": "string" }, - "sort": [ - 1519768519464 - ] + "applied_to_unidentified": true, + "regex_config": [ + { + "conditions": [ + { + "path": "string", + "value": "string" + } + ], + "sample_rate": 0 + } + ], + "created_at": "2024-04-11T04:01:35.090Z", + "app_id": "string", + "plans": [ + { + "provider": "string", + "plan_id": "string", + "price_ids": [ + "string" + ] + } + ], + "type": "string", + "org_id": "string" } ``` -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[userResponseDTO](#schemauserresponsedto)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|[GovernanceRulesDocument](#schemagovernancerulesdocument)| -## deleteUser +## deleteGovernanceRule - + > Code samples ```shell # You can also use wget -curl -X DELETE https://api.moesif.com/v1/search/~/users/{id} \ +curl -X DELETE https://api.moesif.com/v1/~/governance/rules/{id} \ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' ``` @@ -23196,7 +27700,7 @@ const headers = { 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY' }; -fetch('https://api.moesif.com/v1/search/~/users/{id}', +fetch('https://api.moesif.com/v1/~/governance/rules/{id}', { method: 'DELETE', @@ -23216,7 +27720,7 @@ headers = { 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY' } -r = requests.delete('https://api.moesif.com/v1/search/~/users/{id}', headers = headers) +r = requests.delete('https://api.moesif.com/v1/~/governance/rules/{id}', headers = headers) print(r.json()) @@ -23230,9 +27734,10 @@ headers = { 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY' } -result = RestClient.delete 'https://api.moesif.com/v1/search/~/users/{id}', +result = RestClient.delete 'https://api.moesif.com/v1/~/governance/rules/{id}', params: { - }, headers: headers + }, + headers: headers p JSON.parse(result) @@ -23249,13 +27754,9 @@ $headers = array( $client = new \GuzzleHttp\Client(); -// Define array of request body. -$request_body = array(); - try { - $response = $client->request('DELETE','https://api.moesif.com/v1/search/~/users/{id}', array( + $response = $client->request('DELETE','https://api.moesif.com/v1/~/governance/rules/{id}', array( 'headers' => $headers, - 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); @@ -23282,9 +27783,9 @@ func main() { headers := map[string][]string{ "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"}, } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/search/~/users/{id}", data) + + + req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/governance/rules/{id}") req.Header = headers client := &http.Client{} @@ -23325,7 +27826,7 @@ public class HttpExample public async Task MakeDeleteRequest() { int id = 1; - string url = "https://api.moesif.com/v1/search/~/users/{id}"; + string url = "https://api.moesif.com/v1/~/governance/rules/{id}"; await DeleteAsync(id, url); } @@ -23354,12 +27855,14 @@ public class HttpExample ``` ```java -URL obj = new URL("https://api.moesif.com/v1/search/~/users/{id}"); +URL obj = new URL("https://api.moesif.com/v1/~/governance/rules/{id}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("DELETE"); + +con.setRequestProperty("Authorization",'Bearer YOUR_MANAGEMENT_API_KEY'); + int responseCode = con.getResponseCode(); -BufferedReader in = new BufferedReader( - new InputStreamReader(con.getInputStream())); +BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { @@ -23370,30 +27873,59 @@ System.out.println(response.toString()); ``` -`DELETE /search/~/users/{id}` +`DELETE /~/governance/rules/{id}` -*Delete a User* +*Delete a Governance Rule* -

Parameters

+> `DELETE https://api.moesif.com/v1/~/governance/rules/{id}` + +

Parameters

|Name|In|Type|Required|Description| |---|---|---|---|---| |id|path|string|true|none| -|delete_events|query|boolean|false|Delete events associated with the user which can be set to true or false(default)| -

Responses

+

Responses

|Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None| +|204|[No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5)|success|None| # Schemas +

StripeTier

+ + + + + + +```json +{ + "flat_amount_decimal": "string", + "up_to": 0, + "unit_amount_decimal": "string", + "flat_amount": 0, + "unit_amount": 0 +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|flat_amount_decimal|string|false|none|none| +|up_to|integer(int64)|false|none|none| +|unit_amount_decimal|string|false|none|none| +|flat_amount|integer(int64)|false|none|none| +|unit_amount|integer(int64)|false|none|none| +

CohortDocument

@@ -23421,9 +27953,9 @@ managementAPIToken ( Scopes: delete:users ) "to": "string", "week_starts_on": 0, "locked_by": "string", - "modified_at": "2019-08-24T14:15:22Z", + "modified_at": "2024-04-11T04:01:35.090Z", "from": "string", - "created_at": "2019-08-24T14:15:22Z", + "created_at": "2024-04-11T04:01:35.090Z", "app_id": "string", "cohort_type": "string", "time_zone": "string", @@ -23477,26 +28009,23 @@ managementAPIToken ( Scopes: delete:users ) |Name|Type|Required|Restrictions|Description| |---|---|---|---|---| |status|integer(int32)|false|none|none| -|headers|collection.immutable.map[string,string]|false|none|none| +|headers|.map[string,string]|false|none|none| |body|object|false|none|none| |original_encoded_body|string|false|none|none| -

AppCreateDTO

+

AppCreate

- + ```json { "name": "string", - "custom_app_id": "string", - "search_api_base_url": "string", + "time_zone": "string", "week_starts_on": 0, - "portal_api_base_url": "string", - "secure_proxy": true, - "time_zone": "string" + "custom_app_id": "string" } ``` @@ -23506,29 +28035,23 @@ managementAPIToken ( Scopes: delete:users ) |Name|Type|Required|Restrictions|Description| |---|---|---|---|---| |name|string|true|none|none| -|custom_app_id|string|false|none|none| -|search_api_base_url|string|false|none|none| -|week_starts_on|integer(int32)|false|none|none| -|portal_api_base_url|string|false|none|none| -|secure_proxy|boolean|false|none|none| |time_zone|string|false|none|none| +|week_starts_on|integer(int32)|false|none|none| +|custom_app_id|string|false|none|none| -

AppUpdateDTO

+

AppUpdate

- + ```json { "name": "string", - "custom_app_id": "string", - "search_api_base_url": "string", + "time_zone": "string", "week_starts_on": 0, - "portal_api_base_url": "string", - "secure_proxy": true, - "time_zone": "string" + "custom_app_id": "string" } ``` @@ -23538,12 +28061,9 @@ managementAPIToken ( Scopes: delete:users ) |Name|Type|Required|Restrictions|Description| |---|---|---|---|---| |name|string|false|none|none| -|custom_app_id|string|false|none|none| -|search_api_base_url|string|false|none|none| -|week_starts_on|integer(int32)|false|none|none| -|portal_api_base_url|string|false|none|none| -|secure_proxy|boolean|false|none|none| |time_zone|string|false|none|none| +|week_starts_on|integer(int32)|false|none|none| +|custom_app_id|string|false|none|none|

BillingReportUsageInvoice

@@ -23554,8 +28074,8 @@ managementAPIToken ( Scopes: delete:users ) ```json { - "period_start": "2019-08-24T14:15:22Z", - "period_end": "2019-08-24T14:15:22Z", + "period_start": "2024-04-11T04:01:35.090Z", + "period_end": "2024-04-11T04:01:35.090Z", "id": "string" } @@ -23618,6 +28138,26 @@ managementAPIToken ( Scopes: delete:users ) |cohort_type|string|true|none|none| |time_zone|string|false|none|none| +

CustomReportPlan

+ + + + + + +```json +{ + "plan_id": "string" +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|plan_id|string|true|none|none| +

BillingReportUsage

@@ -23628,8 +28168,8 @@ managementAPIToken ( Scopes: delete:users ) ```json { "invoice": { - "period_start": "2019-08-24T14:15:22Z", - "period_end": "2019-08-24T14:15:22Z", + "period_start": "2024-04-11T04:01:35.090Z", + "period_end": "2024-04-11T04:01:35.090Z", "id": "string" }, "aggregator": "string" @@ -23655,13 +28195,13 @@ managementAPIToken ( Scopes: delete:users ) { "buckets": [ { - "start": "2019-08-24T14:15:22Z", - "metric": 0, + "start": "2024-04-11T04:01:35.090Z", + "metric": 0.1, "amounts": null, "ending_balance": { - "current_balance": 0, - "pending_activity": 0, - "available_balance": 0 + "current_balance": 0.1, + "pending_activity": 0.1, + "available_balance": 0.1 } } ] @@ -23808,7 +28348,7 @@ managementAPIToken ( Scopes: delete:users ) ```json { - "amount": 0 + "amount": 0.1 } ``` @@ -23819,6 +28359,65 @@ managementAPIToken ( Scopes: delete:users ) |---|---|---|---|---| |amount|number(double)|true|none|none| +

StripePrice

+ + + + + + +```json +{ + "tiers_mode": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "price_id": "string", + "tiers": [ + { + "flat_amount_decimal": "string", + "up_to": 0, + "unit_amount_decimal": "string", + "flat_amount": 0, + "unit_amount": 0 + } + ], + "recurring": { + "trial_period_days": 0, + "interval": "string", + "usage_type": "string", + "interval_count": 0, + "aggregate_usage": "string" + }, + "unit_amount_decimal": "string", + "price_nickname": "string", + "currency": "string", + "billing_scheme": "string", + "unit_amount": 0, + "created": 0, + "active": true +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|tiers_mode|string|false|none|none| +|transform_quantity|[StripeTransformQuantity](#schemastripetransformquantity)|false|none|none| +|price_id|string|true|none|none| +|tiers|[[StripeTier](#schemastripetier)]|false|none|none| +|recurring|[StripeRecurring](#schemastriperecurring)|false|none|none| +|unit_amount_decimal|string|false|none|none| +|price_nickname|string|false|none|none| +|currency|string|false|none|none| +|billing_scheme|string|false|none|none| +|unit_amount|integer(int64)|false|none|none| +|created|integer(int64)|false|none|none| +|active|boolean|false|none|none| +

RegexCondition

@@ -23867,6 +28466,30 @@ managementAPIToken ( Scopes: delete:users ) |design|object|true|none|none| |thumbnail_url|string|false|none|none| +

RecurlyCurrencyAmount

+ + + + + + +```json +{ + "currency": "string", + "unit_amount": null, + "unit_amount_decimal": "string" +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|currency|string|true|none|none| +|unit_amount|double|false|none|none| +|unit_amount_decimal|string|false|none|none| +

MoesifTransformQuantity

@@ -23889,25 +28512,20 @@ managementAPIToken ( Scopes: delete:users ) |divide_by|integer(int64)|true|none|none| |round|string|true|none|none| -

EncryptedKeyDocument

+

StripeRecurring

- - - - + + + + ```json { - "_id": "string", - "to": "2019-08-24T14:15:22Z", - "encrypted_key": "string", - "modified_at": "2019-08-24T14:15:22Z", - "from": "2019-08-24T14:15:22Z", - "created_at": "2019-08-24T14:15:22Z", - "app_id": "string", - "type": "string", - "org_id": "string", - "month": "string" + "trial_period_days": 0, + "interval": "string", + "usage_type": "string", + "interval_count": 0, + "aggregate_usage": "string" } ``` @@ -23916,16 +28534,61 @@ managementAPIToken ( Scopes: delete:users ) |Name|Type|Required|Restrictions|Description| |---|---|---|---|---| -|_id|string|false|none|none| -|to|string(date-time)|false|none|none| -|encrypted_key|string|true|none|none| -|modified_at|string(date-time)|true|none|none| -|from|string(date-time)|false|none|none| -|created_at|string(date-time)|true|none|none| -|app_id|string|true|none|none| -|type|string|true|none|none| -|org_id|string|true|none|none| -|month|string|false|none|none| +|trial_period_days|integer(int64)|false|none|none| +|interval|string|false|none|none| +|usage_type|string|false|none|none| +|interval_count|integer(int64)|false|none|none| +|aggregate_usage|string|false|none|none| + +

DashboardUpdateItem

+ + + + + + +```json +{ + "parent": "string", + "name": "string", + "dashboard_id": "string", + "workspace_ids": [ + [ + "string" + ] + ], + "sort_order": 0.1, + "dashboard_ids": [ + "string" + ], + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + } +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|parent|string|false|none|none| +|name|string|false|none|none| +|dashboard_id|string|false|none|none| +|workspace_ids|[array]|false|none|none| +|sort_order|number(double)|false|none|none| +|dashboard_ids|[string]|false|none|none| +|policy|[PolicyItem](#schemapolicyitem)|false|none|none|

Comments

@@ -23946,8 +28609,8 @@ managementAPIToken ( Scopes: delete:users ) ], "partner_user_id": "string", "message": "string", - "created_at": "2019-08-24T14:15:22Z", - "updated_at": "2019-08-24T14:15:22Z" + "created_at": "2024-04-11T04:01:35.090Z", + "updated_at": "2024-04-11T04:01:35.090Z" } } } @@ -23960,10 +28623,10 @@ managementAPIToken ( Scopes: delete:users ) |---|---|---|---|---| |summary|[Summary](#schemasummary)|true|none|none| -

SignedTokenDTO

+

SignedToken

- + @@ -23984,20 +28647,42 @@ managementAPIToken ( Scopes: delete:users ) |token|string|true|none|none| |url|string|false|none|none| -

EncryptedKeyCreateItem

+

ChargebeeItemPrice

- - - - + + + + ```json { - "to": "2019-08-24T14:15:22Z", - "encrypted_key": "string", - "from": "2019-08-24T14:15:22Z", - "type": "string", - "month": "string" + "name": "string", + "item_id": "string", + "description": "string", + "price": 0, + "price_in_decimal": "string", + "external_name": "string", + "tiers": [ + { + "starting_unit": 0, + "ending_unit": 0, + "price": 0 + } + ], + "trial_end_action": "string", + "trial_period": 0, + "id": "string", + "status": "string", + "pricing_model": "string", + "created_at": 0, + "period_unit": "string", + "updated_at": 0, + "trial_period_unit": "string", + "item_type": "string", + "currency_code": "string", + "archived_at": 0, + "free_quantity": 0, + "period": 0 } ``` @@ -24006,11 +28691,27 @@ managementAPIToken ( Scopes: delete:users ) |Name|Type|Required|Restrictions|Description| |---|---|---|---|---| -|to|string(date-time)|false|none|none| -|encrypted_key|string|true|none|none| -|from|string(date-time)|false|none|none| -|type|string|true|none|none| -|month|string|false|none|none| +|name|string|false|none|none| +|item_id|string|false|none|none| +|description|string|false|none|none| +|price|integer(int64)|false|none|none| +|price_in_decimal|string|false|none|none| +|external_name|string|false|none|none| +|tiers|[[ChargebeeItemPriceTier](#schemachargebeeitempricetier)]|false|none|none| +|trial_end_action|string|false|none|none| +|trial_period|integer(int64)|false|none|none| +|id|string|true|none|none| +|status|string|false|none|none| +|pricing_model|string|false|none|none| +|created_at|integer(int64)|false|none|none| +|period_unit|string|false|none|none| +|updated_at|integer(int64)|false|none|none| +|trial_period_unit|string|false|none|none| +|item_type|string|false|none|none| +|currency_code|string|false|none|none| +|archived_at|integer(int64)|false|none|none| +|free_quantity|integer(int64)|false|none|none| +|period|integer(int64)|false|none|none|

MoesifPrice

@@ -24043,7 +28744,7 @@ managementAPIToken ( Scopes: delete:users ) "tax_behavior": "string", "currency": "string", "metadata": null, - "created_at": "2019-08-24T14:15:22Z", + "created_at": "2024-04-11T04:01:35.090Z", "unit": "string", "usage_aggregator": "string", "period": 0 @@ -24067,7 +28768,7 @@ managementAPIToken ( Scopes: delete:users ) |pricing_model|string|false|none|none| |tax_behavior|string|false|none|none| |currency|string|false|none|none| -|metadata|collection.immutable.map[string,string]|false|none|none| +|metadata|.map[string,string]|false|none|none| |created_at|string(date-time)|false|none|none| |unit|string|false|none|none| |usage_aggregator|string|false|none|none| @@ -24176,23 +28877,17 @@ managementAPIToken ( Scopes: delete:users ) |api_scopes|[string]|false|none|none| |original_encoded_resource|string|false|none|none| -

BillingMetricBucket

+

RecurlyAddOnPercentageTier

- - - - + + + + ```json { - "start": "2019-08-24T14:15:22Z", - "metric": 0, - "amounts": null, - "ending_balance": { - "current_balance": 0, - "pending_activity": 0, - "available_balance": 0 - } + "ending_amount": null, + "usage_percent": "string" } ``` @@ -24201,21 +28896,48 @@ managementAPIToken ( Scopes: delete:users ) |Name|Type|Required|Restrictions|Description| |---|---|---|---|---| -|start|string(date-time)|true|none|none| -|metric|number(double)|false|none|none| -|amounts|collection.immutable.map[string,scala.double]|false|none|none| -|ending_balance|[CreditBalanceMetric](#schemacreditbalancemetric)|false|none|none| +|ending_amount|double|false|none|none| +|usage_percent|string|false|none|none| + +

StripeTransformQuantity

+ + + + + -

AccessTokenDTO

+```json +{ + "divide_by": 0, + "round": "string" +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|divide_by|integer(int64)|false|none|none| +|round|string|false|none|none| - - - - +

BillingMetricBucket

+ + + + + ```json { - "app_token": "string" + "start": "2024-04-11T04:01:35.090Z", + "metric": 0.1, + "amounts": null, + "ending_balance": { + "current_balance": 0.1, + "pending_activity": 0.1, + "available_balance": 0.1 + } } ``` @@ -24224,7 +28946,10 @@ managementAPIToken ( Scopes: delete:users ) |Name|Type|Required|Restrictions|Description| |---|---|---|---|---| -|app_token|string|true|none|none| +|start|string(date-time)|true|none|none| +|metric|number(double)|false|none|none| +|amounts|.map[string,scala.double]|false|none|none| +|ending_balance|[CreditBalanceMetric](#schemacreditbalancemetric)|false|none|none|

DashboardDocument

@@ -24246,7 +28971,7 @@ managementAPIToken ( Scopes: delete:users ) "string" ] ], - "sort_order": 0, + "sort_order": 0.1, "dashboard_ids": [ "string" ], @@ -24265,7 +28990,7 @@ managementAPIToken ( Scopes: delete:users ) }, "org_id": "string", "migration": {}, - "created": "2019-08-24T14:15:22Z" + "created": "2024-04-11T04:01:35.090Z" } ``` @@ -24288,6 +29013,46 @@ managementAPIToken ( Scopes: delete:users ) |migration|object|false|none|none| |created|string(date-time)|true|none|none| +

ChargebeeItemPlan

+ + + + + + +```json +{ + "name": "string", + "item_family_id": "string", + "description": "string", + "usage_calculation": "string", + "external_name": "string", + "metered": true, + "id": "string", + "status": "string", + "unit": "string", + "updated_at": 0, + "archived_at": 0 +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|name|string|false|none|none| +|item_family_id|string|false|none|none| +|description|string|false|none|none| +|usage_calculation|string|false|none|none| +|external_name|string|false|none|none| +|metered|boolean|false|none|none| +|id|string|true|none|none| +|status|string|false|none|none| +|unit|string|false|none|none| +|updated_at|integer(int64)|false|none|none| +|archived_at|integer(int64)|false|none|none| +

CreditBalanceMetric

@@ -24297,9 +29062,9 @@ managementAPIToken ( Scopes: delete:users ) ```json { - "current_balance": 0, - "pending_activity": 0, - "available_balance": 0 + "current_balance": 0.1, + "pending_activity": 0.1, + "available_balance": 0.1 } ``` @@ -24326,10 +29091,109 @@ managementAPIToken ( Scopes: delete:users ) "mentions": [ "string" ], - "partner_user_id": "string", - "message": "string", - "created_at": "2019-08-24T14:15:22Z", - "updated_at": "2019-08-24T14:15:22Z" + "partner_user_id": "string", + "message": "string", + "created_at": "2024-04-11T04:01:35.090Z", + "updated_at": "2024-04-11T04:01:35.090Z" +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|auth_user_id|string|false|none|none| +|comment_id|string|false|none|none| +|mentions|[string]|false|none|none| +|partner_user_id|string|false|none|none| +|message|string|false|none|none| +|created_at|string(date-time)|false|none|none| +|updated_at|string(date-time)|false|none|none| + +

StripeBillingParams

+ + + + + + +```json +{ + "product": { + "name": "string", + "description": "string", + "unit_label": "string", + "id": "string", + "usage_type": "string" + }, + "price": { + "tiers_mode": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "price_id": "string", + "tiers": [ + { + "flat_amount_decimal": "string", + "up_to": 0, + "unit_amount_decimal": "string", + "flat_amount": 0, + "unit_amount": 0 + } + ], + "recurring": { + "trial_period_days": 0, + "interval": "string", + "usage_type": "string", + "interval_count": 0, + "aggregate_usage": "string" + }, + "unit_amount_decimal": "string", + "price_nickname": "string", + "currency": "string", + "billing_scheme": "string", + "unit_amount": 0, + "created": 0, + "active": true + }, + "prices": [ + { + "tiers_mode": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "price_id": "string", + "tiers": [ + { + "flat_amount_decimal": "string", + "up_to": 0, + "unit_amount_decimal": "string", + "flat_amount": 0, + "unit_amount": 0 + } + ], + "recurring": { + "trial_period_days": 0, + "interval": "string", + "usage_type": "string", + "interval_count": 0, + "aggregate_usage": "string" + }, + "unit_amount_decimal": "string", + "price_nickname": "string", + "currency": "string", + "billing_scheme": "string", + "unit_amount": 0, + "created": 0, + "active": true + } + ], + "reporting": { + "reporting_period": "string" + } } ``` @@ -24338,13 +29202,10 @@ managementAPIToken ( Scopes: delete:users ) |Name|Type|Required|Restrictions|Description| |---|---|---|---|---| -|auth_user_id|string|false|none|none| -|comment_id|string|false|none|none| -|mentions|[string]|false|none|none| -|partner_user_id|string|false|none|none| -|message|string|false|none|none| -|created_at|string(date-time)|false|none|none| -|updated_at|string(date-time)|false|none|none| +|product|[StripeProduct](#schemastripeproduct)|false|none|none| +|price|[StripePrice](#schemastripeprice)|false|none|none| +|prices|[[StripePrice](#schemastripeprice)]|false|none|none| +|reporting|[ProviderReporting](#schemaproviderreporting)|false|none|none|

TemplateContent

@@ -24402,6 +29263,148 @@ managementAPIToken ( Scopes: delete:users ) |aggregator|terms| |aggregator|sum| +

BillingReportBalanceTransCreate

+ + + + + + +```json +{ + "company_id": "string", + "description": "string", + "expire_at": "2024-04-11T04:01:35.090Z", + "active_at": "2024-04-11T04:01:35.090Z", + "amount": 0.1, + "transaction_id": "string", + "subscription_id": "string", + "type": "string" +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|company_id|string|true|none|none| +|description|string|false|none|none| +|expire_at|string(date-time)|false|none|none| +|active_at|string(date-time)|false|none|none| +|amount|number(double)|true|none|none| +|transaction_id|string|true|none|none| +|subscription_id|string|true|none|none| +|type|string|true|none|none| + +

WorkspaceCreateItem

+ + + + + + +```json +{ + "name": "string", + "is_default": true, + "view_count": 0, + "dashboard": {}, + "colors": {}, + "drawings": [ + { + "name": "string", + "direction": "string", + "id": "string", + "type": "string", + "value": 0.1 + } + ], + "chart": { + "original_encoded_view_elements": "string", + "funnel_query": {}, + "url_query": "string", + "to": "string", + "view_elements": {}, + "from": "string", + "original_encoded_funnel_query": "string", + "es_query": {}, + "args": "string", + "original_encoded_query": "string", + "time_zone": "string", + "view": "string" + }, + "template": { + "dynamic_fields": [ + "string" + ], + "dynamic_time": true + }, + "type": "string", + "width": 0.1, + "sort_order": 0.1, + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + } +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|name|string|true|none|none| +|is_default|boolean|false|none|none| +|view_count|integer(int32)|false|none|none| +|dashboard|object|false|none|none| +|colors|object|false|none|none| +|drawings|[[DrawingItem](#schemadrawingitem)]|false|none|none| +|chart|[ChartItem](#schemachartitem)|true|none|none| +|template|[TemplateItem](#schematemplateitem)|false|none|none| +|type|string|false|none|none| +|width|number(double)|false|none|none| +|sort_order|number(double)|false|none|none| +|policy|[PolicyItem](#schemapolicyitem)|true|none|none| + +

RecurlyAddOnTier

+ + + + + + +```json +{ + "ending_quantity": 0, + "currencies": [ + { + "currency": "string", + "unit_amount": null, + "unit_amount_decimal": "string" + } + ] +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|ending_quantity|integer(int64)|false|none|none| +|currencies|[[RecurlyCurrencyAmount](#schemarecurlycurrencyamount)]|true|none|none| +

CreditBalance

@@ -24412,9 +29415,9 @@ managementAPIToken ( Scopes: delete:users ) ```json { "sequence_id": 0, - "current_balance": 0, - "pending_activity": 0, - "available_balance": 0 + "current_balance": 0.1, + "pending_activity": 0.1, + "available_balance": 0.1 } ``` @@ -24428,6 +29431,30 @@ managementAPIToken ( Scopes: delete:users ) |pending_activity|number(double)|true|none|none| |available_balance|number(double)|true|none|none| +

ChargebeeItemPriceTier

+ + + + + + +```json +{ + "starting_unit": 0, + "ending_unit": 0, + "price": 0 +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|starting_unit|integer(int32)|true|none|none| +|ending_unit|integer(int32)|false|none|none| +|price|integer(int32)|true|none|none| +

MoesifPlan

@@ -24462,7 +29489,7 @@ managementAPIToken ( Scopes: delete:users ) "tax_behavior": "string", "currency": "string", "metadata": null, - "created_at": "2019-08-24T14:15:22Z", + "created_at": "2024-04-11T04:01:35.090Z", "unit": "string", "usage_aggregator": "string", "period": 0 @@ -24474,9 +29501,9 @@ managementAPIToken ( Scopes: delete:users ) "status": "string", "product_id": "string", "metadata": null, - "created_at": "2019-08-24T14:15:22Z", + "created_at": "2024-04-11T04:01:35.090Z", "unit": "string", - "updated_at": "2019-08-24T14:15:22Z" + "updated_at": "2024-04-11T04:01:35.090Z" } ``` @@ -24492,11 +29519,109 @@ managementAPIToken ( Scopes: delete:users ) |id|string|false|none|none| |status|string|false|none|none| |product_id|string|false|none|none| -|metadata|collection.immutable.map[string,string]|false|none|none| +|metadata|.map[string,string]|false|none|none| |created_at|string(date-time)|false|none|none| |unit|string|false|none|none| |updated_at|string(date-time)|false|none|none| +

ChargebeeBillingParams

+ + + + + + +```json +{ + "item_plan": { + "name": "string", + "item_family_id": "string", + "description": "string", + "usage_calculation": "string", + "external_name": "string", + "metered": true, + "id": "string", + "status": "string", + "unit": "string", + "updated_at": 0, + "archived_at": 0 + }, + "item_price": { + "name": "string", + "item_id": "string", + "description": "string", + "price": 0, + "price_in_decimal": "string", + "external_name": "string", + "tiers": [ + { + "starting_unit": 0, + "ending_unit": 0, + "price": 0 + } + ], + "trial_end_action": "string", + "trial_period": 0, + "id": "string", + "status": "string", + "pricing_model": "string", + "created_at": 0, + "period_unit": "string", + "updated_at": 0, + "trial_period_unit": "string", + "item_type": "string", + "currency_code": "string", + "archived_at": 0, + "free_quantity": 0, + "period": 0 + }, + "item_prices": [ + { + "name": "string", + "item_id": "string", + "description": "string", + "price": 0, + "price_in_decimal": "string", + "external_name": "string", + "tiers": [ + { + "starting_unit": 0, + "ending_unit": 0, + "price": 0 + } + ], + "trial_end_action": "string", + "trial_period": 0, + "id": "string", + "status": "string", + "pricing_model": "string", + "created_at": 0, + "period_unit": "string", + "updated_at": 0, + "trial_period_unit": "string", + "item_type": "string", + "currency_code": "string", + "archived_at": 0, + "free_quantity": 0, + "period": 0 + } + ], + "reporting": { + "reporting_period": "string" + } +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|item_plan|[ChargebeeItemPlan](#schemachargebeeitemplan)|false|none|none| +|item_price|[ChargebeeItemPrice](#schemachargebeeitemprice)|false|none|none| +|item_prices|[[ChargebeeItemPrice](#schemachargebeeitemprice)]|false|none|none| +|reporting|[ProviderReporting](#schemaproviderreporting)|false|none|none| +

GovernanceRuleCreateItem

@@ -24571,6 +29696,85 @@ managementAPIToken ( Scopes: delete:users ) |plans|[[Plan](#schemaplan)]|false|none|none| |type|string|true|none|none| +

RecurlyPlanAddOn

+ + + + + + +```json +{ + "name": "string", + "currencies": [ + { + "currency": "string", + "unit_amount": null, + "unit_amount_decimal": "string" + } + ], + "usage_percentage": null, + "add_on_type": "string", + "external_sku": "string", + "state": "string", + "tiers": [ + { + "ending_quantity": 0, + "currencies": [ + { + "currency": "string", + "unit_amount": null, + "unit_amount_decimal": "string" + } + ] + } + ], + "tier_type": "string", + "code": "string", + "plan_id": "string", + "id": "string", + "percentage_tiers": [ + { + "tiers": [ + { + "ending_amount": null, + "usage_percent": "string" + } + ], + "currency": "string" + } + ], + "usage_type": "string", + "created_at": "string", + "usage_calculation_type": "string", + "updated_at": "string", + "deleted_at": "string" +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|name|string|false|none|none| +|currencies|[[RecurlyCurrencyAmount](#schemarecurlycurrencyamount)]|false|none|none| +|usage_percentage|double|false|none|none| +|add_on_type|string|false|none|none| +|external_sku|string|false|none|none| +|state|string|false|none|none| +|tiers|[[RecurlyAddOnTier](#schemarecurlyaddontier)]|false|none|none| +|tier_type|string|false|none|none| +|code|string|true|none|none| +|plan_id|string|false|none|none| +|id|string|false|none|none| +|percentage_tiers|[[RecurlyAddOnPercentageTiers](#schemarecurlyaddonpercentagetiers)]|false|none|none| +|usage_type|string|false|none|none| +|created_at|string|false|none|none| +|usage_calculation_type|string|false|none|none| +|updated_at|string|false|none|none| +|deleted_at|string|false|none|none| +

DrawingItem

@@ -24584,7 +29788,7 @@ managementAPIToken ( Scopes: delete:users ) "direction": "string", "id": "string", "type": "string", - "value": 0 + "value": 0.1 } ``` @@ -24641,6 +29845,55 @@ managementAPIToken ( Scopes: delete:users ) |time_zone|string|false|none|none| |view|string|true|none|none| +

RecurlyAddOnPercentageTiers

+ + + + + + +```json +{ + "tiers": [ + { + "ending_amount": null, + "usage_percent": "string" + } + ], + "currency": "string" +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|tiers|[[RecurlyAddOnPercentageTier](#schemarecurlyaddonpercentagetier)]|false|none|none| +|currency|string|false|none|none| + +

CustomReporting

+ + + + + + +```json +{ + "report_when": [ + "string" + ] +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|report_when|[string]|true|none|none| +

BillingReport

@@ -24652,35 +29905,35 @@ managementAPIToken ( Scopes: delete:users ) { "ending_balance": { "sequence_id": 0, - "current_balance": 0, - "pending_activity": 0, - "available_balance": 0 + "current_balance": 0.1, + "pending_activity": 0.1, + "available_balance": 0.1 }, "company_id": "string", "success": true, "provider": "string", "report_version": 0, - "usage_end_time": "2019-08-24T14:15:22Z", + "usage_end_time": "2024-04-11T04:01:35.090Z", "usage": { "invoice": { - "period_start": "2019-08-24T14:15:22Z", - "period_end": "2019-08-24T14:15:22Z", + "period_start": "2024-04-11T04:01:35.090Z", + "period_end": "2024-04-11T04:01:35.090Z", "id": "string" }, "aggregator": "string" }, "_id": "string", "meter_usage": 0, - "last_success_time": "2019-08-24T14:15:22Z", + "last_success_time": "2024-04-11T04:01:35.090Z", "beginning_balance": { "sequence_id": 0, - "current_balance": 0, - "pending_activity": 0, - "available_balance": 0 + "current_balance": 0.1, + "pending_activity": 0.1, + "available_balance": 0.1 }, "billing_meter_id": "string", - "amount": 0, - "usage_start_time": "2019-08-24T14:15:22Z", + "amount": 0.1, + "usage_start_time": "2024-04-11T04:01:35.090Z", "status": "string", "provider_requests": [ { @@ -24689,7 +29942,7 @@ managementAPIToken ( Scopes: delete:users ) "job_id": "string", "error_message": "string", "error_code": "string", - "request_time": "2019-08-24T14:15:22Z" + "request_time": "2024-04-11T04:01:35.090Z" } ], "currency": "string", @@ -24705,24 +29958,24 @@ managementAPIToken ( Scopes: delete:users ) "job_id": "string", "error_message": "string", "error_code": "string", - "request_time": "2019-08-24T14:15:22Z" + "request_time": "2024-04-11T04:01:35.090Z" } ] } ], - "created_at": "2019-08-24T14:15:22Z", + "created_at": "2024-04-11T04:01:35.090Z", "app_id": "string", "subscription_id": "string", - "subscription_period_start": "2019-08-24T14:15:22Z", + "subscription_period_start": "2024-04-11T04:01:35.090Z", "balance_changes": [ { - "amount": 0 + "amount": 0.1 } ], "type": "string", - "updated_at": "2019-08-24T14:15:22Z", + "updated_at": "2024-04-11T04:01:35.090Z", "org_id": "string", - "subscription_period_end": "2019-08-24T14:15:22Z", + "subscription_period_end": "2024-04-11T04:01:35.090Z", "meter_metric": 0 } @@ -24784,6 +30037,32 @@ managementAPIToken ( Scopes: delete:users ) |grantee|string|true|none|none| |permission|string|true|none|none| +

ZuoraBillingParams

+ + + + + + +```json +{ + "plan_id": "string", + "price_id": "string", + "price_ids": [ + "string" + ] +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|plan_id|string|false|none|none| +|price_id|string|false|none|none| +|price_ids|[string]|false|none|none| +

CohortConfig

@@ -24883,7 +30162,7 @@ managementAPIToken ( Scopes: delete:users ) "job_id": "string", "error_message": "string", "error_code": "string", - "request_time": "2019-08-24T14:15:22Z" + "request_time": "2024-04-11T04:01:35.090Z" } ] } @@ -24923,15 +30202,15 @@ managementAPIToken ( Scopes: delete:users ) "url": "string", "params": [ { - "key": "string", - "val": "string" + "key": null, + "val": null } ], "verb": "string", "headers": [ { - "key": "string", - "val": "string" + "key": null, + "val": null } ] } @@ -24943,7 +30222,7 @@ managementAPIToken ( Scopes: delete:users ) "direction": "string", "id": "string", "type": "string", - "value": 0 + "value": 0.1 } ], "chart": { @@ -24968,8 +30247,8 @@ managementAPIToken ( Scopes: delete:users ) }, "app_id": "string", "type": "string", - "width": 0, - "sort_order": 0, + "width": 0.1, + "sort_order": 0.1, "policy": { "acl": [ { @@ -24985,7 +30264,7 @@ managementAPIToken ( Scopes: delete:users ) }, "org_id": "string", "migration": {}, - "created": "2019-08-24T14:15:22Z", + "created": "2024-04-11T04:01:35.090Z", "comments": { "summary": { "count": 0, @@ -24997,8 +30276,8 @@ managementAPIToken ( Scopes: delete:users ) ], "partner_user_id": "string", "message": "string", - "created_at": "2019-08-24T14:15:22Z", - "updated_at": "2019-08-24T14:15:22Z" + "created_at": "2024-04-11T04:01:35.090Z", + "updated_at": "2024-04-11T04:01:35.090Z" } } } @@ -25056,6 +30335,173 @@ managementAPIToken ( Scopes: delete:users ) |unit_price_in_decimal|string|false|none|none| |flat_price_in_decimal|string|false|none|none| +

BillingMeterDocument

+ + + + + + +```json +{ + "name": "string", + "billing_plan": { + "provider_slug": "string", + "friendly_name": "string", + "params": { + "usage_rounding_mode": "string", + "webhook_params": { + "reporting": { + "report_when": null + }, + "channel_ids": [ + "string" + ], + "custom_plan": { + "plan_id": null + } + }, + "recurly_params": { + "plan": { + "name": null, + "id": null, + "code": null + }, + "add_on": { + "name": null, + "currencies": null, + "usage_percentage": null, + "add_on_type": null, + "external_sku": null, + "state": null, + "tiers": null, + "tier_type": null, + "code": null, + "plan_id": null, + "id": null, + "percentage_tiers": null, + "usage_type": null, + "created_at": null, + "usage_calculation_type": null, + "updated_at": null, + "deleted_at": null + }, + "add_ons": [ + {} + ] + }, + "chargebee_params": { + "item_plan": { + "name": null, + "item_family_id": null, + "description": null, + "usage_calculation": null, + "external_name": null, + "metered": null, + "id": null, + "status": null, + "unit": null, + "updated_at": null, + "archived_at": null + }, + "item_price": { + "name": null, + "item_id": null, + "description": null, + "price": null, + "price_in_decimal": null, + "external_name": null, + "tiers": null, + "trial_end_action": null, + "trial_period": null, + "id": null, + "status": null, + "pricing_model": null, + "created_at": null, + "period_unit": null, + "updated_at": null, + "trial_period_unit": null, + "item_type": null, + "currency_code": null, + "archived_at": null, + "free_quantity": null, + "period": null + }, + "item_prices": [ + {} + ], + "reporting": { + "reporting_period": null + } + }, + "stripe_params": { + "product": { + "name": null, + "description": null, + "unit_label": null, + "id": null, + "usage_type": null + }, + "price": { + "tiers_mode": null, + "transform_quantity": null, + "price_id": null, + "tiers": null, + "recurring": null, + "unit_amount_decimal": null, + "price_nickname": null, + "currency": null, + "billing_scheme": null, + "unit_amount": null, + "created": null, + "active": null + }, + "prices": [ + {} + ], + "reporting": { + "reporting_period": null + } + }, + "zuora_params": { + "plan_id": "string", + "price_id": "string", + "price_ids": [ + "string" + ] + }, + "usage_multiplier": null + } + }, + "url_query": "string", + "_id": "string", + "slug": "string", + "status": "string", + "modified_at": "2024-04-11T04:01:35.090Z", + "es_query": "string", + "created_at": "2024-04-11T04:01:35.090Z", + "app_id": "string", + "org_id": "string" +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|name|string|true|none|none| +|billing_plan|[BillingPlan](#schemabillingplan)|true|none|none| +|url_query|string|true|none|none| +|_id|string|false|none|none| +|slug|string|true|none|none| +|status|string|true|none|none| +|modified_at|string(date-time)|true|none|none| +|es_query|string|true|none|none| +|created_at|string(date-time)|true|none|none| +|app_id|string|true|none|none| +|org_id|string|true|none|none| +

KeyValuePair

@@ -25078,10 +30524,30 @@ managementAPIToken ( Scopes: delete:users ) |key|string|true|none|none| |val|string|true|none|none| -

AppResponseDTO

+

ProviderReporting

+ + + + + + +```json +{ + "reporting_period": "string" +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|reporting_period|string|false|none|none| + +

AppResponse

- + @@ -25212,10 +30678,347 @@ managementAPIToken ( Scopes: delete:users ) "cc": [ "string" ], - "bcc": [ + "bcc": [ + "string" + ] + } +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|name|string|false|none|none| +|state|integer(int32)|false|none|none| +|cohorts|[[Cohort](#schemacohort)]|false|none|none| +|dynamic_fields|[[DynamicField](#schemadynamicfield)]|false|none|none| +|content|[TemplateContent](#schematemplatecontent)|false|none|none| +|template|[TemplateConfig](#schematemplateconfig)|false|none|none| +|period|string|false|none|none| +|addresses|[EmailAddresses](#schemaemailaddresses)|false|none|none| + +

RecurlyPlan

+ + + + + + +```json +{ + "name": "string", + "id": "string", + "code": "string" +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|name|string|false|none|none| +|id|string|false|none|none| +|code|string|true|none|none| + +

StripeProduct

+ + + + + + +```json +{ + "name": "string", + "description": "string", + "unit_label": "string", + "id": "string", + "usage_type": "string" +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|name|string|true|none|none| +|description|string|false|none|none| +|unit_label|string|false|none|none| +|id|string|true|none|none| +|usage_type|string|false|none|none| + +

BillingParams

+ + + + + + +```json +{ + "usage_rounding_mode": "string", + "webhook_params": { + "reporting": { + "report_when": [ + "string" + ] + }, + "channel_ids": [ + "string" + ], + "custom_plan": { + "plan_id": "string" + } + }, + "recurly_params": { + "plan": { + "name": "string", + "id": "string", + "code": "string" + }, + "add_on": { + "name": "string", + "currencies": [ + { + "currency": "string", + "unit_amount": null, + "unit_amount_decimal": "string" + } + ], + "usage_percentage": null, + "add_on_type": "string", + "external_sku": "string", + "state": "string", + "tiers": [ + { + "ending_quantity": 0, + "currencies": [ + null + ] + } + ], + "tier_type": "string", + "code": "string", + "plan_id": "string", + "id": "string", + "percentage_tiers": [ + { + "tiers": [ + null + ], + "currency": "string" + } + ], + "usage_type": "string", + "created_at": "string", + "usage_calculation_type": "string", + "updated_at": "string", + "deleted_at": "string" + }, + "add_ons": [ + { + "name": "string", + "currencies": [ + { + "currency": null, + "unit_amount": null, + "unit_amount_decimal": null + } + ], + "usage_percentage": null, + "add_on_type": "string", + "external_sku": "string", + "state": "string", + "tiers": [ + { + "ending_quantity": null, + "currencies": null + } + ], + "tier_type": "string", + "code": "string", + "plan_id": "string", + "id": "string", + "percentage_tiers": [ + { + "tiers": null, + "currency": null + } + ], + "usage_type": "string", + "created_at": "string", + "usage_calculation_type": "string", + "updated_at": "string", + "deleted_at": "string" + } + ] + }, + "chargebee_params": { + "item_plan": { + "name": "string", + "item_family_id": "string", + "description": "string", + "usage_calculation": "string", + "external_name": "string", + "metered": true, + "id": "string", + "status": "string", + "unit": "string", + "updated_at": 0, + "archived_at": 0 + }, + "item_price": { + "name": "string", + "item_id": "string", + "description": "string", + "price": 0, + "price_in_decimal": "string", + "external_name": "string", + "tiers": [ + { + "starting_unit": 0, + "ending_unit": 0, + "price": 0 + } + ], + "trial_end_action": "string", + "trial_period": 0, + "id": "string", + "status": "string", + "pricing_model": "string", + "created_at": 0, + "period_unit": "string", + "updated_at": 0, + "trial_period_unit": "string", + "item_type": "string", + "currency_code": "string", + "archived_at": 0, + "free_quantity": 0, + "period": 0 + }, + "item_prices": [ + { + "name": "string", + "item_id": "string", + "description": "string", + "price": 0, + "price_in_decimal": "string", + "external_name": "string", + "tiers": [ + { + "starting_unit": null, + "ending_unit": null, + "price": null + } + ], + "trial_end_action": "string", + "trial_period": 0, + "id": "string", + "status": "string", + "pricing_model": "string", + "created_at": 0, + "period_unit": "string", + "updated_at": 0, + "trial_period_unit": "string", + "item_type": "string", + "currency_code": "string", + "archived_at": 0, + "free_quantity": 0, + "period": 0 + } + ], + "reporting": { + "reporting_period": "string" + } + }, + "stripe_params": { + "product": { + "name": "string", + "description": "string", + "unit_label": "string", + "id": "string", + "usage_type": "string" + }, + "price": { + "tiers_mode": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "price_id": "string", + "tiers": [ + { + "flat_amount_decimal": "string", + "up_to": 0, + "unit_amount_decimal": "string", + "flat_amount": 0, + "unit_amount": 0 + } + ], + "recurring": { + "trial_period_days": 0, + "interval": "string", + "usage_type": "string", + "interval_count": 0, + "aggregate_usage": "string" + }, + "unit_amount_decimal": "string", + "price_nickname": "string", + "currency": "string", + "billing_scheme": "string", + "unit_amount": 0, + "created": 0, + "active": true + }, + "prices": [ + { + "tiers_mode": "string", + "transform_quantity": { + "divide_by": 0, + "round": "string" + }, + "price_id": "string", + "tiers": [ + { + "flat_amount_decimal": null, + "up_to": null, + "unit_amount_decimal": null, + "flat_amount": null, + "unit_amount": null + } + ], + "recurring": { + "trial_period_days": 0, + "interval": "string", + "usage_type": "string", + "interval_count": 0, + "aggregate_usage": "string" + }, + "unit_amount_decimal": "string", + "price_nickname": "string", + "currency": "string", + "billing_scheme": "string", + "unit_amount": 0, + "created": 0, + "active": true + } + ], + "reporting": { + "reporting_period": "string" + } + }, + "zuora_params": { + "plan_id": "string", + "price_id": "string", + "price_ids": [ "string" ] - } + }, + "usage_multiplier": null } ``` @@ -25224,14 +31027,126 @@ managementAPIToken ( Scopes: delete:users ) |Name|Type|Required|Restrictions|Description| |---|---|---|---|---| -|name|string|false|none|none| -|state|integer(int32)|false|none|none| -|cohorts|[[Cohort](#schemacohort)]|false|none|none| -|dynamic_fields|[[DynamicField](#schemadynamicfield)]|false|none|none| -|content|[TemplateContent](#schematemplatecontent)|false|none|none| -|template|[TemplateConfig](#schematemplateconfig)|false|none|none| -|period|string|false|none|none| -|addresses|[EmailAddresses](#schemaemailaddresses)|false|none|none| +|usage_rounding_mode|string|false|none|none| +|webhook_params|[BillingWebhookParams](#schemabillingwebhookparams)|false|none|none| +|recurly_params|[RecurlyBillingParams](#schemarecurlybillingparams)|false|none|none| +|chargebee_params|[ChargebeeBillingParams](#schemachargebeebillingparams)|false|none|none| +|stripe_params|[StripeBillingParams](#schemastripebillingparams)|false|none|none| +|zuora_params|[ZuoraBillingParams](#schemazuorabillingparams)|false|none|none| +|usage_multiplier|double|false|none|none| + +

RecurlyBillingParams

+ + + + + + +```json +{ + "plan": { + "name": "string", + "id": "string", + "code": "string" + }, + "add_on": { + "name": "string", + "currencies": [ + { + "currency": "string", + "unit_amount": null, + "unit_amount_decimal": "string" + } + ], + "usage_percentage": null, + "add_on_type": "string", + "external_sku": "string", + "state": "string", + "tiers": [ + { + "ending_quantity": 0, + "currencies": [ + { + "currency": null, + "unit_amount": null, + "unit_amount_decimal": null + } + ] + } + ], + "tier_type": "string", + "code": "string", + "plan_id": "string", + "id": "string", + "percentage_tiers": [ + { + "tiers": [ + { + "ending_amount": null, + "usage_percent": null + } + ], + "currency": "string" + } + ], + "usage_type": "string", + "created_at": "string", + "usage_calculation_type": "string", + "updated_at": "string", + "deleted_at": "string" + }, + "add_ons": [ + { + "name": "string", + "currencies": [ + { + "currency": "string", + "unit_amount": null, + "unit_amount_decimal": "string" + } + ], + "usage_percentage": null, + "add_on_type": "string", + "external_sku": "string", + "state": "string", + "tiers": [ + { + "ending_quantity": 0, + "currencies": [ + {} + ] + } + ], + "tier_type": "string", + "code": "string", + "plan_id": "string", + "id": "string", + "percentage_tiers": [ + { + "tiers": [ + {} + ], + "currency": "string" + } + ], + "usage_type": "string", + "created_at": "string", + "usage_calculation_type": "string", + "updated_at": "string", + "deleted_at": "string" + } + ] +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|plan|[RecurlyPlan](#schemarecurlyplan)|false|none|none| +|add_on|[RecurlyPlanAddOn](#schemarecurlyplanaddon)|false|none|none| +|add_ons|[[RecurlyPlanAddOn](#schemarecurlyplanaddon)]|false|none|none|

GovernanceRulesDocument

@@ -25276,7 +31191,7 @@ managementAPIToken ( Scopes: delete:users ) "sample_rate": 0 } ], - "created_at": "2019-08-24T14:15:22Z", + "created_at": "2024-04-11T04:01:35.090Z", "app_id": "string", "plans": [ { @@ -25315,6 +31230,237 @@ managementAPIToken ( Scopes: delete:users ) |type|string|true|none|none| |org_id|string|true|none|none| +

BillingPlan

+ + + + + + +```json +{ + "provider_slug": "string", + "friendly_name": "string", + "params": { + "usage_rounding_mode": "string", + "webhook_params": { + "reporting": { + "report_when": [ + "string" + ] + }, + "channel_ids": [ + "string" + ], + "custom_plan": { + "plan_id": "string" + } + }, + "recurly_params": { + "plan": { + "name": "string", + "id": "string", + "code": "string" + }, + "add_on": { + "name": "string", + "currencies": [ + {} + ], + "usage_percentage": null, + "add_on_type": "string", + "external_sku": "string", + "state": "string", + "tiers": [ + {} + ], + "tier_type": "string", + "code": "string", + "plan_id": "string", + "id": "string", + "percentage_tiers": [ + {} + ], + "usage_type": "string", + "created_at": "string", + "usage_calculation_type": "string", + "updated_at": "string", + "deleted_at": "string" + }, + "add_ons": [ + { + "name": "string", + "currencies": [ + null + ], + "usage_percentage": null, + "add_on_type": "string", + "external_sku": "string", + "state": "string", + "tiers": [ + null + ], + "tier_type": "string", + "code": "string", + "plan_id": "string", + "id": "string", + "percentage_tiers": [ + null + ], + "usage_type": "string", + "created_at": "string", + "usage_calculation_type": "string", + "updated_at": "string", + "deleted_at": "string" + } + ] + }, + "chargebee_params": { + "item_plan": { + "name": "string", + "item_family_id": "string", + "description": "string", + "usage_calculation": "string", + "external_name": "string", + "metered": true, + "id": "string", + "status": "string", + "unit": "string", + "updated_at": 0, + "archived_at": 0 + }, + "item_price": { + "name": "string", + "item_id": "string", + "description": "string", + "price": 0, + "price_in_decimal": "string", + "external_name": "string", + "tiers": [ + {} + ], + "trial_end_action": "string", + "trial_period": 0, + "id": "string", + "status": "string", + "pricing_model": "string", + "created_at": 0, + "period_unit": "string", + "updated_at": 0, + "trial_period_unit": "string", + "item_type": "string", + "currency_code": "string", + "archived_at": 0, + "free_quantity": 0, + "period": 0 + }, + "item_prices": [ + { + "name": "string", + "item_id": "string", + "description": "string", + "price": 0, + "price_in_decimal": "string", + "external_name": "string", + "tiers": [ + null + ], + "trial_end_action": "string", + "trial_period": 0, + "id": "string", + "status": "string", + "pricing_model": "string", + "created_at": 0, + "period_unit": "string", + "updated_at": 0, + "trial_period_unit": "string", + "item_type": "string", + "currency_code": "string", + "archived_at": 0, + "free_quantity": 0, + "period": 0 + } + ], + "reporting": { + "reporting_period": "string" + } + }, + "stripe_params": { + "product": { + "name": "string", + "description": "string", + "unit_label": "string", + "id": "string", + "usage_type": "string" + }, + "price": { + "tiers_mode": "string", + "transform_quantity": { + "divide_by": null, + "round": null + }, + "price_id": "string", + "tiers": [ + {} + ], + "recurring": { + "trial_period_days": null, + "interval": null, + "usage_type": null, + "interval_count": null, + "aggregate_usage": null + }, + "unit_amount_decimal": "string", + "price_nickname": "string", + "currency": "string", + "billing_scheme": "string", + "unit_amount": 0, + "created": 0, + "active": true + }, + "prices": [ + { + "tiers_mode": "string", + "transform_quantity": {}, + "price_id": "string", + "tiers": [ + null + ], + "recurring": {}, + "unit_amount_decimal": "string", + "price_nickname": "string", + "currency": "string", + "billing_scheme": "string", + "unit_amount": 0, + "created": 0, + "active": true + } + ], + "reporting": { + "reporting_period": "string" + } + }, + "zuora_params": { + "plan_id": "string", + "price_id": "string", + "price_ids": [ + "string" + ] + }, + "usage_multiplier": null + } +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|provider_slug|string|true|none|none| +|friendly_name|string|false|none|none| +|params|[BillingParams](#schemabillingparams)|false|none|none| +

SubmitData

@@ -25367,7 +31513,7 @@ managementAPIToken ( Scopes: delete:users ) "job_id": "string", "error_message": "string", "error_code": "string", - "request_time": "2019-08-24T14:15:22Z" + "request_time": "2024-04-11T04:01:35.090Z" } ``` @@ -25383,6 +31529,30 @@ managementAPIToken ( Scopes: delete:users ) |error_code|string|true|none|none| |request_time|string(date-time)|true|none|none| +

CommentItem

+ + + + + + +```json +{ + "message": "string", + "mentions": [ + "string" + ] +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|message|string|false|none|none| +|mentions|[string]|false|none|none| +

NotificationRule

@@ -25453,8 +31623,8 @@ managementAPIToken ( Scopes: delete:users ) ], "partner_user_id": "string", "message": "string", - "created_at": "2019-08-24T14:15:22Z", - "updated_at": "2019-08-24T14:15:22Z" + "created_at": "2024-04-11T04:01:35.090Z", + "updated_at": "2024-04-11T04:01:35.090Z" } } @@ -25541,10 +31711,114 @@ managementAPIToken ( Scopes: delete:users ) |plans|[[Plan](#schemaplan)]|false|none|none| |type|string|false|none|none| -

searchUsersResponseDTO

+

WorkspaceUpdateItem

+ + + + + + +```json +{ + "name": "string", + "colors": {}, + "drawings": [ + { + "name": "string", + "direction": "string", + "id": "string", + "type": "string", + "value": 0.1 + } + ], + "chart": { + "original_encoded_view_elements": "string", + "funnel_query": {}, + "url_query": "string", + "to": "string", + "view_elements": {}, + "from": "string", + "original_encoded_funnel_query": "string", + "es_query": {}, + "args": "string", + "original_encoded_query": "string", + "time_zone": "string", + "view": "string" + }, + "template": { + "dynamic_fields": [ + "string" + ], + "dynamic_time": true + }, + "width": 0.1, + "sort_order": 0.1, + "policy": { + "acl": [ + { + "grantee": "string", + "permission": "string" + } + ], + "resource": {}, + "api_scopes": [ + "string" + ], + "original_encoded_resource": "string" + } +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|name|string|false|none|none| +|colors|object|false|none|none| +|drawings|[[DrawingItem](#schemadrawingitem)]|false|none|none| +|chart|[ChartItem](#schemachartitem)|false|none|none| +|template|[TemplateItem](#schematemplateitem)|false|none|none| +|width|number(double)|false|none|none| +|sort_order|number(double)|false|none|none| +|policy|[PolicyItem](#schemapolicyitem)|false|none|none| + +

BillingWebhookParams

+ + + + + + +```json +{ + "reporting": { + "report_when": [ + "string" + ] + }, + "channel_ids": [ + "string" + ], + "custom_plan": { + "plan_id": "string" + } +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|reporting|[CustomReporting](#schemacustomreporting)|false|none|none| +|channel_ids|[string]|true|none|none| +|custom_plan|[CustomReportPlan](#schemacustomreportplan)|true|none|none| + +

searchUsersResponse

- + @@ -25558,49 +31832,22 @@ managementAPIToken ( Scopes: delete:users ) { "_id": "123456", "_source": { - "first_name": "John", + "first_name": "[", "body": {}, - "name": "John Doe", - "email": "john.doe@gmail.com", - "first_seen_time": "2023-07-27T21:52:58.0990000Z", - "user_agent": { - "name": "Android", - "os_major": "7", - "os": "Android 7.0", - "os_name": "Android", - "os_minor": "0", - "major": "7", - "device": "Samsung SM-G955U", - "minor": "0" - }, - "geo_ip": { - "ip": "107.200.85.196", - "region_name": "South Carolina", - "continent_code": "NA", - "location": { - "lon": -79.85489654541016, - "lat": 32.822898864746094 - }, - "latitude": 32.822898864746094, - "timezone": "America/New_York", - "longitude": -79.85489654541016, - "dma_code": 519, - "postal_code": "29464", - "region_code": "SC", - "city_name": "Mt. Pleasant", - "country_code2": "US", - "country_code3": "US", - "country_name": "United States" - }, - "modified_time": "2023-07-27T21:55:19.464", - "last_name": "Doe", - "ip_address": "107.200.85.196", + "name": "[", + "email": "[", + "first_seen_time": "[", + "user_agent": {}, + "geo_ip": {}, + "modified_time": "[", + "last_name": "[", + "ip_address": "[", "session_token": [ - "e93u2jiry8fij8q09-tfZ9SIK9DERDXUYMF" + null ], - "last_seen_time": "2023-07-27T21:52:58.0990000Z", - "app_id": "198:3", - "org_id": "177:3" + "last_seen_time": "[", + "app_id": "[", + "org_id": "[" }, "sort": [ 1519768519464 @@ -25620,20 +31867,20 @@ managementAPIToken ( Scopes: delete:users ) |timed_out|boolean|false|none|none| |hits|object|false|none|none| |» total|integer|false|none|none| -|» hits|[[userResponseDTO](#schemauserresponsedto)]|false|none|none| +|» hits|[[userResponse](#schemauserresponsedto)]|false|none|none| -

SubscriptionDTO

+

Subscription

- + ```json { - "trial_start": "2019-08-24T14:15:22Z", + "trial_start": "2024-04-11T04:01:35.090Z", "company_id": "string", - "start_date": "2019-08-24T14:15:22Z", + "start_date": "2024-04-11T04:01:35.090Z", "collection_method": "string", "provider": "string", "items": [ @@ -25647,22 +31894,22 @@ managementAPIToken ( Scopes: delete:users ) "subscription_item_id": "string" } ], - "current_period_start": "2019-08-24T14:15:22Z", + "current_period_start": "2024-04-11T04:01:35.090Z", "company_external_id": "string", "payment_status": "string", - "modified_time": "2019-08-24T14:15:22Z", - "cancel_time": "2019-08-24T14:15:22Z", + "modified_time": "2024-04-11T04:01:35.090Z", + "cancel_time": "2024-04-11T04:01:35.090Z", "status": "string", - "trial_end": "2019-08-24T14:15:22Z", + "trial_end": "2024-04-11T04:01:35.090Z", "external_id": "string", "metadata": {}, "app_id": "string", "subscription_id": "string", "version_id": "string", "type": "string", - "current_period_end": "2019-08-24T14:15:22Z", + "current_period_end": "2024-04-11T04:01:35.090Z", "org_id": "string", - "created": "2019-08-24T14:15:22Z" + "created": "2024-04-11T04:01:35.090Z" } ``` @@ -25694,10 +31941,10 @@ managementAPIToken ( Scopes: delete:users ) |org_id|string|true|none|none| |created|string(date-time)|false|none|none| -

searchEventsResponseDTO

+

searchEventsResponse

- + @@ -25711,57 +31958,18 @@ managementAPIToken ( Scopes: delete:users ) { "_id": "AWF5M-FDTqLFD8l5y2f4", "_source": { - "company_id": "67890", - "duration_ms": 76, - "request": { - "body": "json", - "uri": "https://api.github.com", - "user_agent": { - "patch": "1", - "major": "7", - "minor": "1", - "name": "PostmanRuntime" - }, - "geo_ip": { - "ip": "73.189.235.253", - "region_name": "CA", - "continent_code": "NA", - "location": [ - -122.393 - ], - "latitude": 37.769, - "timezone": "America/Los_Angeles", - "area_code": 415, - "longitude": -122.393, - "real_region_name": "California", - "dma_code": 807, - "postal_code": "94107", - "city_name": "San Francisco", - "country_code2": "US", - "country_code3": "USA", - "country_name": "United States" - }, - "ip_address": "73.189.235.253", - "verb": "GET", - "route": "/", - "time": "2023-07-09T06:14:58.550", - "headers": {} - }, - "user_id": "123454", + "company_id": "[", + "duration_ms": "[", + "request": {}, + "user_id": "[", "company": {}, - "response": { - "body": {}, - "transfer_encoding": "json", - "status": 200, - "time": "2023-07-09T06:14:58.626", - "headers": {} - }, - "id": "AWF5M-FDTqLFD8l5y2f4", - "event_type": "api_call", - "session_token": "rdfmnw3fu24309efjc534nb421UZ9-]2JDO[ME", + "response": {}, + "id": "[", + "event_type": "[", + "session_token": "[", "metadata": {}, - "app_id": "198:3", - "org_id": "177:3", + "app_id": "[", + "org_id": "[", "user": {} }, "sort": [ @@ -25782,12 +31990,12 @@ managementAPIToken ( Scopes: delete:users ) |timed_out|boolean|false|none|none| |hits|object|false|none|none| |» total|integer|false|none|none| -|» hits|[[eventResponseDTO](#schemaeventresponsedto)]|false|none|none| +|» hits|[[eventResponse](#schemaeventresponsedto)]|false|none|none| -

searchcompanysResponseDTO

+

searchcompanysResponse

- + @@ -25811,12 +32019,12 @@ managementAPIToken ( Scopes: delete:users ) |timed_out|boolean|false|none|none| |hits|object|false|none|none| |» total|integer|false|none|none| -|» hits|[[companyResponseDTO](#schemacompanyresponsedto)]|false|none|none| +|» hits|[[companyResponse](#schemacompanyresponsedto)]|false|none|none| -

UserUpdateDTO

+

UserUpdate

- + @@ -25828,9 +32036,8 @@ managementAPIToken ( Scopes: delete:users ) "email": "string", "photo_url": "string", "user_id": "string", - "modified_time": "2019-08-24T14:15:22Z", + "modified_time": "2024-04-11T04:01:35.090Z", "last_name": "string", - "session_token": {}, "metadata": {}, "user_name": "string", "phone": "string" @@ -25850,7 +32057,6 @@ managementAPIToken ( Scopes: delete:users ) |user_id|string|true|none|none| |modified_time|string(date-time)|false|none|none| |last_name|string|false|none|none| -|session_token|object|false|none|none| |metadata|object|false|none|none| |user_name|string|false|none|none| |phone|string|false|none|none| @@ -25887,10 +32093,10 @@ managementAPIToken ( Scopes: delete:users ) |status|string|false|none|none| |subscription_item_id|string|false|none|none| -

userResponseDTO

+

userResponse

- + @@ -25995,10 +32201,10 @@ managementAPIToken ( Scopes: delete:users ) |» org_id|string|false|none|none| |sort|[integer]|false|none|none| -

eventResponseDTO

+

eventResponse

- + @@ -26022,7 +32228,7 @@ managementAPIToken ( Scopes: delete:users ) "region_name": "CA", "continent_code": "NA", "location": [ - -122.393 + "[" ], "latitude": 37.769, "timezone": "America/Los_Angeles", @@ -26120,18 +32326,18 @@ managementAPIToken ( Scopes: delete:users ) |» user|object|false|none|none| |sort|[integer]|false|none|none| -

AddSubscriptionDTO

+

AddSubscription

- + ```json { - "trial_start": "2019-08-24T14:15:22Z", + "trial_start": "2024-04-11T04:01:35.090Z", "company_id": "string", - "start_date": "2019-08-24T14:15:22Z", + "start_date": "2024-04-11T04:01:35.090Z", "collection_method": "string", "provider": "string", "items": [ @@ -26145,18 +32351,18 @@ managementAPIToken ( Scopes: delete:users ) "subscription_item_id": "string" } ], - "current_period_start": "2019-08-24T14:15:22Z", + "current_period_start": "2024-04-11T04:01:35.090Z", "company_external_id": "string", "payment_status": "string", - "cancel_time": "2019-08-24T14:15:22Z", + "cancel_time": "2024-04-11T04:01:35.090Z", "status": "string", - "trial_end": "2019-08-24T14:15:22Z", + "trial_end": "2024-04-11T04:01:35.090Z", "external_id": "string", "metadata": {}, "subscription_id": "string", "version_id": "string", - "current_period_end": "2019-08-24T14:15:22Z", - "created": "2019-08-24T14:15:22Z" + "current_period_end": "2024-04-11T04:01:35.090Z", + "created": "2024-04-11T04:01:35.090Z" } ``` @@ -26184,17 +32390,17 @@ managementAPIToken ( Scopes: delete:users ) |current_period_end|string(date-time)|false|none|none| |created|string(date-time)|false|none|none| -

CompanyUpdateDTO

+

CompanyUpdate

- + ```json { "company_id": "string", - "modified_time": "2019-08-24T14:15:22Z", + "modified_time": "2024-04-11T04:01:35.090Z", "session_token": "string", "company_domain": "string", "metadata": {} diff --git a/source/index.html.md b/source/index.html.md index 400cc30..f51e9f5 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -38,7 +38,7 @@ code_clipboard: true # Moesif API Reference -Moesif is an API analytics and monetization service to grow your API products. With Moesif, you can quickly get started with API Observability, API monetization and usage-based billing. +Moesif is an API analytics and monetization service to grow your API products. With Moesif, you can quickly get started with API observability, API monetization and usage-based billing. With Moesif, you cam This reference is for v1 of the Moesif APIs. For an overview on the Moesif platform, see the [developer docs](/docs) or [implementation guides](https://www.moesif.com/implementation) diff --git a/source/openapi/management-api.json b/source/openapi/management-api.json index 1ef9048..4000c00 100644 --- a/source/openapi/management-api.json +++ b/source/openapi/management-api.json @@ -55,6 +55,28 @@ } }, "schemas": { + "StripeTier": { + "properties": { + "flat_amount_decimal": { + "type": "string" + }, + "up_to": { + "type": "integer", + "format": "int64" + }, + "unit_amount_decimal": { + "type": "string" + }, + "flat_amount": { + "type": "integer", + "format": "int64" + }, + "unit_amount": { + "type": "integer", + "format": "int64" + } + } + }, "CohortDocument": { "properties": { "channels": { @@ -149,23 +171,14 @@ "name": { "type": "string" }, - "custom_app_id": { - "type": "string" - }, - "search_api_base_url": { + "time_zone": { "type": "string" }, "week_starts_on": { "type": "integer", "format": "int32" }, - "portal_api_base_url": { - "type": "string" - }, - "secure_proxy": { - "type": "boolean" - }, - "time_zone": { + "custom_app_id": { "type": "string" } }, @@ -178,23 +191,14 @@ "name": { "type": "string" }, - "custom_app_id": { - "type": "string" - }, - "search_api_base_url": { + "time_zone": { "type": "string" }, "week_starts_on": { "type": "integer", "format": "int32" }, - "portal_api_base_url": { - "type": "string" - }, - "secure_proxy": { - "type": "boolean" - }, - "time_zone": { + "custom_app_id": { "type": "string" } } @@ -264,6 +268,16 @@ "criteria" ] }, + "CustomReportPlan": { + "properties": { + "plan_id": { + "type": "string" + } + }, + "required": [ + "plan_id" + ] + }, "BillingReportUsage": { "properties": { "invoice": { @@ -375,6 +389,54 @@ "amount" ] }, + "StripePrice": { + "properties": { + "tiers_mode": { + "type": "string" + }, + "transform_quantity": { + "$ref": "#/components/schemas/StripeTransformQuantity" + }, + "price_id": { + "type": "string" + }, + "tiers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/StripeTier" + } + }, + "recurring": { + "$ref": "#/components/schemas/StripeRecurring" + }, + "unit_amount_decimal": { + "type": "string" + }, + "price_nickname": { + "type": "string" + }, + "currency": { + "type": "string" + }, + "billing_scheme": { + "type": "string" + }, + "unit_amount": { + "type": "integer", + "format": "int64" + }, + "created": { + "type": "integer", + "format": "int64" + }, + "active": { + "type": "boolean" + } + }, + "required": [ + "price_id" + ] + }, "RegexCondition": { "properties": { "path": { @@ -410,6 +472,22 @@ "design" ] }, + "RecurlyCurrencyAmount": { + "properties": { + "currency": { + "type": "string" + }, + "unit_amount": { + "type": "double" + }, + "unit_amount_decimal": { + "type": "string" + } + }, + "required": [ + "currency" + ] + }, "MoesifTransformQuantity": { "properties": { "divide_by": { @@ -425,51 +503,61 @@ "round" ] }, - "EncryptedKeyDocument": { + "StripeRecurring": { "properties": { - "_id": { - "type": "string" - }, - "to": { - "type": "string", - "format": "date-time" + "trial_period_days": { + "type": "integer", + "format": "int64" }, - "encrypted_key": { + "interval": { "type": "string" }, - "modified_at": { - "type": "string", - "format": "date-time" - }, - "from": { - "type": "string", - "format": "date-time" + "usage_type": { + "type": "string" }, - "created_at": { - "type": "string", - "format": "date-time" + "interval_count": { + "type": "integer", + "format": "int64" }, - "app_id": { + "aggregate_usage": { "type": "string" - }, - "type": { + } + } + }, + "DashboardUpdateItem": { + "properties": { + "parent": { "type": "string" }, - "org_id": { + "name": { "type": "string" }, - "month": { + "dashboard_id": { "type": "string" + }, + "workspace_ids": { + "type": "array", + "items": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "sort_order": { + "type": "number", + "format": "double" + }, + "dashboard_ids": { + "type": "array", + "items": { + "type": "string" + } + }, + "policy": { + "$ref": "#/components/schemas/PolicyItem" } - }, - "required": [ - "org_id", - "app_id", - "created_at", - "modified_at", - "type", - "encrypted_key" - ] + } }, "Comments": { "properties": { @@ -498,29 +586,84 @@ "token" ] }, - "EncryptedKeyCreateItem": { + "ChargebeeItemPrice": { "properties": { - "to": { - "type": "string", - "format": "date-time" + "name": { + "type": "string" }, - "encrypted_key": { + "item_id": { "type": "string" }, - "from": { - "type": "string", - "format": "date-time" + "description": { + "type": "string" }, - "type": { + "price": { + "type": "integer", + "format": "int64" + }, + "price_in_decimal": { + "type": "string" + }, + "external_name": { + "type": "string" + }, + "tiers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ChargebeeItemPriceTier" + } + }, + "trial_end_action": { + "type": "string" + }, + "trial_period": { + "type": "integer", + "format": "int64" + }, + "id": { + "type": "string" + }, + "status": { + "type": "string" + }, + "pricing_model": { + "type": "string" + }, + "created_at": { + "type": "integer", + "format": "int64" + }, + "period_unit": { + "type": "string" + }, + "updated_at": { + "type": "integer", + "format": "int64" + }, + "trial_period_unit": { + "type": "string" + }, + "item_type": { "type": "string" }, - "month": { + "currency_code": { "type": "string" + }, + "archived_at": { + "type": "integer", + "format": "int64" + }, + "free_quantity": { + "type": "integer", + "format": "int64" + }, + "period": { + "type": "integer", + "format": "int64" } }, "required": [ - "type", - "encrypted_key" + "id" ] }, "MoesifPrice": { @@ -652,6 +795,27 @@ "resource" ] }, + "RecurlyAddOnPercentageTier": { + "properties": { + "ending_amount": { + "type": "double" + }, + "usage_percent": { + "type": "string" + } + } + }, + "StripeTransformQuantity": { + "properties": { + "divide_by": { + "type": "integer", + "format": "int64" + }, + "round": { + "type": "string" + } + } + }, "BillingMetricBucket": { "properties": { "start": { @@ -673,16 +837,6 @@ "start" ] }, - "AccessTokenDTO": { - "properties": { - "app_token": { - "type": "string" - } - }, - "required": [ - "app_token" - ] - }, "DashboardDocument": { "properties": { "parent": { @@ -746,15 +900,57 @@ "workspace_ids" ] }, - "CreditBalanceMetric": { + "ChargebeeItemPlan": { "properties": { - "current_balance": { - "type": "number", - "format": "double" + "name": { + "type": "string" }, - "pending_activity": { - "type": "number", - "format": "double" + "item_family_id": { + "type": "string" + }, + "description": { + "type": "string" + }, + "usage_calculation": { + "type": "string" + }, + "external_name": { + "type": "string" + }, + "metered": { + "type": "boolean" + }, + "id": { + "type": "string" + }, + "status": { + "type": "string" + }, + "unit": { + "type": "string" + }, + "updated_at": { + "type": "integer", + "format": "int64" + }, + "archived_at": { + "type": "integer", + "format": "int64" + } + }, + "required": [ + "id" + ] + }, + "CreditBalanceMetric": { + "properties": { + "current_balance": { + "type": "number", + "format": "double" + }, + "pending_activity": { + "type": "number", + "format": "double" }, "available_balance": { "type": "number", @@ -797,6 +993,25 @@ } } }, + "StripeBillingParams": { + "properties": { + "product": { + "$ref": "#/components/schemas/StripeProduct" + }, + "price": { + "$ref": "#/components/schemas/StripePrice" + }, + "prices": { + "type": "array", + "items": { + "$ref": "#/components/schemas/StripePrice" + } + }, + "reporting": { + "$ref": "#/components/schemas/ProviderReporting" + } + } + }, "TemplateContent": { "properties": { "html": { @@ -836,6 +1051,112 @@ "aggregator" ] }, + "BillingReportBalanceTransCreate": { + "properties": { + "company_id": { + "type": "string" + }, + "description": { + "type": "string" + }, + "expire_at": { + "type": "string", + "format": "date-time" + }, + "active_at": { + "type": "string", + "format": "date-time" + }, + "amount": { + "type": "number", + "format": "double" + }, + "transaction_id": { + "type": "string" + }, + "subscription_id": { + "type": "string" + }, + "type": { + "type": "string" + } + }, + "required": [ + "company_id", + "amount", + "type", + "subscription_id", + "transaction_id" + ] + }, + "WorkspaceCreateItem": { + "properties": { + "name": { + "type": "string" + }, + "is_default": { + "type": "boolean" + }, + "view_count": { + "type": "integer", + "format": "int32" + }, + "dashboard": { + "type": "object" + }, + "colors": { + "type": "object" + }, + "drawings": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DrawingItem" + } + }, + "chart": { + "$ref": "#/components/schemas/ChartItem" + }, + "template": { + "$ref": "#/components/schemas/TemplateItem" + }, + "type": { + "type": "string" + }, + "width": { + "type": "number", + "format": "double" + }, + "sort_order": { + "type": "number", + "format": "double" + }, + "policy": { + "$ref": "#/components/schemas/PolicyItem" + } + }, + "required": [ + "name", + "policy", + "chart" + ] + }, + "RecurlyAddOnTier": { + "properties": { + "ending_quantity": { + "type": "integer", + "format": "int64" + }, + "currencies": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RecurlyCurrencyAmount" + } + } + }, + "required": [ + "currencies" + ] + }, "CreditBalance": { "properties": { "sequence_id": { @@ -862,6 +1183,26 @@ "available_balance" ] }, + "ChargebeeItemPriceTier": { + "properties": { + "starting_unit": { + "type": "integer", + "format": "int32" + }, + "ending_unit": { + "type": "integer", + "format": "int32" + }, + "price": { + "type": "integer", + "format": "int32" + } + }, + "required": [ + "starting_unit", + "price" + ] + }, "MoesifPlan": { "properties": { "name": { @@ -904,6 +1245,25 @@ } } }, + "ChargebeeBillingParams": { + "properties": { + "item_plan": { + "$ref": "#/components/schemas/ChargebeeItemPlan" + }, + "item_price": { + "$ref": "#/components/schemas/ChargebeeItemPrice" + }, + "item_prices": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ChargebeeItemPrice" + } + }, + "reporting": { + "$ref": "#/components/schemas/ProviderReporting" + } + } + }, "GovernanceRuleCreateItem": { "properties": { "name": { @@ -967,6 +1327,73 @@ "block" ] }, + "RecurlyPlanAddOn": { + "properties": { + "name": { + "type": "string" + }, + "currencies": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RecurlyCurrencyAmount" + } + }, + "usage_percentage": { + "type": "double" + }, + "add_on_type": { + "type": "string" + }, + "external_sku": { + "type": "string" + }, + "state": { + "type": "string" + }, + "tiers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RecurlyAddOnTier" + } + }, + "tier_type": { + "type": "string" + }, + "code": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "id": { + "type": "string" + }, + "percentage_tiers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RecurlyAddOnPercentageTiers" + } + }, + "usage_type": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "usage_calculation_type": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "deleted_at": { + "type": "string" + } + }, + "required": [ + "code" + ] + }, "DrawingItem": { "properties": { "name": { @@ -1038,6 +1465,32 @@ "url_query" ] }, + "RecurlyAddOnPercentageTiers": { + "properties": { + "tiers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RecurlyAddOnPercentageTier" + } + }, + "currency": { + "type": "string" + } + } + }, + "CustomReporting": { + "properties": { + "report_when": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "report_when" + ] + }, "BillingReport": { "properties": { "ending_balance": { @@ -1179,6 +1632,22 @@ "permission" ] }, + "ZuoraBillingParams": { + "properties": { + "plan_id": { + "type": "string" + }, + "price_id": { + "type": "string" + }, + "price_ids": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "CohortConfig": { "properties": { "url_query": { @@ -1365,9 +1834,60 @@ "up_to" ] }, - "KeyValuePair": { + "BillingMeterDocument": { "properties": { - "key": { + "name": { + "type": "string" + }, + "billing_plan": { + "$ref": "#/components/schemas/BillingPlan" + }, + "url_query": { + "type": "string" + }, + "_id": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "status": { + "type": "string" + }, + "modified_at": { + "type": "string", + "format": "date-time" + }, + "es_query": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "app_id": { + "type": "string" + }, + "org_id": { + "type": "string" + } + }, + "required": [ + "org_id", + "app_id", + "slug", + "name", + "es_query", + "url_query", + "status", + "billing_plan", + "created_at", + "modified_at" + ] + }, + "KeyValuePair": { + "properties": { + "key": { "type": "string" }, "val": { @@ -1379,6 +1899,13 @@ "val" ] }, + "ProviderReporting": { + "properties": { + "reporting_period": { + "type": "string" + } + } + }, "AppResponseDTO": { "properties": { "name": { @@ -1495,6 +2022,86 @@ } } }, + "RecurlyPlan": { + "properties": { + "name": { + "type": "string" + }, + "id": { + "type": "string" + }, + "code": { + "type": "string" + } + }, + "required": [ + "code" + ] + }, + "StripeProduct": { + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "unit_label": { + "type": "string" + }, + "id": { + "type": "string" + }, + "usage_type": { + "type": "string" + } + }, + "required": [ + "name", + "id" + ] + }, + "BillingParams": { + "properties": { + "usage_rounding_mode": { + "type": "string" + }, + "webhook_params": { + "$ref": "#/components/schemas/BillingWebhookParams" + }, + "recurly_params": { + "$ref": "#/components/schemas/RecurlyBillingParams" + }, + "chargebee_params": { + "$ref": "#/components/schemas/ChargebeeBillingParams" + }, + "stripe_params": { + "$ref": "#/components/schemas/StripeBillingParams" + }, + "zuora_params": { + "$ref": "#/components/schemas/ZuoraBillingParams" + }, + "usage_multiplier": { + "type": "double" + } + } + }, + "RecurlyBillingParams": { + "properties": { + "plan": { + "$ref": "#/components/schemas/RecurlyPlan" + }, + "add_on": { + "$ref": "#/components/schemas/RecurlyPlanAddOn" + }, + "add_ons": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RecurlyPlanAddOn" + } + } + } + }, "GovernanceRulesDocument": { "properties": { "name": { @@ -1574,6 +2181,22 @@ "block" ] }, + "BillingPlan": { + "properties": { + "provider_slug": { + "type": "string" + }, + "friendly_name": { + "type": "string" + }, + "params": { + "$ref": "#/components/schemas/BillingParams" + } + }, + "required": [ + "provider_slug" + ] + }, "SubmitData": { "properties": { "body": { @@ -1635,6 +2258,19 @@ "error_message" ] }, + "CommentItem": { + "properties": { + "message": { + "type": "string" + }, + "mentions": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "NotificationRule": { "properties": { "send_on_addition": { @@ -1745,6 +2381,59 @@ } } }, + "WorkspaceUpdateItem": { + "properties": { + "name": { + "type": "string" + }, + "colors": { + "type": "object" + }, + "drawings": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DrawingItem" + } + }, + "chart": { + "$ref": "#/components/schemas/ChartItem" + }, + "template": { + "$ref": "#/components/schemas/TemplateItem" + }, + "width": { + "type": "number", + "format": "double" + }, + "sort_order": { + "type": "number", + "format": "double" + }, + "policy": { + "$ref": "#/components/schemas/PolicyItem" + } + } + }, + "BillingWebhookParams": { + "properties": { + "reporting": { + "$ref": "#/components/schemas/CustomReporting" + }, + "channel_ids": { + "type": "array", + "items": { + "type": "string" + } + }, + "custom_plan": { + "$ref": "#/components/schemas/CustomReportPlan" + } + }, + "required": [ + "channel_ids", + "custom_plan" + ] + }, "searchUsersResponseDTO": { "properties": { "took": { @@ -2317,9 +3006,6 @@ "last_name": { "type": "string" }, - "session_token": { - "type": "object" - }, "metadata": { "type": "object" }, @@ -3086,22 +3772,30 @@ }, "openapi": "3.0.0", "paths": { - "/~/governance/rules": { + "/search/~/companies": { "post": { "security": [ { "managementAPIToken": [ - "create:governance_rules" + "create:companies", + "update:companies" ] } ], "tags": [ - "Governance" - ], - "operationId": "createGovernanceRule", - "consumes": [ - "application/json" + "Companies" ], + "operationId": "updateCompanies", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CompanyUpdateDTO" + } + } + } + }, "parameters": [ { "schema": { @@ -3119,41 +3813,50 @@ "in": "query", "name": "app_id", "required": false - }, - { - "schema": { - "$ref": "#/components/schemas/GovernanceRuleCreateItem" - }, - "in": "body", - "name": "body" } ], - "summary": "Create New Governance Rules", + "summary": "Update a Company", "responses": { - "201": { + "200": { "description": "success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GovernanceRulesDocument" + "$ref": "#/components/schemas/companyResponseDTO" } } } } } - }, - "get": { + } + }, + "/search/~/companies/batch": { + "post": { "security": [ { "managementAPIToken": [ - "read:governance_rules" + "create:companies", + "update:companies" ] } ], "tags": [ - "Governance" + "Companies" ], - "operationId": "getGovernanceRules", + "operationId": "batchUpdateCompanies", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CompanyUpdateDTO" + } + } + } + } + }, "parameters": [ { "schema": { @@ -3173,14 +3876,14 @@ "required": false } ], - "summary": "Get Governance Rules", + "summary": "Update Companies in Batch", "responses": { "200": { "description": "success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GovernanceRulesDocument" + "$ref": "#/components/schemas/companyResponseDTO" } } } @@ -3188,19 +3891,19 @@ } } }, - "/~/dashboards/{dashId}": { - "post": { + "/search/~/companies/{id}": { + "get": { "security": [ { "managementAPIToken": [ - "update:dashboards" + "read:companies" ] } ], "tags": [ - "Dashboards" + "Companies" ], - "operationId": "updateDashboard", + "operationId": "getCompany", "parameters": [ { "schema": { @@ -3224,14 +3927,21 @@ "type": "string" }, "in": "path", - "name": "dashId", + "name": "id", "required": true } ], - "summary": "Update a Dashboard", + "summary": "Get a Company", "responses": { - "201": { - "description": "success" + "200": { + "description": "success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/companyResponseDTO" + } + } + } } } }, @@ -3239,14 +3949,14 @@ "security": [ { "managementAPIToken": [ - "delete:dashboards" + "delete:companies" ] } ], "tags": [ - "Dashboards" + "Companies" ], - "operationId": "deleteDashboard", + "operationId": "deleteCompany", "parameters": [ { "schema": { @@ -3270,11 +3980,21 @@ "type": "string" }, "in": "path", - "name": "dashId", + "name": "id", "required": true - } - ], - "summary": "Delete a Dashboard", + }, + { + "name": "delete_events", + "in": "query", + "description": "Delete events associated with the company which can be set to true or false(default)", + "schema": { + "default": false, + "type": "boolean" + }, + "required": false + } + ], + "summary": "Delete a Company", "responses": { "200": { "description": "success" @@ -3282,21 +4002,19 @@ } } }, - "/~/billing/reports": { + "/search/~/companies/{id}/subscriptions": { "get": { "security": [ { "managementAPIToken": [ - "read:billing_meters", - "read:billing_reports" + "read:companies" ] } ], - "description": "Query audit history of billing reports to external billing providers", "tags": [ - "Billing Reports" + "Subscriptions" ], - "operationId": "getBillingReports", + "operationId": "getCompanySubscriptions", "parameters": [ { "schema": { @@ -3317,99 +4035,165 @@ }, { "schema": { - "type": "string", - "format": "date-time" + "type": "string" }, - "in": "query", - "name": "from", - "required": false - }, + "in": "path", + "name": "id", + "required": true + } + ], + "summary": "Get the Subscriptions of a Company", + "responses": { + "200": { + "description": "success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/companyResponseDTO" + } + } + } + } + } + } + }, + "/search/~/count/companies": { + "post": { + "security": [ { - "schema": { - "type": "string", - "format": "date-time" - }, - "in": "query", - "name": "to", - "required": false - }, + "managementAPIToken": [ + "read:companies" + ] + } + ], + "tags": [ + "Companies" + ], + "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html", + "operationId": "countCompanies", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/object" + } + } + } + }, + "parameters": [ { "schema": { "type": "string" }, - "in": "query", - "name": "billing_meter_id", - "required": false + "in": "path", + "name": "orgId", + "required": true }, { "schema": { "type": "string" }, "in": "query", - "name": "company_id", - "required": false - }, + "name": "app_id", + "required": true + } + ], + "summary": "Count Companies", + "responses": { + "200": { + "description": "success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/object" + } + } + } + } + } + } + }, + "/search/~/count/events": { + "post": { + "security": [ + { + "managementAPIToken": [ + "read:events" + ] + } + ], + "tags": [ + "Metrics" + ], + "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html", + "operationId": "countEvents", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/object" + } + } + } + }, + "parameters": [ { "schema": { "type": "string" }, - "in": "query", - "name": "provider", - "required": false + "in": "path", + "name": "orgId", + "required": true }, { "schema": { + "default": "None", "type": "string" }, "in": "query", - "name": "subscription_id", + "name": "app_id", "required": false }, { - "schema": { - "type": "boolean" - }, + "name": "from", "in": "query", - "name": "success", - "required": false - }, - { + "description": "The start date, which can be absolute such as 2019-07-01T00:00:00Z or relative such as -24h", "schema": { - "format": "int32", - "type": "integer" + "type": "string", + "format": "date-time" }, - "in": "query", - "name": "status_code", - "required": false + "required": true }, { + "name": "to", + "in": "query", + "description": "The end date, which can be absolute such as 2019-07-02T00:00:00Z or relative such as now", "schema": { - "type": "string" + "type": "string", + "format": "date-time" }, - "in": "query", - "name": "error_code", - "required": false + "required": true }, { "schema": { - "type": "string" + "default": false, + "type": "boolean" }, "in": "query", - "name": "`type`", + "name": "track_total_hits", "required": false } ], - "summary": "Get BillingReports", + "summary": "Count Events", "responses": { "200": { "description": "success", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/BillingReport" - } + "$ref": "#/components/schemas/object" } } } @@ -3417,22 +4201,30 @@ } } }, - "/v1/~/keystore": { + "/search/~/count/users": { "post": { "security": [ { "managementAPIToken": [ - "create:encrypted_keys" + "read:users" ] } ], "tags": [ - "Keystore" - ], - "operationId": "createEncryptedKeys", - "consumes": [ - "application/json" + "Users" ], + "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html", + "operationId": "countUsers", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/object" + } + } + } + }, "parameters": [ { "schema": { @@ -3444,47 +4236,41 @@ }, { "schema": { - "default": "~", "type": "string" }, "in": "query", "name": "app_id", - "required": false - }, - { - "schema": { - "$ref": "#/components/schemas/EncryptedKeyCreateItem" - }, - "in": "body", - "name": "body" + "required": true } ], - "summary": "Create New Encrypted key/s", + "summary": "Count Users", "responses": { - "201": { + "200": { "description": "success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/EncryptedKeyDocument" + "$ref": "#/components/schemas/object" } } } } } - }, + } + }, + "/search/~/events/{id}": { "get": { "security": [ { "managementAPIToken": [ - "read:encrypted_keys" + "read:events" ] } ], "tags": [ - "Keystore" + "Metrics" ], - "operationId": "getEncryptedKeys", + "operationId": "getEvent", "parameters": [ { "schema": { @@ -3505,12 +4291,11 @@ }, { "schema": { - "type": "string", - "format": "date-time" + "type": "string" }, - "in": "query", - "name": "from", - "required": false + "in": "path", + "name": "id", + "required": true }, { "schema": { @@ -3518,21 +4303,18 @@ "format": "date-time" }, "in": "query", - "name": "to", - "required": false - }, - { - "name": "type" + "name": "event_time", + "required": true } ], - "summary": "Get Encrypted keys", + "summary": "Get an Event", "responses": { "200": { "description": "success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/EncryptedKeyDocument" + "$ref": "#/components/schemas/eventResponseDTO" } } } @@ -3540,28 +4322,45 @@ } } }, - "/workspaces/access_token": { + "/search/~/mappings/companies/properties": { "get": { "security": [ { "managementAPIToken": [ - "read:workspaces" + "read:company_properties" ] } ], - "description": "Get a new Workspace Access Token", "tags": [ - "Workspaces" + "Properties" ], - "operationId": "getWorkspaceToken", - "summary": "Get new Workspace Token", + "operationId": "getProperties", + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "orgId", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "app_id", + "required": true + } + ], + "summary": "Get Property Mapping for Companies", "responses": { "200": { "description": "success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SignedTokenDTO" + "$ref": "#/components/schemas/object" } } } @@ -3569,21 +4368,19 @@ } } }, - "/~/billing/reports/metrics": { + "/search/~/mappings/companymetrics/properties": { "get": { "security": [ { "managementAPIToken": [ - "create:billing_meters", - "create:billing_reports" + "read:companies" ] } ], - "description": "Get BillingReports' values for a given meter and time range for a single company or all companies", "tags": [ - "Billing Reports" + "Properties" ], - "operationId": "getBillingReportsMetrics", + "operationId": "getProperties", "parameters": [ { "schema": { @@ -3595,20 +4392,10 @@ }, { "schema": { - "default": "~", "type": "string" }, "in": "query", "name": "app_id", - "required": false - }, - { - "schema": { - "type": "string", - "format": "date-time" - }, - "in": "query", - "name": "from", "required": true }, { @@ -3617,77 +4404,82 @@ "format": "date-time" }, "in": "query", - "name": "to", - "required": true - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "billing_meter_id", - "required": false - }, - { - "schema": { - "type": "boolean" - }, - "in": "query", - "name": "success", + "name": "from", "required": false - }, + } + ], + "summary": "Get Property Mapping for CompanyMetrics", + "responses": { + "200": { + "description": "success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/object" + } + } + } + } + } + } + }, + "/search/~/mappings/events/properties": { + "get": { + "security": [ { - "schema": { - "type": "string" - }, - "in": "query", - "name": "aggregator", - "required": false - }, + "managementAPIToken": [ + "read:properties" + ] + } + ], + "tags": [ + "Properties" + ], + "operationId": "getProperties", + "parameters": [ { "schema": { "type": "string" }, - "in": "query", - "name": "interval", - "required": false + "in": "path", + "name": "orgId", + "required": true }, { "schema": { "type": "string" }, "in": "query", - "name": "company_id", - "required": false + "name": "app_id", + "required": true }, { "schema": { - "type": "string" + "type": "string", + "format": "date-time" }, "in": "query", - "name": "subscription_id", + "name": "from", "required": false }, { "schema": { - "type": "array", - "items": { - "type": "string" - } + "type": "string", + "format": "date-time" }, "in": "query", - "name": "`type`", + "name": "to", "required": false } ], - "summary": "Get BillingReports' values for a given meter and time range for a single company or all companies", + "summary": "Get Property Mapping for Events", "responses": { "200": { - "description": "three buckets of aggregates for the given meter and time range including Metric Value, Reported Usage, and list of errors.", + "description": "success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BillingMetricResponse" + "$ref": "#/components/schemas/object" } } } @@ -3695,22 +4487,19 @@ } } }, - "/~/cohorts/{cohortId}": { - "post": { + "/search/~/mappings/events/request/body/properties": { + "get": { "security": [ { "managementAPIToken": [ - "update:cohorts" + "read:request_body_properties" ] } ], "tags": [ - "Cohorts" - ], - "operationId": "updateCohort", - "consumes": [ - "application/json" + "Properties" ], + "operationId": "getRequestBodyProperties", "parameters": [ { "schema": { @@ -3722,48 +4511,76 @@ }, { "schema": { - "default": "~", "type": "string" }, "in": "query", "name": "app_id", - "required": false + "required": true }, { "schema": { - "type": "string" + "type": "string", + "format": "date-time" }, - "in": "path", - "name": "cohortId", + "in": "query", + "name": "from", + "required": true + }, + { + "schema": { + "type": "string", + "format": "date-time" + }, + "in": "query", + "name": "to", "required": true }, { "schema": { - "$ref": "#/components/schemas/CohortUpdateItem" + "default": false, + "type": "boolean" + }, + "in": "query", + "name": "include_values", + "required": false + }, + { + "schema": { + "type": "string" }, - "in": "body", - "name": "body" + "in": "query", + "name": "key_path", + "required": false } ], - "summary": "Update a Cohort", + "summary": "Get Property Mapping for Events Request Body", "responses": { "200": { - "description": "success" + "description": "success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/object" + } + } + } } } - }, + } + }, + "/search/~/mappings/events/response/body/properties": { "get": { "security": [ { "managementAPIToken": [ - "read:cohorts" + "read:response_body_properties" ] } ], "tags": [ - "Cohorts" + "Properties" ], - "operationId": "getCohort", + "operationId": "getResponseBodyProperties", "parameters": [ { "schema": { @@ -3775,49 +4592,76 @@ }, { "schema": { - "default": "~", "type": "string" }, "in": "query", "name": "app_id", - "required": false + "required": true }, { "schema": { - "type": "string" + "type": "string", + "format": "date-time" }, "in": "query", - "name": "cohort_type", + "name": "from", "required": true }, { "schema": { - "type": "string" + "type": "string", + "format": "date-time" }, - "in": "path", - "name": "cohortId", + "in": "query", + "name": "to", "required": true + }, + { + "schema": { + "default": false, + "type": "boolean" + }, + "in": "query", + "name": "include_values", + "required": false + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "key_path", + "required": false } ], - "summary": "Get Cohort", + "summary": "Get Property Mapping for Events Response Body", "responses": { "200": { - "description": "success" + "description": "success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/object" + } + } + } } } - }, - "delete": { + } + }, + "/search/~/mappings/usermetrics/properties": { + "get": { "security": [ { "managementAPIToken": [ - "delete:cohorts" + "read:users" ] } ], "tags": [ - "Cohorts" + "Properties" ], - "operationId": "deleteCohort", + "operationId": "getProperties", "parameters": [ { "schema": { @@ -3829,44 +4673,50 @@ }, { "schema": { - "default": "~", "type": "string" }, "in": "query", "name": "app_id", - "required": false + "required": true }, { "schema": { - "type": "string" + "type": "string", + "format": "date-time" }, - "in": "path", - "name": "cohortId", - "required": true + "in": "query", + "name": "from", + "required": false } ], - "summary": "Delete Cohort", + "summary": "Get Property Mapping for UserMetrics", "responses": { "200": { - "description": "success" + "description": "success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/object" + } + } + } } } } }, - "/~/billing/meters/{meterId}": { + "/search/~/mappings/users/properties": { "get": { "security": [ { "managementAPIToken": [ - "read:billing_meters" + "read:users" ] } ], - "description": "Get Billing Meter by id", "tags": [ - "Billing Meters" + "Properties" ], - "operationId": "getMeter", + "operationId": "getProperties", "parameters": [ { "schema": { @@ -3878,49 +4728,53 @@ }, { "schema": { - "default": "~", "type": "string" }, "in": "query", "name": "app_id", - "required": false - }, - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "meterId", "required": true } ], - "summary": "Get Billing Meter by id", + "summary": "Get Property Mapping for Users", "responses": { "200": { "description": "success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/billingmeters.BillingMeterDocument" + "$ref": "#/components/schemas/object" } } } } } - }, - "delete": { + } + }, + "/search/~/search/companymetrics/companies": { + "post": { "security": [ { "managementAPIToken": [ - "delete:billing_meters" + "read:companies" ] } ], - "description": "Delete Billing Meter by id", "tags": [ - "Billing Meters" + "Companies" ], - "operationId": "deleteMeter", + "documentation": "https://www.moesif.com/docs/api#pagination-and-filtering", + "operationId": "searchCompanyMetrics", + "requestBody": { + "required": true, + "content": { + "application/json": { + "description": "The search definition using the Elasticsearch Query DSL", + "schema": { + "$ref": "#/components/schemas/object" + } + } + } + }, "parameters": [ { "schema": { @@ -3940,40 +4794,60 @@ "required": false }, { + "name": "from", + "in": "query", + "description": "The start date, which can be absolute such as 2023-07-01T00:00:00Z or relative such as -24h", "schema": { - "type": "string" + "type": "string", + "format": "date-time" }, - "in": "path", - "name": "meterId", - "required": true + "required": false + }, + { + "name": "to", + "in": "query", + "description": "The end date, which can be absolute such as 2023-07-02T00:00:00Z or relative such as now", + "schema": { + "type": "string", + "format": "date-time" + }, + "required": false } ], - "summary": "Delete Billing Meter by id", + "summary": "Search CompanyMetrics/Companies", "responses": { "200": { - "description": "success" + "description": "success", + "content": "application/json" } } } }, - "/~/billing/reports/balance_transactions": { + "/search/~/search/events": { "post": { "security": [ { "managementAPIToken": [ - "create:billing_meters", - "create:billing_reports" + "read:events" ] } ], - "description": "Post a billing report of type balance_transaction", "tags": [ - "Balance Transactions" - ], - "operationId": "createBalanceTransaction", - "consumes": [ - "application/json" + "Metrics" ], + "documentation": "https://www.moesif.com/docs/api#pagination-and-filtering", + "operationId": "searchEvents", + "requestBody": { + "required": true, + "content": { + "application/json": { + "description": "The search definition using the Elasticsearch Query DSL", + "schema": { + "$ref": "#/components/schemas/object" + } + } + } + }, "parameters": [ { "schema": { @@ -3985,7 +4859,7 @@ }, { "schema": { - "default": "~", + "default": "None", "type": "string" }, "in": "query", @@ -3993,34 +4867,66 @@ "required": false }, { + "name": "from", + "in": "query", + "description": "The start date, which can be absolute such as 2023-07-01T00:00:00Z or relative such as -24h", + "schema": { + "type": "string", + "format": "date-time" + }, + "required": true + }, + { + "name": "to", + "in": "query", + "description": "The end date, which can be absolute such as 2023-07-02T00:00:00Z or relative such as now", "schema": { - "$ref": "#/components/schemas/billingreports.BillingReportBalanceTransCreate" + "type": "string", + "format": "date-time" }, - "in": "body", - "name": "body" + "required": true } ], - "summary": "Post BillingReports Balance Transactions", + "summary": "Search Events", "responses": { - "204": { - "description": "success, no content and BillingReports were created or updated" + "201": { + "description": "success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/searchEventsResponseDTO" + } + } + } } } } }, - "/~/dashboards/{dashId}/cascade": { - "delete": { + "/search/~/search/usermetrics/users": { + "post": { "security": [ { "managementAPIToken": [ - "delete:dashboards" + "read:users" ] } ], "tags": [ - "Dashboards" + "Users" ], - "operationId": "cascadeDeleteDashboard", + "documentation": "https://www.moesif.com/docs/api#pagination-and-filtering", + "operationId": "searchUserMetrics", + "requestBody": { + "required": true, + "content": { + "application/json": { + "description": "The search definition using the Elasticsearch Query DSL", + "schema": { + "$ref": "#/components/schemas/object" + } + } + } + }, "parameters": [ { "schema": { @@ -4040,35 +4946,59 @@ "required": false }, { + "name": "from", + "in": "query", + "description": "The start date, which can be absolute such as 2023-07-01T00:00:00Z or relative such as -24h", "schema": { - "type": "string" + "type": "string", + "format": "date-time" }, - "in": "path", - "name": "dashId", - "required": true + "required": false + }, + { + "name": "to", + "in": "query", + "description": "The end date, which can be absolute such as 2023-07-02T00:00:00Z or relative such as now", + "schema": { + "type": "string", + "format": "date-time" + }, + "required": false } ], - "summary": "Casccade delete a Dashboard", + "summary": "Search UserMetrics/Users", "responses": { "200": { - "description": "success" + "description": "success", + "content": "application/json" } } } }, - "/~/workspaces/templates": { - "get": { + "/search/~/subscriptions": { + "post": { "security": [ { "managementAPIToken": [ - "read:workspaces" + "create:subscriptions", + "update:subscriptions" ] } ], "tags": [ - "Workspaces" + "Subscriptions" ], - "operationId": "getWorkspaceTemplates", + "operationId": "createSubscription", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddSubscriptionDTO" + } + } + } + }, "parameters": [ { "schema": { @@ -4088,17 +5018,14 @@ "required": false } ], - "summary": "Get Workspace Templates", + "summary": "Create or Update a Subscription", "responses": { "200": { "description": "success", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/WorkspaceDocument" - } + "$ref": "#/components/schemas/SubscriptionDTO" } } } @@ -4106,38 +5033,57 @@ } } }, - "/~/oauth/tokeninfo": { - "get": { + "/search/~/subscriptions/batch": { + "post": { "security": [ { "managementAPIToken": [ - "read:access_tokens" + "create:subscriptions", + "update:subscriptions" ] } ], - "description": "Get info for user's token", "tags": [ - "OAuth" + "Subscriptions" ], - "operationId": "getTokenInfo", + "operationId": "batchCreateSubscriptions", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddSubscriptionDTO" + } + } + } + }, "parameters": [ { "schema": { "type": "string" }, - "in": "query", - "name": "scope", + "in": "path", + "name": "orgId", "required": true + }, + { + "schema": { + "default": "~", + "type": "string" + }, + "in": "query", + "name": "app_id", + "required": false } ], - "summary": "Get Token Info", + "summary": "Create or Update Subscriptions in Batch", "responses": { "200": { "description": "success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/com.moesif.secureapi.api.auth.JWTPayload" + "$ref": "#/components/schemas/SubscriptionDTO" } } } @@ -4145,19 +5091,19 @@ } } }, - "/~/workspaces/{id}/comments/{commentId}": { - "post": { + "/search/~/subscriptions/{id}": { + "get": { "security": [ { "managementAPIToken": [ - "update:workspaces" + "read:subscriptions" ] } ], "tags": [ - "Workspaces" + "Subscriptions" ], - "operationId": "updateComment", + "operationId": "getSubscription", "parameters": [ { "schema": { @@ -4183,35 +5129,47 @@ "in": "path", "name": "id", "required": true - }, - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "commentId", - "required": true } ], - "summary": "Update Existing Comment", + "summary": "Get a Subscription", "responses": { - "201": { - "description": "success" + "200": { + "description": "success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SubscriptionDTO" + } + } + } } } - }, - "delete": { + } + }, + "/search/~/users": { + "post": { "security": [ { "managementAPIToken": [ - "update:workspaces" + "create:users", + "update:users" ] } ], "tags": [ - "Workspaces" + "Users" ], - "operationId": "deleteComment", + "operationId": "updateUsers", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserUpdateDTO" + } + } + } + }, "parameters": [ { "schema": { @@ -4229,48 +5187,50 @@ "in": "query", "name": "app_id", "required": false - }, - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "id", - "required": true - }, - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "commentId", - "required": true } ], - "summary": "Delete a Comment", + "summary": "Update a User", "responses": { - "204": { - "description": "success" - } - } + "200": { + "description": "success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/userResponseDTO" + } + } + } + } + } } }, - "/~/profileviewconfigs": { + "/search/~/users/batch": { "post": { "security": [ { "managementAPIToken": [ - "create:profileiew" + "create:users", + "update:users" ] } ], "tags": [ - "Profile View" - ], - "operationId": "createProfileViewConfig", - "consumes": [ - "application/json" + "Users" ], + "operationId": "batchUpdateUsers", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserUpdateDTO" + } + } + } + } + }, "parameters": [ { "schema": { @@ -4288,50 +5248,36 @@ "in": "query", "name": "app_id", "required": false - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "entity", - "required": true - }, - { - "schema": { - "$ref": "#/components/schemas/ProfileViewConfigDocument" - }, - "in": "body", - "name": "body" } ], - "summary": "Create a new Profile View of a given entity type. Note the compound index (orgId, appId, entity) is unique in this collection", + "summary": "Update Users in Batch", "responses": { - "201": { - "description": "created", + "200": { + "description": "success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProfileViewConfigDocument" + "$ref": "#/components/schemas/userResponseDTO" } } } } } - }, + } + }, + "/search/~/users/{id}": { "get": { "security": [ { "managementAPIToken": [ - "read:profileiew" + "read:users" ] } ], - "description": "Get the Profile View of a given entity type for authenticated users", "tags": [ - "Profile View" + "Users" ], - "operationId": "getProfileViewConfig", + "operationId": "getUser", "parameters": [ { "schema": { @@ -4354,19 +5300,19 @@ "schema": { "type": "string" }, - "in": "query", - "name": "entity", + "in": "path", + "name": "id", "required": true } ], - "summary": "Get a Profile View", + "summary": "Get a User", "responses": { "200": { "description": "success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProfileViewConfigDocument" + "$ref": "#/components/schemas/userResponseDTO" } } } @@ -4377,14 +5323,14 @@ "security": [ { "managementAPIToken": [ - "delete:profileview" + "delete:users" ] } ], "tags": [ - "Profile View" + "Users" ], - "operationId": "deleteProfileViewConfig", + "operationId": "deleteUser", "parameters": [ { "schema": { @@ -4407,40 +5353,54 @@ "schema": { "type": "string" }, - "in": "query", - "name": "entity", + "in": "path", + "name": "id", "required": true + }, + { + "name": "delete_events", + "in": "query", + "description": "Delete events associated with the user which can be set to true or false(default)", + "schema": { + "default": false, + "type": "boolean" + }, + "required": false } ], - "summary": "Delete a Profile View", + "summary": "Delete a User", "responses": { "200": { - "description": "success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProfileViewConfigDocument" - } - } - } + "description": "success" } } - }, - "put": { + } + }, + "/search/~/workspaces/{workspaceId}/search": { + "post": { "security": [ { "managementAPIToken": [ - "update:profileview" + "read:events" ] } ], "tags": [ - "Profile View" - ], - "operationId": "upsertProfileViewConfig", - "consumes": [ - "application/json" + "Metrics" ], + "documentation": "https://www.moesif.com/docs/api#pagination-and-filtering", + "operationId": "searchPublicWorkspaces", + "requestBody": { + "required": true, + "content": { + "application/json": { + "description": "The search definition using the Elasticsearch Query DSL", + "schema": { + "$ref": "#/components/schemas/object" + } + } + } + }, "parameters": [ { "schema": { @@ -4459,33 +5419,62 @@ "name": "app_id", "required": false }, + { + "name": "from", + "in": "query", + "description": "The start date, which can be absolute such as 2023-07-01T00:00:00Z or relative such as -24h", + "schema": { + "type": "string", + "format": "date-time" + }, + "required": true + }, + { + "name": "to", + "in": "query", + "description": "The end date, which can be absolute such as 2023-07-02T00:00:00Z or relative such as now", + "schema": { + "type": "string", + "format": "date-time" + }, + "required": true + }, { "schema": { "type": "string" }, - "in": "query", - "name": "entity", + "in": "path", + "name": "workspaceId", "required": true }, { "schema": { - "$ref": "#/components/schemas/ProfileViewConfigDocument" + "default": false, + "type": "boolean" + }, + "in": "query", + "name": "include_details", + "required": false + }, + { + "schema": { + "default": 1000, + "format": "int32", + "type": "integer" }, - "in": "body", - "name": "body" + "in": "query", + "name": "take", + "required": false } ], - "summary": "Update a Profile View", + "summary": "Search Events in saved public Workspace", "responses": { - "200": { + "201": { "description": "success", "content": { "application/json": { "schema": { - "type": "object", - "items": { - "$ref": "#/components/schemas/ProfileViewConfigDocument" - } + "$ref": "#/components/schemas/searchEventsResponseDTO" } } } @@ -4493,114 +5482,69 @@ } } }, - "/~/dashboard/{dashId}": { - "delete": { + "/workspaces/access_token": { + "get": { "security": [ { "managementAPIToken": [ - "delete:dashboards" + "read:workspaces" ] } ], + "description": "Get a new Workspace Access Token", "tags": [ - "Dashboards" - ], - "operationId": "deleteDashboards", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "orgId", - "required": true - }, - { - "schema": { - "default": "~", - "type": "string" - }, - "in": "query", - "name": "app_id", - "required": false - }, - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "dashId", - "required": true - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "parent_id", - "required": false - } + "Workspaces" ], - "summary": "Delete a Dashboard", + "operationId": "getWorkspaceToken", + "summary": "Get new Workspace Token", "responses": { "200": { - "description": "success" + "description": "success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SignedTokenDTO" + } + } + } } } } }, - "/~/{appId}/{entity}/promotedashboard/{dashId}": { - "post": { + "/workspaces/public/{id}": { + "get": { "security": [ { "managementAPIToken": [ - "update:dashboards", - "update:profile_view_config" + "read:public_workspaces" ] } ], "tags": [ - "Dashboards" + "Workspaces" ], - "operationId": "promoteToProfileView", + "operationId": "getPublicWorkspace", "parameters": [ { "schema": { "type": "string" }, "in": "path", - "name": "orgId", - "required": true - }, - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "appId", - "required": true - }, - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "entity", - "required": true - }, - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "dashId", + "name": "id", "required": true } ], - "summary": "Select Profile View Dashboard", + "summary": "Get a Public Workspace", "responses": { "200": { - "description": "success" + "description": "success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WorkspaceDocument" + } + } + } } } } @@ -4619,9 +5563,16 @@ "Applications" ], "operationId": "addApp", - "consumes": [ - "application/json" - ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppCreateDTO" + } + } + } + }, "parameters": [ { "schema": { @@ -4630,13 +5581,6 @@ "in": "path", "name": "orgId", "required": true - }, - { - "schema": { - "$ref": "#/components/schemas/AppCreateDTO" - }, - "in": "body", - "name": "body" } ], "summary": "Create a new App", @@ -4712,20 +5656,30 @@ } } }, - "/~/billing/catalog/prices/{id}": { - "get": { + "/~/apps/{id}": { + "post": { "security": [ { "managementAPIToken": [ - "read:prices" + "update:apps" ] } ], - "description": "Get the Moesif Price for a specific Plan for authenticated users", + "description": "Update the name of the app for the selected organization", "tags": [ - "Billing Catalog" + "Applications" ], - "operationId": "getMoesifPrice", + "operationId": "updateApp", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppUpdateDTO" + } + } + } + }, "parameters": [ { "schema": { @@ -4735,15 +5689,6 @@ "name": "orgId", "required": true }, - { - "schema": { - "default": "~", - "type": "string" - }, - "in": "query", - "name": "app_id", - "required": false - }, { "schema": { "type": "string" @@ -4751,24 +5696,16 @@ "in": "path", "name": "id", "required": true - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "provider", - "required": true } ], - "summary": "Get a Moesif Price", + "summary": "Update Apps", "responses": { "200": { "description": "success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/MoesifPrice" + "$ref": "#/components/schemas/AppUpdateDTO" } } } @@ -4779,14 +5716,15 @@ "security": [ { "managementAPIToken": [ - "delete:prices" + "delete:apps" ] } ], + "description": "Delete the app for the selected organization", "tags": [ - "Billing Catalog" + "Applications" ], - "operationId": "deleteMoesifPrice", + "operationId": "deleteApp", "parameters": [ { "schema": { @@ -4796,15 +5734,6 @@ "name": "orgId", "required": true }, - { - "schema": { - "default": "~", - "type": "string" - }, - "in": "query", - "name": "app_id", - "required": false - }, { "schema": { "type": "string" @@ -4812,38 +5741,39 @@ "in": "path", "name": "id", "required": true - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "provider", - "required": true } ], - "summary": "Delete a Moesif Price", + "summary": "Delete Apps", "responses": { - "204": { - "description": "no content" + "200": { + "description": "success" } } - }, - "put": { + } + }, + "/~/billing/catalog/plans": { + "post": { "security": [ { "managementAPIToken": [ - "update:prices" + "create:plans" ] } ], "tags": [ - "Billing Catalog" - ], - "operationId": "updateMoesifPrice", - "consumes": [ - "application/json" + "Product Catalog" ], + "operationId": "createMoesifPlan", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MoesifPlan" + } + } + } + }, "parameters": [ { "schema": { @@ -4862,14 +5792,6 @@ "name": "app_id", "required": false }, - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "id", - "required": true - }, { "schema": { "type": "string" @@ -4877,46 +5799,34 @@ "in": "query", "name": "provider", "required": true - }, - { - "schema": { - "$ref": "#/components/schemas/MoesifPrice" - }, - "in": "body", - "name": "body" } ], - "summary": "Update a Moesif Price", + "summary": "Create a new Moesif Plan", "responses": { - "200": { - "description": "success", + "201": { + "description": "created", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/MoesifPrice" + "$ref": "#/components/schemas/MoesifPlan" } } } } } - } - }, - "/~/emails/templates": { - "post": { + }, + "get": { "security": [ { "managementAPIToken": [ - "create:email_templates" + "read:plans" ] } ], "tags": [ - "Emails" - ], - "operationId": "createEmailTemplate", - "consumes": [ - "application/json" + "Product Catalog" ], + "operationId": "listMoesifPlans", "parameters": [ { "schema": { @@ -4937,38 +5847,55 @@ }, { "schema": { - "$ref": "#/components/schemas/EmailTemplateCreateItem" + "default": "all", + "type": "string" + }, + "in": "query", + "name": "provider", + "required": false + }, + { + "schema": { + "default": "None", + "type": "string" }, - "in": "body", - "name": "body" + "in": "query", + "name": "includes", + "required": false } ], - "summary": "Create New Email Template", + "summary": "List all Moesif Plans", "responses": { - "201": { + "200": { "description": "success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/com.moesif.docdb.emailtemplates.EmailTemplateDocument" + "type": "array", + "items": { + "$ref": "#/components/schemas/MoesifPlan" + } } } } } } - }, + } + }, + "/~/billing/catalog/plans/{id}": { "get": { "security": [ { "managementAPIToken": [ - "read:email_templates" + "read:plans" ] } ], + "description": "Get the Moesif Plan for authenticated users", "tags": [ - "Emails" + "Product Catalog" ], - "operationId": "getEmailTemplates", + "operationId": "getMoesifPlan", "parameters": [ { "schema": { @@ -4987,36 +5914,49 @@ "name": "app_id", "required": false }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "id", + "required": true + }, { "schema": { "type": "string" }, "in": "query", - "name": "cohort_id", - "required": false + "name": "provider", + "required": true } ], - "summary": "Get Email Templates", + "summary": "Get a Moesif Plan", "responses": { "200": { - "description": "success" + "description": "success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MoesifPlan" + } + } + } } } - } - }, - "/~/dashboards/{id}/policy/acl": { - "post": { + }, + "delete": { "security": [ { "managementAPIToken": [ - "create:dashboards" + "delete:plans" ] } ], "tags": [ - "Dashboards" + "Product Catalog" ], - "operationId": "addACLPermissions", + "operationId": "deleteMoesifPlan", "parameters": [ { "schema": { @@ -5048,38 +5988,39 @@ "type": "string" }, "in": "query", - "name": "grantee", - "required": false - }, - { - "schema": { - "default": "None", - "type": "string" - }, - "in": "query", - "name": "permission", - "required": false + "name": "provider", + "required": true } ], - "summary": "Add Dashboards ACL permission", + "summary": "Delete a Moesif Plan", "responses": { - "200": { - "description": "success" + "204": { + "description": "no content" } } }, - "delete": { + "put": { "security": [ { "managementAPIToken": [ - "delete:dashboards" + "update:plans" ] } ], "tags": [ - "Dashboards" + "Product Catalog" ], - "operationId": "deleteACLPermissions", + "operationId": "updateMoesifPlan", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MoesifPlan" + } + } + } + }, "parameters": [ { "schema": { @@ -5111,34 +6052,48 @@ "type": "string" }, "in": "query", - "name": "grantee", + "name": "provider", "required": true } ], - "summary": "Delete Dashboards ACL permission", + "summary": "Update a Moesif Plan", "responses": { "200": { - "description": "success" + "description": "success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MoesifPlan" + } + } + } } } } }, - "/~/billing/catalog/plans": { + "/~/billing/catalog/prices": { "post": { "security": [ { "managementAPIToken": [ - "create:plans" + "create:prices" ] } ], "tags": [ - "Billing Catalog" - ], - "operationId": "createMoesifPlan", - "consumes": [ - "application/json" + "Product Catalog" ], + "operationId": "createMoesifPrice", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MoesifPrice" + } + } + } + }, "parameters": [ { "schema": { @@ -5164,23 +6119,16 @@ "in": "query", "name": "provider", "required": true - }, - { - "schema": { - "$ref": "#/components/schemas/MoesifPlan" - }, - "in": "body", - "name": "body" } ], - "summary": "Create a new Moesif Plan", + "summary": "Create a new Moesif Price", "responses": { "201": { "description": "created", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/MoesifPlan" + "$ref": "#/components/schemas/MoesifPrice" } } } @@ -5191,14 +6139,14 @@ "security": [ { "managementAPIToken": [ - "read:plans" + "read:prices" ] } ], "tags": [ - "Billing Catalog" + "Product Catalog" ], - "operationId": "listMoesifPlans", + "operationId": "listMoesifPrices", "parameters": [ { "schema": { @@ -5225,18 +6173,9 @@ "in": "query", "name": "provider", "required": false - }, - { - "schema": { - "default": "None", - "type": "string" - }, - "in": "query", - "name": "includes", - "required": false } ], - "summary": "List all Moesif Plans", + "summary": "List all Moesif Prices for a specific Plan", "responses": { "200": { "description": "success", @@ -5245,7 +6184,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/MoesifPlan" + "$ref": "#/components/schemas/MoesifPrice" } } } @@ -5254,69 +6193,20 @@ } } }, - "/~/cohorts/{cohortId}/sample_rate": { - "delete": { - "security": [ - { - "managementAPIToken": [ - "update:cohorts" - ] - } - ], - "tags": [ - "Cohorts" - ], - "operationId": "deleteCohortSampleRate", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "orgId", - "required": true - }, - { - "schema": { - "default": "~", - "type": "string" - }, - "in": "query", - "name": "app_id", - "required": false - }, - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "cohortId", - "required": true - } - ], - "summary": "Delete Sample Rate for a Cohort", - "responses": { - "200": { - "description": "success" - } - } - } - }, - "/~/workspaces/{id}": { - "post": { - "body": null, + "/~/billing/catalog/prices/{id}": { + "get": { "security": [ { "managementAPIToken": [ - "update:workspaces", - "update:public_workspaces" + "read:prices" ] } ], + "description": "Get the Moesif Price for a specific Plan for authenticated users", "tags": [ - "Workspaces" + "Product Catalog" ], - "operationId": "updateWorkspace", + "operationId": "getMoesifPrice", "parameters": [ { "schema": { @@ -5342,62 +6232,24 @@ "in": "path", "name": "id", "required": true - } - ], - "summary": "Update a Workspace", - "responses": { - "200": { - "description": "success" - } - } - }, - "get": { - "security": [ - { - "managementAPIToken": [ - "read:workspaces" - ] - } - ], - "tags": [ - "Workspaces" - ], - "operationId": "getWorkspace", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "orgId", - "required": true }, { "schema": { - "default": "~", "type": "string" }, "in": "query", - "name": "app_id", - "required": false - }, - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "id", + "name": "provider", "required": true } ], - "summary": "Get a Workspace", + "summary": "Get a Moesif Price", "responses": { "200": { "description": "success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/WorkspaceDocument" + "$ref": "#/components/schemas/MoesifPrice" } } } @@ -5408,14 +6260,14 @@ "security": [ { "managementAPIToken": [ - "delete:workspaces" + "delete:prices" ] } ], "tags": [ - "Workspaces" + "Product Catalog" ], - "operationId": "deleteWorkspace", + "operationId": "deleteMoesifPrice", "parameters": [ { "schema": { @@ -5441,29 +6293,45 @@ "in": "path", "name": "id", "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "provider", + "required": true } ], - "summary": "Delete a Workspace", + "summary": "Delete a Moesif Price", "responses": { - "200": { - "description": "success" + "204": { + "description": "no content" } } - } - }, - "/~/dashboard/{id}/copy": { - "post": { + }, + "put": { "security": [ { "managementAPIToken": [ - "create:dashboards" + "update:prices" ] } ], "tags": [ - "Dashboards" + "Product Catalog" ], - "operationId": "copyDashboard", + "operationId": "updateMoesifPrice", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MoesifPrice" + } + } + } + }, "parameters": [ { "schema": { @@ -5495,49 +6363,18 @@ "type": "string" }, "in": "query", - "name": "to_app_id", - "required": false - } - ], - "summary": "Copy Dashboard", - "responses": { - "201": { - "description": "success" - } - } - } - }, - "/workspaces/public/{id}": { - "get": { - "security": [ - { - "managementAPIToken": [ - "read:public_workspaces" - ] - } - ], - "tags": [ - "Workspaces" - ], - "operationId": "getPublicWorkspace", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "id", + "name": "provider", "required": true } ], - "summary": "Get a Public Workspace", + "summary": "Update a Moesif Price", "responses": { "200": { "description": "success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/WorkspaceDocument" + "$ref": "#/components/schemas/MoesifPrice" } } } @@ -5545,22 +6382,20 @@ } } }, - "/~/governance/rules/{id}": { - "post": { + "/~/billing/meters": { + "get": { "security": [ { "managementAPIToken": [ - "update:governance_rules" + "read:billing_meters" ] } ], + "description": "List Billing Meters", "tags": [ - "Governance" - ], - "operationId": "updateGovernanceRule", - "consumes": [ - "application/json" + "Billing Meters" ], + "operationId": "listMeters", "parameters": [ { "schema": { @@ -5578,49 +6413,40 @@ "in": "query", "name": "app_id", "required": false - }, - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "id", - "required": true - }, - { - "schema": { - "$ref": "#/components/schemas/GovernanceRuleUpdateItem" - }, - "in": "body", - "name": "body" } ], - "summary": "Update a Governance Rule", + "summary": "List Billing Meters", "responses": { - "201": { + "200": { "description": "success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GovernanceRulesDocument" + "type": "array", + "items": { + "$ref": "#/components/schemas/BillingMeterDocument" + } } } } } } - }, + } + }, + "/~/billing/meters/{meterId}": { "get": { "security": [ { "managementAPIToken": [ - "read:governance_rules" + "read:billing_meters" ] } ], + "description": "Get Billing Meter by id", "tags": [ - "Governance" + "Billing Meters" ], - "operationId": "getGovernanceRule", + "operationId": "getMeter", "parameters": [ { "schema": { @@ -5644,18 +6470,18 @@ "type": "string" }, "in": "path", - "name": "id", + "name": "meterId", "required": true } ], - "summary": "Get a Governance Rule", + "summary": "Get Billing Meter by id", "responses": { "200": { "description": "success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GovernanceRulesDocument" + "$ref": "#/components/schemas/BillingMeterDocument" } } } @@ -5666,14 +6492,15 @@ "security": [ { "managementAPIToken": [ - "delete:governance_rules" + "delete:billing_meters" ] } ], + "description": "Delete Billing Meter by id", "tags": [ - "Governance" + "Billing Meters" ], - "operationId": "deleteGovernanceRule", + "operationId": "deleteMeter", "parameters": [ { "schema": { @@ -5697,31 +6524,33 @@ "type": "string" }, "in": "path", - "name": "id", + "name": "meterId", "required": true } ], - "summary": "Delete a Governance Rule", + "summary": "Delete Billing Meter by id", "responses": { - "204": { + "200": { "description": "success" } } } }, - "/~/workspaces/{id}/policy/acl": { - "post": { + "/~/billing/reports": { + "get": { "security": [ { "managementAPIToken": [ - "create:workspaces" + "read:billing_meters", + "read:billing_reports" ] } ], + "description": "Query audit history of billing reports to external billing providers", "tags": [ - "Workspaces" + "Billing Reports" ], - "operationId": "addACLPermissions", + "operationId": "getBillingReports", "parameters": [ { "schema": { @@ -5742,167 +6571,131 @@ }, { "schema": { - "type": "string" - }, - "in": "path", - "name": "id", - "required": true - }, - { - "schema": { - "type": "string" + "type": "string", + "format": "date-time" }, "in": "query", - "name": "grantee", + "name": "from", "required": false }, { "schema": { - "default": "None", - "type": "string" + "type": "string", + "format": "date-time" }, "in": "query", - "name": "permission", + "name": "to", "required": false - } - ], - "summary": "Add ACL permission", - "responses": { - "200": { - "description": "success" - } - } - }, - "delete": { - "security": [ - { - "managementAPIToken": [ - "delete:workspaces" - ] - } - ], - "tags": [ - "Workspaces" - ], - "operationId": "deleteACLPermissions", - "parameters": [ + }, { "schema": { "type": "string" }, - "in": "path", - "name": "orgId", - "required": true + "in": "query", + "name": "billing_meter_id", + "required": false }, { "schema": { - "default": "~", "type": "string" }, "in": "query", - "name": "app_id", + "name": "company_id", "required": false }, { "schema": { "type": "string" }, - "in": "path", - "name": "id", - "required": true + "in": "query", + "name": "provider", + "required": false }, { "schema": { "type": "string" }, "in": "query", - "name": "grantee", - "required": true - } - ], - "summary": "Delete ACL permission", - "responses": { - "200": { - "description": "success" - } - } - } - }, - "/~/billing/catalog/plans/{id}": { - "get": { - "security": [ - { - "managementAPIToken": [ - "read:plans" - ] - } - ], - "description": "Get the Moesif Plan for authenticated users", - "tags": [ - "Billing Catalog" - ], - "operationId": "getMoesifPlan", - "parameters": [ + "name": "subscription_id", + "required": false + }, { "schema": { - "type": "string" + "type": "boolean" }, - "in": "path", - "name": "orgId", - "required": true + "in": "query", + "name": "success", + "required": false }, { "schema": { - "default": "~", - "type": "string" + "format": "int32", + "type": "integer" }, "in": "query", - "name": "app_id", + "name": "status_code", "required": false }, { "schema": { "type": "string" }, - "in": "path", - "name": "id", - "required": true + "in": "query", + "name": "error_code", + "required": false }, { "schema": { "type": "string" }, "in": "query", - "name": "provider", - "required": true + "name": "`type`", + "required": false } ], - "summary": "Get a Moesif Plan", + "summary": "Get BillingReports", "responses": { "200": { "description": "success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/MoesifPlan" + "type": "array", + "items": { + "$ref": "#/components/schemas/BillingReport" + } } } } } } - }, - "delete": { + } + }, + "/~/billing/reports/balance_transactions": { + "post": { "security": [ { "managementAPIToken": [ - "delete:plans" + "create:billing_meters", + "create:billing_reports" ] } ], + "description": "Post a billing report of type balance_transaction", "tags": [ - "Billing Catalog" + "Balance Transactions" ], - "operationId": "deleteMoesifPlan", + "operationId": "createBalanceTransaction", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BillingReportBalanceTransCreate" + } + } + } + }, "parameters": [ { "schema": { @@ -5920,46 +6713,31 @@ "in": "query", "name": "app_id", "required": false - }, - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "id", - "required": true - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "provider", - "required": true } ], - "summary": "Delete a Moesif Plan", + "summary": "Post BillingReports Balance Transactions", "responses": { "204": { - "description": "no content" + "description": "success, no content and BillingReports were created or updated" } } - }, - "put": { + } + }, + "/~/billing/reports/metrics": { + "get": { "security": [ { "managementAPIToken": [ - "update:plans" + "create:billing_meters", + "create:billing_reports" ] } ], + "description": "Get BillingReports' values for a given meter and time range for a single company or all companies", "tags": [ - "Billing Catalog" - ], - "operationId": "updateMoesifPlan", - "consumes": [ - "application/json" + "Billing Reports" ], + "operationId": "getBillingReportsMetrics", "parameters": [ { "schema": { @@ -5980,73 +6758,44 @@ }, { "schema": { - "type": "string" + "type": "string", + "format": "date-time" }, - "in": "path", - "name": "id", + "in": "query", + "name": "from", "required": true }, { "schema": { - "type": "string" + "type": "string", + "format": "date-time" }, "in": "query", - "name": "provider", + "name": "to", "required": true }, { "schema": { - "$ref": "#/components/schemas/MoesifPlan" + "type": "string" }, - "in": "body", - "name": "body" - } - ], - "summary": "Update a Moesif Plan", - "responses": { - "200": { - "description": "success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MoesifPlan" - } - } - } - } - } - } - }, - "/~/oauth/access_tokens": { - "get": { - "security": [ - { - "managementAPIToken": [ - "create:access_tokens" - ] - } - ], - "description": "Get a new access_token using logged in user's token", - "tags": [ - "OAuth" - ], - "operationId": "getAccessToken", - "parameters": [ + "in": "query", + "name": "billing_meter_id", + "required": false + }, { "schema": { - "type": "string" + "type": "boolean" }, - "in": "path", - "name": "orgId", - "required": true + "in": "query", + "name": "success", + "required": false }, { "schema": { - "default": "~", "type": "string" }, "in": "query", - "name": "app_id", + "name": "aggregator", "required": false }, { @@ -6054,669 +6803,45 @@ "type": "string" }, "in": "query", - "name": "target", - "required": true + "name": "interval", + "required": false }, { "schema": { "type": "string" }, "in": "query", - "name": "scope", - "required": true + "name": "company_id", + "required": false }, { "schema": { - "default": false, - "type": "boolean" + "type": "string" }, "in": "query", - "name": "publishable", + "name": "subscription_id", "required": false }, { "schema": { - "type": "string", - "format": "date-time" + "type": "array", + "items": { + "type": "string" + } }, "in": "query", - "name": "expiration", + "name": "`type`", "required": false } ], - "summary": "Get a new Access Token", + "summary": "Get BillingReports' values for a given meter and time range for a single company or all companies", "responses": { "200": { - "description": "success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AccessTokenDTO" - } - } - } - } - } - } - }, - "/v1/~/keystore/{keyId}": { - "get": { - "security": [ - { - "managementAPIToken": [ - "read:encrypted_keys" - ] - } - ], - "tags": [ - "Keystore" - ], - "operationId": "getEncryptedKey", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "orgId", - "required": true - }, - { - "schema": { - "default": "~", - "type": "string" - }, - "in": "query", - "name": "app_id", - "required": false - }, - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "keyId", - "required": true - } - ], - "summary": "Get Encrypted key", - "responses": { - "200": { - "description": "success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/EncryptedKeyDocument" - } - } - } - } - } - } - }, - "/~/workspaces": { - "post": { - "security": [ - { - "managementAPIToken": [ - "create:workspaces", - "create:public_workspaces" - ] - } - ], - "tags": [ - "Workspaces" - ], - "operationId": "createWorkspace", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "orgId", - "required": true - }, - { - "schema": { - "default": "~", - "type": "string" - }, - "in": "query", - "name": "app_id", - "required": false - }, - { - "schema": { - "type": "string", - "format": "date-time" - }, - "in": "query", - "name": "expiration", - "required": false - } - ], - "summary": "Create New Workspace", - "responses": { - "201": { - "description": "success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WorkspaceDocument" - } - } - } - } - } - }, - "get": { - "security": [ - { - "managementAPIToken": [ - "read:workspaces" - ] - } - ], - "tags": [ - "Workspaces" - ], - "operationId": "getWorkspaces", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "orgId", - "required": true - }, - { - "schema": { - "default": "~", - "type": "string" - }, - "in": "query", - "name": "app_id", - "required": false - }, - { - "schema": { - "format": "int32", - "type": "integer" - }, - "in": "query", - "name": "take", - "required": true - }, - { - "schema": { - "default": "None", - "type": "string" - }, - "in": "query", - "name": "before_id", - "required": false - }, - { - "schema": { - "default": "sequence", - "type": "string" - }, - "in": "query", - "name": "`type`", - "required": false - }, - { - "schema": { - "type": "array", - "items": { - "type": "string" - } - }, - "in": "query", - "name": "access", - "required": true - } - ], - "summary": "Get Workspaces", - "responses": { - "200": { - "description": "success", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/WorkspaceDocument" - } - } - } - } - } - } - } - }, - "/~/workspaces/{id}/comments": { - "post": { - "security": [ - { - "managementAPIToken": [ - "update:workspaces" - ] - } - ], - "tags": [ - "Workspaces" - ], - "operationId": "createComment", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "orgId", - "required": true - }, - { - "schema": { - "default": "~", - "type": "string" - }, - "in": "query", - "name": "app_id", - "required": false - }, - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "id", - "required": true - } - ], - "summary": "Create a New Comment", - "responses": { - "201": { - "description": "success" - } - } - }, - "get": { - "security": [ - { - "managementAPIToken": [ - "read:workspaces" - ] - } - ], - "tags": [ - "Workspaces" - ], - "operationId": "getComments", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "orgId", - "required": true - }, - { - "schema": { - "default": "~", - "type": "string" - }, - "in": "query", - "name": "app_id", - "required": false - }, - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "id", - "required": true - } - ], - "summary": "Get all Comments", - "responses": { - "200": { - "description": "success" - } - } - } - }, - "/~/dashboards/copy": { - "post": { - "security": [ - { - "managementAPIToken": [ - "create:dashboards" - ] - } - ], - "tags": [ - "Dashboards" - ], - "operationId": "copyAllDashboards", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "orgId", - "required": true - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "app_id", - "required": true - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "to_app_id", - "required": true - } - ], - "summary": "Copy All Dashboards", - "responses": { - "201": { - "description": "success" - } - } - } - }, - "/~/emails/templates/{id}": { - "post": { - "security": [ - { - "managementAPIToken": [ - "update:email_templates" - ] - } - ], - "tags": [ - "Emails" - ], - "operationId": "updateEmailTemplate", - "consumes": [ - "application/json" - ], - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "orgId", - "required": true - }, - { - "schema": { - "default": "~", - "type": "string" - }, - "in": "query", - "name": "app_id", - "required": false - }, - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "id", - "required": true - }, - { - "schema": { - "$ref": "#/components/schemas/EmailTemplateUpdateItem" - }, - "in": "body", - "name": "body" - } - ], - "summary": "Update an Email Template", - "responses": { - "200": { - "description": "success" - } - } - }, - "get": { - "security": [ - { - "managementAPIToken": [ - "read:email_templates" - ] - } - ], - "tags": [ - "Emails" - ], - "operationId": "getEmailTemplate", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "orgId", - "required": true - }, - { - "schema": { - "default": "~", - "type": "string" - }, - "in": "query", - "name": "app_id", - "required": false - }, - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "id", - "required": true - } - ], - "summary": "Get Email Template", - "responses": { - "200": { - "description": "success" - } - } - }, - "delete": { - "security": [ - { - "managementAPIToken": [ - "delete:email_templates" - ] - } - ], - "tags": [ - "Emails" - ], - "operationId": "deleteEmailTemplate", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "orgId", - "required": true - }, - { - "schema": { - "default": "~", - "type": "string" - }, - "in": "query", - "name": "app_id", - "required": false - }, - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "id", - "required": true - } - ], - "summary": "Delete Email Template", - "responses": { - "200": { - "description": "success" - } - } - } - }, - "/~/dashboards": { - "post": { - "security": [ - { - "managementAPIToken": [ - "create:dashboards" - ] - } - ], - "tags": [ - "Dashboards" - ], - "operationId": "createDashboard", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "orgId", - "required": true - }, - { - "schema": { - "default": "~", - "type": "string" - }, - "in": "query", - "name": "app_id", - "required": false - } - ], - "summary": "Create New Dashboard", - "responses": { - "201": { - "description": "success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DashboardDocument" - } - } - } - } - } - }, - "get": { - "security": [ - { - "managementAPIToken": [ - "read:dashboards" - ] - } - ], - "tags": [ - "Dashboards" - ], - "operationId": "getDashboards", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "orgId", - "required": true - }, - { - "schema": { - "default": "~", - "type": "string" - }, - "in": "query", - "name": "app_id", - "required": false - } - ], - "summary": "Get a Dashboard", - "responses": { - "200": { - "description": "success" - } - } - } - }, - "/~/billing/meters": { - "get": { - "security": [ - { - "managementAPIToken": [ - "read:billing_meters" - ] - } - ], - "description": "List Billing Meters", - "tags": [ - "Billing Meters" - ], - "operationId": "listMeters", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "orgId", - "required": true - }, - { - "schema": { - "default": "~", - "type": "string" - }, - "in": "query", - "name": "app_id", - "required": false - } - ], - "summary": "List Billing Meters", - "responses": { - "200": { - "description": "success", + "description": "three buckets of aggregates for the given meter and time range including Metric Value, Reported Usage, and list of errors.", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/billingmeters.BillingMeterDocument" - } + "$ref": "#/components/schemas/BillingMetricResponse" } } } @@ -6737,9 +6862,16 @@ "Cohorts" ], "operationId": "createCohort", - "consumes": [ - "application/json" - ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CohortCreateItem" + } + } + } + }, "parameters": [ { "schema": { @@ -6757,13 +6889,6 @@ "in": "query", "name": "app_id", "required": false - }, - { - "schema": { - "$ref": "#/components/schemas/CohortCreateItem" - }, - "in": "body", - "name": "body" } ], "summary": "Create New Cohort", @@ -6827,22 +6952,75 @@ } } }, - "/~/billing/catalog/prices": { + "/~/cohorts/{cohortId}": { "post": { "security": [ { "managementAPIToken": [ - "create:prices" + "update:cohorts" ] } ], "tags": [ - "Billing Catalog" + "Cohorts" ], - "operationId": "createMoesifPrice", - "consumes": [ - "application/json" + "operationId": "updateCohort", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CohortUpdateItem" + } + } + } + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "orgId", + "required": true + }, + { + "schema": { + "default": "~", + "type": "string" + }, + "in": "query", + "name": "app_id", + "required": false + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "cohortId", + "required": true + } + ], + "summary": "Update a Cohort", + "responses": { + "200": { + "description": "success" + } + } + }, + "get": { + "security": [ + { + "managementAPIToken": [ + "read:cohorts" + ] + } + ], + "tags": [ + "Cohorts" ], + "operationId": "getCohort", "parameters": [ { "schema": { @@ -6866,43 +7044,37 @@ "type": "string" }, "in": "query", - "name": "provider", + "name": "cohort_type", "required": true }, { "schema": { - "$ref": "#/components/schemas/MoesifPrice" + "type": "string" }, - "in": "body", - "name": "body" + "in": "path", + "name": "cohortId", + "required": true } ], - "summary": "Create a new Moesif Price", + "summary": "Get Cohort", "responses": { - "201": { - "description": "created", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MoesifPrice" - } - } - } + "200": { + "description": "success" } } }, - "get": { + "delete": { "security": [ { "managementAPIToken": [ - "read:prices" + "delete:cohorts" ] } ], "tags": [ - "Billing Catalog" + "Cohorts" ], - "operationId": "listMoesifPrices", + "operationId": "deleteCohort", "parameters": [ { "schema": { @@ -6923,46 +7095,34 @@ }, { "schema": { - "default": "all", "type": "string" }, - "in": "query", - "name": "provider", - "required": false + "in": "path", + "name": "cohortId", + "required": true } ], - "summary": "List all Moesif Prices for a specific Plan", + "summary": "Delete Cohort", "responses": { "200": { - "description": "success", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/MoesifPrice" - } - } - } - } + "description": "success" } } } }, - "/~/apps/{id}": { - "post": { + "/~/cohorts/{cohortId}/sample_rate": { + "delete": { "security": [ { "managementAPIToken": [ - "update:apps" + "update:cohorts" ] } ], - "description": "Update the name of the app for the selected organization", "tags": [ - "Applications" + "Cohorts" ], - "operationId": "updateApp", + "operationId": "deleteCohortSampleRate", "parameters": [ { "schema": { @@ -6972,42 +7132,45 @@ "name": "orgId", "required": true }, + { + "schema": { + "default": "~", + "type": "string" + }, + "in": "query", + "name": "app_id", + "required": false + }, { "schema": { "type": "string" }, "in": "path", - "name": "id", + "name": "cohortId", "required": true } ], - "summary": "Update Apps", + "summary": "Delete Sample Rate for a Cohort", "responses": { "200": { - "description": "success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AppUpdateDTO" - } - } - } + "description": "success" } } - }, + } + }, + "/~/dashboard/{dashId}": { "delete": { "security": [ { "managementAPIToken": [ - "delete:apps" + "delete:dashboards" ] } ], - "description": "Delete the app for the selected organization", "tags": [ - "Applications" + "Dashboards" ], - "operationId": "deleteApp", + "operationId": "deleteDashboards", "parameters": [ { "schema": { @@ -7017,16 +7180,33 @@ "name": "orgId", "required": true }, + { + "schema": { + "default": "~", + "type": "string" + }, + "in": "query", + "name": "app_id", + "required": false + }, { "schema": { "type": "string" }, "in": "path", - "name": "id", + "name": "dashId", "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "parent_id", + "required": false } ], - "summary": "Delete Apps", + "summary": "Delete a Dashboard", "responses": { "200": { "description": "success" @@ -7034,23 +7214,19 @@ } } }, - "/search/~/search/companymetrics/companies": { + "/~/dashboard/{id}/copy": { "post": { "security": [ { "managementAPIToken": [ - "read:companies" + "create:dashboards" ] } ], "tags": [ - "Companies" - ], - "documentation": "https://www.moesif.com/docs/api#pagination-and-filtering", - "operationId": "searchCompanyMetrics", - "consumes": [ - "application/json" + "Dashboards" ], + "operationId": "copyDashboard", "parameters": [ { "schema": { @@ -7070,56 +7246,88 @@ "required": false }, { - "name": "from", - "in": "query", - "description": "The start date, which can be absolute such as 2023-07-01T00:00:00Z or relative such as -24h", "schema": { - "type": "string", - "format": "date-time" + "type": "string" }, - "required": false + "in": "path", + "name": "id", + "required": true }, { - "name": "to", - "in": "query", - "description": "The end date, which can be absolute such as 2023-07-02T00:00:00Z or relative such as now", "schema": { - "type": "string", - "format": "date-time" + "type": "string" }, + "in": "query", + "name": "to_app_id", "required": false + } + ], + "summary": "Copy Dashboard", + "responses": { + "201": { + "description": "success" + } + } + } + }, + "/~/dashboards": { + "post": { + "security": [ + { + "managementAPIToken": [ + "create:dashboards" + ] + } + ], + "tags": [ + "Dashboards" + ], + "operationId": "createDashboard", + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "orgId", + "required": true }, { "schema": { - "$ref": "#/components/schemas/object" + "default": "~", + "type": "string" }, - "in": "body", - "name": "body", - "description": "The search definition using the Elasticsearch Query DSL" + "in": "query", + "name": "app_id", + "required": false } ], - "summary": "Search CompanyMetrics/Companies", + "summary": "Create New Dashboard", "responses": { - "200": { + "201": { "description": "success", - "content": "application/json" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DashboardDocument" + } + } + } } } - } - }, - "/search/~/mappings/companies/properties": { + }, "get": { "security": [ { "managementAPIToken": [ - "read:company_properties" + "read:dashboards" ] } ], "tags": [ - "Mappings" + "Dashboards" ], - "operationId": "getProperties", + "operationId": "getDashboards", "parameters": [ { "schema": { @@ -7131,41 +7339,35 @@ }, { "schema": { + "default": "~", "type": "string" }, "in": "query", "name": "app_id", - "required": true + "required": false } ], - "summary": "Get Property Mapping for Companies", + "summary": "Get a Dashboard", "responses": { "200": { - "description": "success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/object" - } - } - } + "description": "success" } } } }, - "/search/~/mappings/events/properties": { - "get": { + "/~/dashboards/copy": { + "post": { "security": [ { "managementAPIToken": [ - "read:properties" + "create:dashboards" ] } ], "tags": [ - "Mappings" + "Dashboards" ], - "operationId": "getProperties", + "operationId": "copyAllDashboards", "parameters": [ { "schema": { @@ -7185,51 +7387,44 @@ }, { "schema": { - "type": "string", - "format": "date-time" - }, - "in": "query", - "name": "from", - "required": false - }, - { - "schema": { - "type": "string", - "format": "date-time" + "type": "string" }, "in": "query", - "name": "to", - "required": false + "name": "to_app_id", + "required": true } ], - "summary": "Get Property Mapping for Events", + "summary": "Copy All Dashboards", "responses": { - "200": { - "description": "success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/object" - } - } - } + "201": { + "description": "success" } } } }, - "/search/~/subscriptions/{id}": { - "get": { + "/~/dashboards/{dashId}": { + "post": { "security": [ { "managementAPIToken": [ - "read:subscriptions" + "update:dashboards" ] } ], "tags": [ - "Subscriptions" + "Dashboards" ], - "operationId": "getSubscription", + "operationId": "updateDashboard", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DashboardUpdateItem" + } + } + } + }, "parameters": [ { "schema": { @@ -7253,38 +7448,29 @@ "type": "string" }, "in": "path", - "name": "id", + "name": "dashId", "required": true } ], - "summary": "Get a Subscription", + "summary": "Update a Dashboard", "responses": { - "200": { - "description": "success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SubscriptionDTO" - } - } - } + "201": { + "description": "success" } } - } - }, - "/search/~/companies/{id}": { - "get": { + }, + "delete": { "security": [ { "managementAPIToken": [ - "read:companies" + "delete:dashboards" ] } ], "tags": [ - "Companies" + "Dashboards" ], - "operationId": "getCompany", + "operationId": "deleteDashboard", "parameters": [ { "schema": { @@ -7308,36 +7494,31 @@ "type": "string" }, "in": "path", - "name": "id", + "name": "dashId", "required": true } ], - "summary": "Get a Company", + "summary": "Delete a Dashboard", "responses": { "200": { - "description": "success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/companyResponseDTO" - } - } - } + "description": "success" } } - }, + } + }, + "/~/dashboards/{dashId}/cascade": { "delete": { "security": [ { "managementAPIToken": [ - "delete:companies" + "delete:dashboards" ] } ], "tags": [ - "Companies" + "Dashboards" ], - "operationId": "deleteCompany", + "operationId": "cascadeDeleteDashboard", "parameters": [ { "schema": { @@ -7361,21 +7542,11 @@ "type": "string" }, "in": "path", - "name": "id", + "name": "dashId", "required": true - }, - { - "name": "delete_events", - "in": "query", - "description": "Delete events associated with the company which can be set to true or false(default)", - "schema": { - "default": false, - "type": "boolean" - }, - "required": false } ], - "summary": "Delete a Company", + "summary": "Casccade delete a Dashboard", "responses": { "200": { "description": "success" @@ -7383,19 +7554,19 @@ } } }, - "/search/~/mappings/events/request/body/properties": { - "get": { + "/~/dashboards/{id}/policy/acl": { + "post": { "security": [ { "managementAPIToken": [ - "read:request_body_properties" + "create:dashboards" ] } ], "tags": [ - "Mappings" + "Dashboards" ], - "operationId": "getRequestBodyProperties", + "operationId": "addACLPermissions", "parameters": [ { "schema": { @@ -7407,80 +7578,58 @@ }, { "schema": { + "default": "~", "type": "string" }, "in": "query", "name": "app_id", - "required": true - }, - { - "schema": { - "type": "string", - "format": "date-time" - }, - "in": "query", - "name": "from", - "required": true + "required": false }, { "schema": { - "type": "string", - "format": "date-time" + "type": "string" }, - "in": "query", - "name": "to", + "in": "path", + "name": "id", "required": true }, { "schema": { - "default": false, - "type": "boolean" + "type": "string" }, "in": "query", - "name": "include_values", + "name": "grantee", "required": false }, { "schema": { + "default": "None", "type": "string" }, "in": "query", - "name": "key_path", + "name": "permission", "required": false } ], - "summary": "Get Property Mapping for Events Request Body", + "summary": "Add Dashboards ACL permission", "responses": { "200": { - "description": "success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/object" - } - } - } + "description": "success" } } - } - }, - "/search/~/count/events": { - "post": { + }, + "delete": { "security": [ { "managementAPIToken": [ - "read:events" + "delete:dashboards" ] } ], "tags": [ - "Metrics" - ], - "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html", - "operationId": "countEvents", - "consumes": [ - "application/json" + "Dashboards" ], + "operationId": "deleteACLPermissions", "parameters": [ { "schema": { @@ -7492,7 +7641,7 @@ }, { "schema": { - "default": "None", + "default": "~", "type": "string" }, "in": "query", @@ -7500,71 +7649,98 @@ "required": false }, { - "name": "from", - "in": "query", - "description": "The start date, which can be absolute such as 2019-07-01T00:00:00Z or relative such as -24h", "schema": { - "type": "string", - "format": "date-time" + "type": "string" }, + "in": "path", + "name": "id", "required": true }, { - "name": "to", + "schema": { + "type": "string" + }, "in": "query", - "description": "The end date, which can be absolute such as 2019-07-02T00:00:00Z or relative such as now", + "name": "grantee", + "required": true + } + ], + "summary": "Delete Dashboards ACL permission", + "responses": { + "200": { + "description": "success" + } + } + } + }, + "/~/emails/templates": { + "post": { + "security": [ + { + "managementAPIToken": [ + "create:email_templates" + ] + } + ], + "tags": [ + "Email Templates" + ], + "operationId": "createEmailTemplate", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EmailTemplateCreateItem" + } + } + } + }, + "parameters": [ + { "schema": { - "type": "string", - "format": "date-time" + "type": "string" }, + "in": "path", + "name": "orgId", "required": true }, { "schema": { - "default": false, - "type": "boolean" + "default": "~", + "type": "string" }, "in": "query", - "name": "track_total_hits", + "name": "app_id", "required": false - }, - { - "schema": { - "$ref": "#/components/schemas/object" - }, - "in": "body", - "name": "body", - "description": "The search definition using the Elasticsearch Query DSL" } ], - "summary": "Count Events", + "summary": "Create New Email Template", "responses": { - "200": { + "201": { "description": "success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/object" + "$ref": "#/components/schemas/com.moesif.docdb.emailtemplates.EmailTemplateDocument" } } } } } - } - }, - "/search/~/mappings/usermetrics/properties": { + }, "get": { "security": [ { "managementAPIToken": [ - "read:users" + "read:email_templates" ] } ], "tags": [ - "Mappings" + "Email Templates" ], - "operationId": "getProperties", + "operationId": "getEmailTemplates", "parameters": [ { "schema": { @@ -7576,54 +7752,53 @@ }, { "schema": { + "default": "~", "type": "string" }, "in": "query", "name": "app_id", - "required": true + "required": false }, { "schema": { - "type": "string", - "format": "date-time" + "type": "string" }, "in": "query", - "name": "from", + "name": "cohort_id", "required": false } ], - "summary": "Get Property Mapping for UserMetrics", + "summary": "Get Email Templates", "responses": { "200": { - "description": "success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/object" - } - } - } + "description": "success" } } } }, - "/search/~/search/events": { + "/~/emails/templates/{id}": { "post": { "security": [ { "managementAPIToken": [ - "read:events" + "update:email_templates" ] } ], "tags": [ - "Metrics" - ], - "documentation": "https://www.moesif.com/docs/api#pagination-and-filtering", - "operationId": "searchEvents", - "consumes": [ - "application/json" + "Email Templates" ], + "operationId": "updateEmailTemplate", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EmailTemplateUpdateItem" + } + } + } + }, "parameters": [ { "schema": { @@ -7635,7 +7810,7 @@ }, { "schema": { - "default": "None", + "default": "~", "type": "string" }, "in": "query", @@ -7643,62 +7818,79 @@ "required": false }, { - "name": "from", - "in": "query", - "description": "The start date, which can be absolute such as 2023-07-01T00:00:00Z or relative such as -24h", "schema": { - "type": "string", - "format": "date-time" + "type": "string" }, + "in": "path", + "name": "id", "required": true - }, + } + ], + "summary": "Update an Email Template", + "responses": { + "200": { + "description": "success" + } + } + }, + "get": { + "security": [ + { + "managementAPIToken": [ + "read:email_templates" + ] + } + ], + "tags": [ + "Email Templates" + ], + "operationId": "getEmailTemplate", + "parameters": [ { - "name": "to", - "in": "query", - "description": "The end date, which can be absolute such as 2023-07-02T00:00:00Z or relative such as now", "schema": { - "type": "string", - "format": "date-time" + "type": "string" }, + "in": "path", + "name": "orgId", "required": true }, { "schema": { - "$ref": "#/components/schemas/object" + "default": "~", + "type": "string" + }, + "in": "query", + "name": "app_id", + "required": false + }, + { + "schema": { + "type": "string" }, - "in": "body", - "name": "body", - "description": "The search definition using the Elasticsearch Query DSL" + "in": "path", + "name": "id", + "required": true } ], - "summary": "Search Events", + "summary": "Get Email Template", "responses": { - "201": { - "description": "success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/searchEventsResponseDTO" - } - } - } + "200": { + "description": "success" } } - } - }, - "/search/~/companies/{id}/subscriptions": { - "get": { + }, + "delete": { "security": [ { "managementAPIToken": [ - "read:companies" + "delete:email_templates" ] } ], "tags": [ - "Subscriptions" + "Email Templates" ], - "operationId": "getCompanySubscriptions", + "operationId": "deleteEmailTemplate", "parameters": [ { "schema": { @@ -7726,38 +7918,37 @@ "required": true } ], - "summary": "Get the Subscriptions of a Company", + "summary": "Delete Email Template", "responses": { "200": { - "description": "success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/companyResponseDTO" - } - } - } + "description": "success" } } } }, - "/search/~/count/users": { + "/~/governance/rules": { "post": { "security": [ { "managementAPIToken": [ - "read:users" + "create:governance_rules" ] } ], "tags": [ - "Users" - ], - "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html", - "operationId": "countUsers", - "consumes": [ - "application/json" + "Governance Rules" ], + "operationId": "createGovernanceRule", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GovernanceRuleCreateItem" + } + } + } + }, "parameters": [ { "schema": { @@ -7769,49 +7960,40 @@ }, { "schema": { + "default": "~", "type": "string" }, "in": "query", "name": "app_id", - "required": true - }, - { - "schema": { - "$ref": "#/components/schemas/object" - }, - "in": "body", - "name": "body", - "description": "A query to restrict the results specified with the Elasticsearch Query DSL" + "required": false } ], - "summary": "Count Users", + "summary": "Create New Governance Rules", "responses": { - "200": { + "201": { "description": "success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/object" + "$ref": "#/components/schemas/GovernanceRulesDocument" } } } } } - } - }, - "/search/~/mappings/events/response/body/properties": { + }, "get": { "security": [ { "managementAPIToken": [ - "read:response_body_properties" + "read:governance_rules" ] } ], "tags": [ - "Mappings" + "Governance Rules" ], - "operationId": "getResponseBodyProperties", + "operationId": "getGovernanceRules", "parameters": [ { "schema": { @@ -7823,76 +8005,105 @@ }, { "schema": { + "default": "~", "type": "string" }, "in": "query", "name": "app_id", - "required": true - }, + "required": false + } + ], + "summary": "Get Governance Rules", + "responses": { + "200": { + "description": "success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GovernanceRulesDocument" + } + } + } + } + } + } + }, + "/~/governance/rules/{id}": { + "post": { + "security": [ { - "schema": { - "type": "string", - "format": "date-time" - }, - "in": "query", - "name": "from", - "required": true - }, + "managementAPIToken": [ + "update:governance_rules" + ] + } + ], + "tags": [ + "Governance Rules" + ], + "operationId": "updateGovernanceRule", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GovernanceRuleUpdateItem" + } + } + } + }, + "parameters": [ { "schema": { - "type": "string", - "format": "date-time" + "type": "string" }, - "in": "query", - "name": "to", + "in": "path", + "name": "orgId", "required": true }, { "schema": { - "default": false, - "type": "boolean" + "default": "~", + "type": "string" }, "in": "query", - "name": "include_values", + "name": "app_id", "required": false }, { "schema": { "type": "string" }, - "in": "query", - "name": "key_path", - "required": false + "in": "path", + "name": "id", + "required": true } ], - "summary": "Get Property Mapping for Events Response Body", + "summary": "Update a Governance Rule", "responses": { - "200": { + "201": { "description": "success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/object" + "$ref": "#/components/schemas/GovernanceRulesDocument" } } } } } - } - }, - "/search/~/mappings/users/properties": { + }, "get": { "security": [ { "managementAPIToken": [ - "read:users" + "read:governance_rules" ] } ], "tags": [ - "Mappings" + "Governance Rules" ], - "operationId": "getProperties", + "operationId": "getGovernanceRule", "parameters": [ { "schema": { @@ -7904,45 +8115,48 @@ }, { "schema": { + "default": "~", "type": "string" }, "in": "query", "name": "app_id", + "required": false + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "id", "required": true } ], - "summary": "Get Property Mapping for Users", + "summary": "Get a Governance Rule", "responses": { "200": { "description": "success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/object" + "$ref": "#/components/schemas/GovernanceRulesDocument" } } } } } - } - }, - "/search/~/companies": { - "post": { + }, + "delete": { "security": [ { "managementAPIToken": [ - "create:companies", - "update:companies" + "delete:governance_rules" ] } ], "tags": [ - "Companies" - ], - "operationId": "updateCompanies", - "consumes": [ - "application/json" + "Governance Rules" ], + "operationId": "deleteGovernanceRule", "parameters": [ { "schema": { @@ -7963,40 +8177,45 @@ }, { "schema": { - "$ref": "#/components/schemas/CompanyUpdateDTO" + "type": "string" }, - "in": "body", - "name": "body" + "in": "path", + "name": "id", + "required": true } ], - "summary": "Update a Company", + "summary": "Delete a Governance Rule", "responses": { - "200": { - "description": "success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/companyResponseDTO" - } - } - } + "204": { + "description": "success" } } } }, - "/search/~/mappings/companymetrics/properties": { - "get": { + "/~/workspaces": { + "post": { "security": [ { "managementAPIToken": [ - "read:companies" + "create:workspaces", + "create:public_workspaces" ] } ], "tags": [ - "Mappings" + "Workspaces" ], - "operationId": "getProperties", + "operationId": "createWorkspace", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WorkspaceCreateItem" + } + } + } + }, "parameters": [ { "schema": { @@ -8008,11 +8227,12 @@ }, { "schema": { + "default": "~", "type": "string" }, "in": "query", "name": "app_id", - "required": true + "required": false }, { "schema": { @@ -8020,42 +8240,36 @@ "format": "date-time" }, "in": "query", - "name": "from", + "name": "expiration", "required": false } ], - "summary": "Get Property Mapping for CompanyMetrics", + "summary": "Create New Workspace", "responses": { - "200": { + "201": { "description": "success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/object" + "$ref": "#/components/schemas/WorkspaceDocument" } } } } } - } - }, - "/search/~/companies/batch": { - "post": { + }, + "get": { "security": [ { "managementAPIToken": [ - "create:companies", - "update:companies" + "read:workspaces" ] } ], "tags": [ - "Companies" - ], - "operationId": "batchUpdateCompanies", - "consumes": [ - "application/json" + "Workspaces" ], + "operationId": "getWorkspaces", "parameters": [ { "schema": { @@ -8074,25 +8288,56 @@ "name": "app_id", "required": false }, + { + "schema": { + "format": "int32", + "type": "integer" + }, + "in": "query", + "name": "take", + "required": true + }, + { + "schema": { + "default": "None", + "type": "string" + }, + "in": "query", + "name": "before_id", + "required": false + }, + { + "schema": { + "default": "sequence", + "type": "string" + }, + "in": "query", + "name": "`type`", + "required": false + }, { "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/CompanyUpdateDTO" + "type": "string" } }, - "in": "body", - "name": "body" + "in": "query", + "name": "access", + "required": true } ], - "summary": "Update Companies in Batch", + "summary": "Get Workspaces", "responses": { "200": { "description": "success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/companyResponseDTO" + "type": "array", + "items": { + "$ref": "#/components/schemas/WorkspaceDocument" + } } } } @@ -8100,23 +8345,19 @@ } } }, - "/search/~/users": { - "post": { + "/~/workspaces/templates": { + "get": { "security": [ { "managementAPIToken": [ - "create:users", - "update:users" + "read:workspaces" ] } ], "tags": [ - "Users" - ], - "operationId": "updateUsers", - "consumes": [ - "application/json" + "Workspaces" ], + "operationId": "getWorkspaceTemplates", "parameters": [ { "schema": { @@ -8134,23 +8375,19 @@ "in": "query", "name": "app_id", "required": false - }, - { - "schema": { - "$ref": "#/components/schemas/UserUpdateDTO" - }, - "in": "body", - "name": "body" } ], - "summary": "Update a User", + "summary": "Get Workspace Templates", "responses": { "200": { "description": "success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/userResponseDTO" + "type": "array", + "items": { + "$ref": "#/components/schemas/WorkspaceDocument" + } } } } @@ -8158,23 +8395,31 @@ } } }, - "/search/~/search/usermetrics/users": { + "/~/workspaces/{id}": { "post": { + "body": null, "security": [ { "managementAPIToken": [ - "read:users" + "update:workspaces", + "update:public_workspaces" ] } ], "tags": [ - "Users" - ], - "documentation": "https://www.moesif.com/docs/api#pagination-and-filtering", - "operationId": "searchUserMetrics", - "consumes": [ - "application/json" + "Workspaces" ], + "operationId": "updateWorkspace", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WorkspaceUpdateItem" + } + } + } + }, "parameters": [ { "schema": { @@ -8193,163 +8438,87 @@ "name": "app_id", "required": false }, - { - "name": "from", - "in": "query", - "description": "The start date, which can be absolute such as 2023-07-01T00:00:00Z or relative such as -24h", - "schema": { - "type": "string", - "format": "date-time" - }, - "required": false - }, - { - "name": "to", - "in": "query", - "description": "The end date, which can be absolute such as 2023-07-02T00:00:00Z or relative such as now", - "schema": { - "type": "string", - "format": "date-time" - }, - "required": false - }, { "schema": { - "$ref": "#/components/schemas/object" + "type": "string" }, - "in": "body", - "name": "body", - "description": "The search definition using the Elasticsearch Query DSL" + "in": "path", + "name": "id", + "required": true } ], - "summary": "Search UserMetrics/Users", + "summary": "Update a Workspace", "responses": { "200": { - "description": "success", - "content": "application/json" + "description": "success" } } - } - }, - "/search/~/workspaces/{workspaceId}/search": { - "post": { + }, + "get": { "security": [ { "managementAPIToken": [ - "read:events" + "read:workspaces" ] } ], "tags": [ - "Metrics" - ], - "documentation": "https://www.moesif.com/docs/api#pagination-and-filtering", - "operationId": "searchPublicWorkspaces", - "consumes": [ - "application/json" + "Workspaces" ], + "operationId": "getWorkspace", "parameters": [ { "schema": { "type": "string" }, "in": "path", - "name": "orgId", - "required": true - }, - { - "schema": { - "default": "~", - "type": "string" - }, - "in": "query", - "name": "app_id", - "required": false - }, - { - "name": "from", - "in": "query", - "description": "The start date, which can be absolute such as 2023-07-01T00:00:00Z or relative such as -24h", - "schema": { - "type": "string", - "format": "date-time" - }, - "required": true - }, - { - "name": "to", - "in": "query", - "description": "The end date, which can be absolute such as 2023-07-02T00:00:00Z or relative such as now", - "schema": { - "type": "string", - "format": "date-time" - }, - "required": true - }, - { - "schema": { - "type": "string" - }, - "in": "path", - "name": "workspaceId", - "required": true - }, - { - "schema": { - "default": false, - "type": "boolean" - }, - "in": "query", - "name": "include_details", - "required": false + "name": "orgId", + "required": true }, { "schema": { - "default": 1000, - "format": "int32", - "type": "integer" + "default": "~", + "type": "string" }, "in": "query", - "name": "take", + "name": "app_id", "required": false }, { "schema": { - "$ref": "#/components/schemas/object" + "type": "string" }, - "in": "body", - "name": "body", - "description": "The search definition using the Elasticsearch Query DSL" + "in": "path", + "name": "id", + "required": true } ], - "summary": "Search Events in saved public Workspace", + "summary": "Get a Workspace", "responses": { - "201": { + "200": { "description": "success", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/searchEventsResponseDTO" + "$ref": "#/components/schemas/WorkspaceDocument" } } } } } - } - }, - "/search/~/events/{id}": { - "get": { + }, + "delete": { "security": [ { "managementAPIToken": [ - "read:events" + "delete:workspaces" ] } ], "tags": [ - "Metrics" + "Workspaces" ], - "operationId": "getEvent", + "operationId": "deleteWorkspace", "parameters": [ { "schema": { @@ -8375,49 +8544,39 @@ "in": "path", "name": "id", "required": true - }, - { - "schema": { - "type": "string", - "format": "date-time" - }, - "in": "query", - "name": "event_time", - "required": true } ], - "summary": "Get an Event", + "summary": "Delete a Workspace", "responses": { "200": { - "description": "success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/eventResponseDTO" - } - } - } + "description": "success" } } } }, - "/search/~/subscriptions/batch": { + "/~/workspaces/{id}/comments": { "post": { "security": [ { "managementAPIToken": [ - "create:subscriptions", - "update:subscriptions" + "update:workspaces" ] } ], "tags": [ - "Subscriptions" - ], - "operationId": "batchCreateSubscriptions", - "consumes": [ - "application/json" + "Workspaces" ], + "operationId": "createComment", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CommentItem" + } + } + } + }, "parameters": [ { "schema": { @@ -8438,47 +8597,32 @@ }, { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/AddSubscriptionDTO" - } + "type": "string" }, - "in": "body", - "name": "body" + "in": "path", + "name": "id", + "required": true } ], - "summary": "Create or Update Subscriptions in Batch", + "summary": "Create a New Comment", "responses": { - "200": { - "description": "success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SubscriptionDTO" - } - } - } + "201": { + "description": "success" } } - } - }, - "/search/~/users/batch": { - "post": { + }, + "get": { "security": [ { "managementAPIToken": [ - "create:users", - "update:users" + "read:workspaces" ] } ], "tags": [ - "Users" - ], - "operationId": "batchUpdateUsers", - "consumes": [ - "application/json" + "Workspaces" ], + "operationId": "getComments", "parameters": [ { "schema": { @@ -8499,43 +8643,44 @@ }, { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserUpdateDTO" - } + "type": "string" }, - "in": "body", - "name": "body" + "in": "path", + "name": "id", + "required": true } ], - "summary": "Update Users in Batch", + "summary": "Get all Comments", "responses": { "200": { - "description": "success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/userResponseDTO" - } - } - } + "description": "success" } } } }, - "/search/~/users/{id}": { - "get": { + "/~/workspaces/{id}/comments/{commentId}": { + "post": { "security": [ { "managementAPIToken": [ - "read:users" + "update:workspaces" ] } ], "tags": [ - "Users" + "Workspaces" ], - "operationId": "getUser", + "operationId": "updateComment", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CommentItem" + } + } + } + }, "parameters": [ { "schema": { @@ -8561,19 +8706,20 @@ "in": "path", "name": "id", "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "commentId", + "required": true } ], - "summary": "Get a User", + "summary": "Update Existing Comment", "responses": { - "200": { - "description": "success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/userResponseDTO" - } - } - } + "201": { + "description": "success" } } }, @@ -8581,14 +8727,14 @@ "security": [ { "managementAPIToken": [ - "delete:users" + "update:workspaces" ] } ], "tags": [ - "Users" + "Workspaces" ], - "operationId": "deleteUser", + "operationId": "deleteComment", "parameters": [ { "schema": { @@ -8616,41 +8762,35 @@ "required": true }, { - "name": "delete_events", - "in": "query", - "description": "Delete events associated with the user which can be set to true or false(default)", "schema": { - "default": false, - "type": "boolean" + "type": "string" }, - "required": false + "in": "path", + "name": "commentId", + "required": true } ], - "summary": "Delete a User", + "summary": "Delete a Comment", "responses": { - "200": { + "204": { "description": "success" } } } }, - "/search/~/count/companies": { + "/~/workspaces/{id}/policy/acl": { "post": { "security": [ { "managementAPIToken": [ - "read:companies" + "create:workspaces" ] } ], "tags": [ - "Companies" - ], - "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html", - "operationId": "countCompanies", - "consumes": [ - "application/json" + "Workspaces" ], + "operationId": "addACLPermissions", "parameters": [ { "schema": { @@ -8662,53 +8802,58 @@ }, { "schema": { + "default": "~", "type": "string" }, "in": "query", "name": "app_id", + "required": false + }, + { + "schema": { + "type": "string" + }, + "in": "path", + "name": "id", "required": true }, { "schema": { - "$ref": "#/components/schemas/object" + "type": "string" + }, + "in": "query", + "name": "grantee", + "required": false + }, + { + "schema": { + "default": "None", + "type": "string" }, - "in": "body", - "name": "body", - "description": "A query to restrict the results specified with the Elasticsearch Query DSL" + "in": "query", + "name": "permission", + "required": false } ], - "summary": "Count Companies", + "summary": "Add ACL permission", "responses": { "200": { - "description": "success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/object" - } - } - } + "description": "success" } } - } - }, - "/search/~/subscriptions": { - "post": { + }, + "delete": { "security": [ { "managementAPIToken": [ - "create:subscriptions", - "update:subscriptions" + "delete:workspaces" ] } ], "tags": [ - "Subscriptions" - ], - "operationId": "createSubscription", - "consumes": [ - "application/json" + "Workspaces" ], + "operationId": "deleteACLPermissions", "parameters": [ { "schema": { @@ -8729,23 +8874,25 @@ }, { "schema": { - "$ref": "#/components/schemas/AddSubscriptionDTO" + "type": "string" + }, + "in": "path", + "name": "id", + "required": true + }, + { + "schema": { + "type": "string" }, - "in": "body", - "name": "body" + "in": "query", + "name": "grantee", + "required": true } ], - "summary": "Create or Update a Subscription", + "summary": "Delete ACL permission", "responses": { "200": { - "description": "success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SubscriptionDTO" - } - } - } + "description": "success" } } }