diff --git a/index.html b/index.html index 5eb60e3..3f0c7d0 100644 --- a/index.html +++ b/index.html @@ -20759,240 +20759,239 @@
++Code samples
+
# You can also use wget
+curl -X POST https://api.moesif.com/v1/search/~/search/companymetrics/companies \
+ -H 'Accept: 0' \
+ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'
-> Code samples
+
const fetch = require('node-fetch');
-“`shell
-# You can also use wget
-curl -X POST https://api.moesif.com/v1/search/~/search/companymetrics/companies \
- -H ‘Accept: 0’ \
- -H ‘Authorization: Bearer YOUR_MANAGEMENT_API_KEY’
+const headers = {
+ 'Accept':'0',
+ 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
+};
-”`
+fetch('https://api.moesif.com/v1/search/~/search/companymetrics/companies',
+{
+ method: 'POST',
-“`javascript–nodejs
-const fetch = require(‘node-fetch’);
+ headers: headers
+})
+.then(function(res) {
+ return res.json();
+}).then(function(body) {
+ console.log(body);
+});
-const headers = {
- ‘Accept’:‘0’,
- ‘Authorization’:‘Bearer YOUR_MANAGEMENT_API_KEY’
-};
+
import requests
+headers = {
+ 'Accept': '0',
+ 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
+}
-fetch(‘https://api.moesif.com/v1/search/~/search/companymetrics/companies’,
-{
- method: ‘POST’,
+r = requests.post('https://api.moesif.com/v1/search/~/search/companymetrics/companies', headers = headers)
- headers: headers
-})
-.then(function(res) {
- return res.json();
-}).then(function(body) {
- console.log(body);
-});
+print(r.json())
-”`
+
require 'rest-client'
+require 'json'
-“`python
-import requests
-headers = {
- ‘Accept’: ‘0’,
- ‘Authorization’: ‘Bearer YOUR_MANAGEMENT_API_KEY’
-}
+headers = {
+ 'Accept' => '0',
+ 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
+}
-r = requests.post(‘https://api.moesif.com/v1/search/~/search/companymetrics/companies’, headers = headers)
+result = RestClient.post 'https://api.moesif.com/v1/search/~/search/companymetrics/companies',
+ params: {
+ }, headers: headers
-print(r.json())
+p JSON.parse(result)
-”`
+
<?php
-“`ruby
-require ‘rest-client’
-require ‘json’
+require 'vendor/autoload.php';
-headers = {
- ‘Accept’ => ‘0’,
- ‘Authorization’ => ‘Bearer YOUR_MANAGEMENT_API_KEY’
-}
+$headers = array(
+ 'Accept' => '0',
+ 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
+);
-result = RestClient.post ‘https://api.moesif.com/v1/search/~/search/companymetrics/companies’,
- params: {
- }, headers: headers
+$client = new \GuzzleHttp\Client();
-p JSON.parse(result)
+// Define array of request body.
+$request_body = array();
-”`
+try {
+ $response = $client->request('POST','https://api.moesif.com/v1/search/~/search/companymetrics/companies', 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());
+ }
-“`php
-// ...
+
+
package main
-require 'vendor/autoload.php';
+import (
+ "bytes"
+ "net/http"
+)
-$headers = array(
- 'Accept' => ‘0’,
- ‘Authorization’ => ‘Bearer YOUR_MANAGEMENT_API_KEY’,
-);
+func main() {
-$client = new \GuzzleHttp\Client();
+ headers := map[string][]string{
+ "Accept": []string{"0"},
+ "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
+ }
-// Define array of request body.
-$request_body = array();
+ data := bytes.NewBuffer([]byte{jsonReq})
+ req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/search/companymetrics/companies", data)
+ req.Header = headers
-try {
- $response = $client->request(‘POST’,‘https://api.moesif.com/v1/search/~/search/companymetrics/companies’, 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());
- }
+ client := &http.Client{}
+ resp, err := client.Do(req)
+ // ...
+}
- // …
+
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;
-”`
+/// <<summary>>
+/// Example of Http Client
+/// <</summary>>
+public class HttpExample
+{
+ private HttpClient Client { get; set; }
-“`go
-package main
+ /// <<summary>>
+ /// Setup http client
+ /// <</summary>>
+ public HttpExample()
+ {
+ Client = new HttpClient();
+ }
-import (
- "bytes”
- “net/http”
-)
-func main() {
+ /// Make a dummy request
+ public async Task MakePostRequest()
+ {
+ string url = "https://api.moesif.com/v1/search/~/search/companymetrics/companies";
- 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.Header = headers
+ await PostAsync(null, url);
- 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/search/~/search/companymetrics/companies”;
-
-
- await PostAsync(null, url);
-
- }
+ /// Performs a POST Request
+ public async Task PostAsync(undefined content, string url)
+ {
+ //Serialize Object
+ StringContent jsonContent = SerializeObject(content);
- /// 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);
+ }
- //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);
- }
-}
+ /// Serialize an object to Json
+ private StringContent SerializeObject(undefined content)
+ {
+ //Serialize Object
+ string jsonObject = JsonConvert.SerializeObject(content);
-“`
-
-”`java
-URL obj = new URL(“https://api.moesif.com/v1/search/~/search/companymetrics/companies”);
-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());
+ //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);
+ }
+}
-“`
+
URL obj = new URL("https://api.moesif.com/v1/search/~/search/companymetrics/companies");
+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 https://api.moesif.com/v1/search/~/search/companymetrics/companies`
+
+POST https://api.moesif.com/v1/search/~/search/companymetrics/companies
Search CompanyMetrics/Companies
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| +|body|body|undefined|false|The search definition using the Elasticsearch Query DSL|
-> Example responses ++Example responses
+
Status | +Meaning | +Description | +Schema | +
---|---|---|---|
200 | +OK | +success | +None | +
++Code samples
+
# 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' \
+ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'
-const headers = {
- ‘Accept’:‘application/json’,
- ‘Authorization’:‘Bearer YOUR_MANAGEMENT_API_KEY’
-};
+
const fetch = require('node-fetch');
-fetch(‘https://api.moesif.com/v1/search/~/search/events?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z’,
-{
- method: ‘POST’,
+const headers = {
+ 'Accept':'application/json',
+ 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
+};
- headers: headers
-})
-.then(function(res) {
- return res.json();
-}).then(function(body) {
- console.log(body);
-});
+fetch('https://api.moesif.com/v1/search/~/search/events?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z',
+{
+ 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’
-}
+
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.post('https://api.moesif.com/v1/search/~/search/events', params={
+ 'from': '2019-08-24T14:15:22Z', 'to': '2019-08-24T14:15:22Z'
+}, headers = headers)
-print(r.json())
+print(r.json())
-“`
+
require 'rest-client'
+require 'json'
-”`ruby
-require ‘rest-client’
-require ‘json’
+headers = {
+ 'Accept' => 'application/json',
+ 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
+}
-headers = {
- ‘Accept’ => ‘application/json’,
- ‘Authorization’ => ‘Bearer YOUR_MANAGEMENT_API_KEY’
-}
+result = RestClient.post 'https://api.moesif.com/v1/search/~/search/events',
+ params: {
+ 'from' => 'string(date-time)',
+'to' => 'string(date-time)'
+}, headers: headers
-result = RestClient.post ‘https://api.moesif.com/v1/search/~/search/events’,
- params: {
- ‘from’ => ‘string(date-time)’,
-‘to’ => ‘string(date-time)’
-}, headers: headers
+p JSON.parse(result)
-p JSON.parse(result)
+
<?php
-“`
+require 'vendor/autoload.php';
-”`php
-$headers = array(
+ 'Accept' => 'application/json',
+ 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
+);
-require 'vendor/autoload.php';
+$client = new \GuzzleHttp\Client();
-$headers = array(
- 'Accept' => ‘application/json’,
- ‘Authorization’ => ‘Bearer YOUR_MANAGEMENT_API_KEY’,
-);
+// Define array of request body.
+$request_body = array();
-$client = new \GuzzleHttp\Client();
+try {
+ $response = $client->request('POST','https://api.moesif.com/v1/search/~/search/events', 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());
+ }
-// Define array of request body.
-$request_body = array();
+ // ...
+
+
package main
-try {
- $response = $client->request(‘POST’,‘https://api.moesif.com/v1/search/~/search/events’, 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());
- }
+import (
+ "bytes"
+ "net/http"
+)
- // …
+func main() {
-“`
+ headers := map[string][]string{
+ "Accept": []string{"application/json"},
+ "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
+ }
-”`go
-package main
+ data := bytes.NewBuffer([]byte{jsonReq})
+ req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/search/events", data)
+ req.Header = headers
-import (
- “bytes”
- “net/http”
-)
+ client := &http.Client{}
+ resp, err := client.Do(req)
+ // ...
+}
-func main() {
+
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;
- headers := map[string][]string{
- “Accept”: []string{“application/json”},
- “Authorization”: []string{“Bearer YOUR_MANAGEMENT_API_KEY”},
- }
+/// <<summary>>
+/// Example of Http Client
+/// <</summary>>
+public class HttpExample
+{
+ private HttpClient Client { get; set; }
- data := bytes.NewBuffer([]byte{jsonReq})
- req, err := http.NewRequest(“POST”, “https://api.moesif.com/v1/search/~/search/events”, data)
- req.Header = headers
+ /// <<summary>>
+ /// Setup http client
+ /// <</summary>>
+ public HttpExample()
+ {
+ Client = new HttpClient();
+ }
- 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/search/~/search/events”;
-
-
- await PostAsync(null, url);
-
- }
+ /// Make a dummy request
+ public async Task MakePostRequest()
+ {
+ string url = "https://api.moesif.com/v1/search/~/search/events";
- /// 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);
+ await PostAsync(null, url);
- //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();
+ }
+
+ /// 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);
+ }
- //Deserialize Body to object
- var result = JsonConvert.DeserializeObject(responseBody);
- }
-}
-“`
-
-”`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”);
-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());
-“`
+ /// Serialize an object to Json
+ private StringContent SerializeObject(undefined content)
+ {
+ //Serialize Object
+ string jsonObject = JsonConvert.SerializeObject(content);
-`POST https://api.moesif.com/v1/search/~/search/events`
+ //Create Json UTF8 String Content
+ return new StringContent(jsonObject, Encoding.UTF8, "application/json");
+ }
-*Search Events*
+ /// Deserialize object from request response
+ private async Task DeserializeObject(HttpResponseMessage response)
+ {
+ //Read body
+ string responseBody = await response.Content.ReadAsStringAsync();
-Parameters
+ //Deserialize Body to object
+ var result = JsonConvert.DeserializeObject(responseBody);
+ }
+}
+
+
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");
+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 https://api.moesif.com/v1/search/~/search/events
Search Events
+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”: { - “duration_ms”: 76, - “request”: { - “body”: {}, - “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”: “2019-07-09T06:14:58.550”, - “headers”: { - “_accept-_encoding”: “gzip, deflate”, - “_connection”: “close”, - “_cache-_control”: “no-cache”, - “_user-_agent”: “PostmanRuntime/7.1.1”, - “_host”: “api.github.com”, - “_accept”: “*/*” - } - }, - “user_id”: “123454”, - “response”: { - “headers”: { - “_vary”: “Accept”, - “_cache-_control”: “public, max-age=60, s-maxage=60”, - “_strict-_transport-_security”: “max-age=31536000; includeSubdomains; preload”, - “_access-_control-_expose-_headers”: “ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval”, - “_content-_security-_policy”: “default-src ‘none’”, - “_transfer-_encoding”: “chunked”, - “_e_tag”: “W/"7dc470913f1fe9bb6c7355b50a0737bc"”, - “_content-_type”: “application/json; charset=utf-8”, - “_access-_control-_allow-_origin”: “*” - }, - “time”: “2019-07-09T06:14:58.626”, - “body”: {}, - “status”: 200 - }, - “id”: “AWF5M-FDTqLFD8l5y2f4”, - “session_token”: “rdfmnw3fu24309efjc534nb421UZ9-]2JDO[ME”, - “metadata”: {}, - “app_id”: “198:3”, - “org_id”: “177:3”, - “user”: {} - }, - “sort”: [ - 0 - ] - } - ] - } -} -“` +|body|body|undefined|false|The search definition using the Elasticsearch Query DSL|
+++Example responses
+ +201 Response
+
{
+ "took": 358,
+ "timed_out": false,
+ "hits": {
+ "total": 947,
+ "hits": [
+ {
+ "_id": "AWF5M-FDTqLFD8l5y2f4",
+ "_source": {
+ "duration_ms": 76,
+ "request": {
+ "body": {},
+ "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": "2019-07-09T06:14:58.550",
+ "headers": {
+ "_accept-_encoding": "gzip, deflate",
+ "_connection": "close",
+ "_cache-_control": "no-cache",
+ "_user-_agent": "PostmanRuntime/7.1.1",
+ "_host": "api.github.com",
+ "_accept": "*/*"
+ }
+ },
+ "user_id": "123454",
+ "response": {
+ "headers": {
+ "_vary": "Accept",
+ "_cache-_control": "public, max-age=60, s-maxage=60",
+ "_strict-_transport-_security": "max-age=31536000; includeSubdomains; preload",
+ "_access-_control-_expose-_headers": "ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
+ "_content-_security-_policy": "default-src 'none'",
+ "_transfer-_encoding": "chunked",
+ "_e_tag": "W/\"7dc470913f1fe9bb6c7355b50a0737bc\"",
+ "_content-_type": "application/json; charset=utf-8",
+ "_access-_control-_allow-_origin": "*"
+ },
+ "time": "2019-07-09T06:14:58.626",
+ "body": {},
+ "status": 200
+ },
+ "id": "AWF5M-FDTqLFD8l5y2f4",
+ "session_token": "rdfmnw3fu24309efjc534nb421UZ9-]2JDO[ME",
+ "metadata": {},
+ "app_id": "198:3",
+ "org_id": "177:3",
+ "user": {}
+ },
+ "sort": [
+ 0
+ ]
+ }
+ ]
+ }
+}
+
Status | +Meaning | +Description | +Schema | +
---|---|---|---|
201 | +Created | +success | +searchEventsResponseDTO | +
++Code samples
+
# 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' \
+ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'
-”`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’ \
- -H ‘Authorization: Bearer YOUR_MANAGEMENT_API_KEY’
+
const fetch = require('node-fetch');
-“`
+const headers = {
+ 'Accept':'application/json',
+ 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
+};
-”`javascript–nodejs
-const fetch = require(‘node-fetch’);
+fetch('https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z',
+{
+ method: 'POST',
-const headers = {
- ‘Accept’:‘application/json’,
- ‘Authorization’:‘Bearer YOUR_MANAGEMENT_API_KEY’
-};
+ headers: headers
+})
+.then(function(res) {
+ return res.json();
+}).then(function(body) {
+ console.log(body);
+});
-fetch(‘https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z’,
-{
- method: ‘POST’,
+
import requests
+headers = {
+ 'Accept': 'application/json',
+ 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
+}
- headers: headers
-})
-.then(function(res) {
- return res.json();
-}).then(function(body) {
- console.log(body);
-});
+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)
-“`
+print(r.json())
-”`python
-import requests
-headers = {
- ‘Accept’: ‘application/json’,
- ‘Authorization’: ‘Bearer YOUR_MANAGEMENT_API_KEY’
-}
+
require 'rest-client'
+require 'json'
-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)
+headers = {
+ 'Accept' => 'application/json',
+ 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
+}
-print(r.json())
+result = RestClient.post 'https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search',
+ params: {
+ 'from' => 'string(date-time)',
+'to' => 'string(date-time)'
+}, headers: headers
-“`
+p JSON.parse(result)
-”`ruby
-require ‘rest-client’
-require ‘json’
+
<?php
-headers = {
- ‘Accept’ => ‘application/json’,
- ‘Authorization’ => ‘Bearer YOUR_MANAGEMENT_API_KEY’
-}
+require 'vendor/autoload.php';
-result = RestClient.post ‘https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search’,
- params: {
- ‘from’ => ‘string(date-time)’,
-‘to’ => ‘string(date-time)’
-}, headers: headers
+$headers = array(
+ 'Accept' => 'application/json',
+ 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
+);
-p JSON.parse(result)
+$client = new \GuzzleHttp\Client();
-“`
+// Define array of request body.
+$request_body = array();
-”`php
-try {
+ $response = $client->request('POST','https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search', 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());
+ }
-require 'vendor/autoload.php';
+ // ...
+
+
package main
-$headers = array(
- 'Accept' => ‘application/json’,
- ‘Authorization’ => ‘Bearer YOUR_MANAGEMENT_API_KEY’,
-);
+import (
+ "bytes"
+ "net/http"
+)
-$client = new \GuzzleHttp\Client();
+func main() {
-// Define array of request body.
-$request_body = array();
+ headers := map[string][]string{
+ "Accept": []string{"application/json"},
+ "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
+ }
-try {
- $response = $client->request(‘POST’,‘https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search’, 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());
- }
+ data := bytes.NewBuffer([]byte{jsonReq})
+ req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search", data)
+ req.Header = headers
- // …
+ client := &http.Client{}
+ resp, err := client.Do(req)
+ // ...
+}
-“`
+
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;
-”`go
-package main
+/// <<summary>>
+/// Example of Http Client
+/// <</summary>>
+public class HttpExample
+{
+ private HttpClient Client { get; set; }
-import (
- “bytes”
- “net/http”
-)
+ /// <<summary>>
+ /// Setup http client
+ /// <</summary>>
+ public HttpExample()
+ {
+ Client = new HttpClient();
+ }
-func main() {
- headers := map[string][]string{
- “Accept”: []string{“application/json”},
- “Authorization”: []string{“Bearer YOUR_MANAGEMENT_API_KEY”},
- }
+ /// Make a dummy request
+ public async Task MakePostRequest()
+ {
+ string url = "https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search";
- data := bytes.NewBuffer([]byte{jsonReq})
- req, err := http.NewRequest(“POST”, “https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search”, data)
- req.Header = headers
- client := &http.Client{}
- resp, err := client.Do(req)
- // …
-}
+ await PostAsync(null, url);
-“`
-
-”`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/search/~/workspaces/{workspaceId}/search”;
-
-
- await PostAsync(null, url);
-
- }
+ }
- /// Performs a POST Request
- public async Task PostAsync(undefined content, string url)
- {
- //Serialize Object
- StringContent jsonContent = SerializeObject(content);
+ /// 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);
+ //Execute POST request
+ HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
+ }
- //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/search/~/workspaces/{workspaceId}/search?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z”);
-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());
+ /// 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");
+ }
-`POST https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search`
+ /// Deserialize object from request response
+ private async Task DeserializeObject(HttpResponseMessage response)
+ {
+ //Read body
+ string responseBody = await response.Content.ReadAsStringAsync();
-*Search Events in saved public Workspace*
+ //Deserialize Body to object
+ var result = JsonConvert.DeserializeObject(responseBody);
+ }
+}
-Parameters
+
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");
+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());
-|Name|In|Type|Required|Description|
-|—|—|—|—|—|
+
+POST https://api.moesif.com/v1/search/~/workspaces/{workspaceId}/search
Search Events in saved public Workspace
+ +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| - -> Example responses - -> 201 Response - -”`json -{ - “took”: 358, - “timed_out”: false, - “hits”: { - “total”: 947, - “hits”: [ - { - “_id”: “AWF5M-FDTqLFD8l5y2f4”, - “_source”: { - “duration_ms”: 76, - “request”: { - “body”: {}, - “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”: “2019-07-09T06:14:58.550”, - “headers”: { - “_accept-_encoding”: “gzip, deflate”, - “_connection”: “close”, - “_cache-_control”: “no-cache”, - “_user-_agent”: “PostmanRuntime/7.1.1”, - “_host”: “api.github.com”, - “_accept”: “*/*” - } - }, - “user_id”: “123454”, - “response”: { - “headers”: { - “_vary”: “Accept”, - “_cache-_control”: “public, max-age=60, s-maxage=60”, - “_strict-_transport-_security”: “max-age=31536000; includeSubdomains; preload”, - “_access-_control-_expose-_headers”: “ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval”, - “_content-_security-_policy”: “default-src ‘none’”, - “_transfer-_encoding”: “chunked”, - “_e_tag”: “W/"7dc470913f1fe9bb6c7355b50a0737bc"”, - “_content-_type”: “application/json; charset=utf-8”, - “_access-_control-_allow-_origin”: “*” - }, - “time”: “2019-07-09T06:14:58.626”, - “body”: {}, - “status”: 200 - }, - “id”: “AWF5M-FDTqLFD8l5y2f4”, - “session_token”: “rdfmnw3fu24309efjc534nb421UZ9-]2JDO[ME”, - “metadata”: {}, - “app_id”: “198:3”, - “org_id”: “177:3”, - “user”: {} - }, - “sort”: [ - 0 - ] - } - ] - } -} -“` +|body|body|undefined|false|The search definition using the Elasticsearch Query DSL|
+ +++Example responses
+201 Response
+
{
+ "took": 358,
+ "timed_out": false,
+ "hits": {
+ "total": 947,
+ "hits": [
+ {
+ "_id": "AWF5M-FDTqLFD8l5y2f4",
+ "_source": {
+ "duration_ms": 76,
+ "request": {
+ "body": {},
+ "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": "2019-07-09T06:14:58.550",
+ "headers": {
+ "_accept-_encoding": "gzip, deflate",
+ "_connection": "close",
+ "_cache-_control": "no-cache",
+ "_user-_agent": "PostmanRuntime/7.1.1",
+ "_host": "api.github.com",
+ "_accept": "*/*"
+ }
+ },
+ "user_id": "123454",
+ "response": {
+ "headers": {
+ "_vary": "Accept",
+ "_cache-_control": "public, max-age=60, s-maxage=60",
+ "_strict-_transport-_security": "max-age=31536000; includeSubdomains; preload",
+ "_access-_control-_expose-_headers": "ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
+ "_content-_security-_policy": "default-src 'none'",
+ "_transfer-_encoding": "chunked",
+ "_e_tag": "W/\"7dc470913f1fe9bb6c7355b50a0737bc\"",
+ "_content-_type": "application/json; charset=utf-8",
+ "_access-_control-_allow-_origin": "*"
+ },
+ "time": "2019-07-09T06:14:58.626",
+ "body": {},
+ "status": 200
+ },
+ "id": "AWF5M-FDTqLFD8l5y2f4",
+ "session_token": "rdfmnw3fu24309efjc534nb421UZ9-]2JDO[ME",
+ "metadata": {},
+ "app_id": "198:3",
+ "org_id": "177:3",
+ "user": {}
+ },
+ "sort": [
+ 0
+ ]
+ }
+ ]
+ }
+}
+
Status | +Meaning | +Description | +Schema | +
---|---|---|---|
201 | +Created | +success | +searchEventsResponseDTO | +
++Code samples
+
# You can also use wget
+curl -X POST https://api.moesif.com/v1/search/~/search/usermetrics/users \
+ -H 'Accept: 0' \
+ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'
-> Code samples
+
const fetch = require('node-fetch');
+
+const headers = {
+ 'Accept':'0',
+ 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
+};
+
+fetch('https://api.moesif.com/v1/search/~/search/usermetrics/users',
+{
+ method: 'POST',
-”`shell
-# You can also use wget
-curl -X POST https://api.moesif.com/v1/search/~/search/usermetrics/users \
- -H ‘Accept: 0’ \
- -H ‘Authorization: Bearer YOUR_MANAGEMENT_API_KEY’
+ headers: headers
+})
+.then(function(res) {
+ return res.json();
+}).then(function(body) {
+ console.log(body);
+});
-“`
+
import requests
+headers = {
+ 'Accept': '0',
+ 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
+}
-”`javascript–nodejs
-const fetch = require(‘node-fetch’);
+r = requests.post('https://api.moesif.com/v1/search/~/search/usermetrics/users', headers = headers)
-const headers = {
- ‘Accept’:‘0’,
- ‘Authorization’:‘Bearer YOUR_MANAGEMENT_API_KEY’
-};
+print(r.json())
-fetch(‘https://api.moesif.com/v1/search/~/search/usermetrics/users’,
-{
- method: ‘POST’,
+
require 'rest-client'
+require 'json'
- headers: headers
-})
-.then(function(res) {
- return res.json();
-}).then(function(body) {
- console.log(body);
-});
+headers = {
+ 'Accept' => '0',
+ 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
+}
-“`
+result = RestClient.post 'https://api.moesif.com/v1/search/~/search/usermetrics/users',
+ params: {
+ }, headers: headers
-”`python
-import requests
-headers = {
- ‘Accept’: ‘0’,
- ‘Authorization’: ‘Bearer YOUR_MANAGEMENT_API_KEY’
-}
+p JSON.parse(result)
-r = requests.post(‘https://api.moesif.com/v1/search/~/search/usermetrics/users’, headers = headers)
+
<?php
-print(r.json())
+require 'vendor/autoload.php';
-“`
+$headers = array(
+ 'Accept' => '0',
+ 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
+);
-”`ruby
-require ‘rest-client’
-require ‘json’
+$client = new \GuzzleHttp\Client();
-headers = {
- ‘Accept’ => ‘0’,
- ‘Authorization’ => ‘Bearer YOUR_MANAGEMENT_API_KEY’
-}
+// Define array of request body.
+$request_body = array();
-result = RestClient.post ‘https://api.moesif.com/v1/search/~/search/usermetrics/users’,
- params: {
- }, headers: headers
+try {
+ $response = $client->request('POST','https://api.moesif.com/v1/search/~/search/usermetrics/users', 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());
+ }
-p JSON.parse(result)
+ // ...
+
+
package main
-“`
+import (
+ "bytes"
+ "net/http"
+)
-”`php
-func main() {
-require 'vendor/autoload.php';
+ headers := map[string][]string{
+ "Accept": []string{"0"},
+ "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
+ }
-$headers = array(
- 'Accept' => ‘0’,
- ‘Authorization’ => ‘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.Header = headers
-$client = new \GuzzleHttp\Client();
+ client := &http.Client{}
+ resp, err := client.Do(req)
+ // ...
+}
-// Define array of request body.
-$request_body = array();
+
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;
-try {
- $response = $client->request(‘POST’,‘https://api.moesif.com/v1/search/~/search/usermetrics/users’, 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());
- }
+/// <<summary>>
+/// Example of Http Client
+/// <</summary>>
+public class HttpExample
+{
+ private HttpClient Client { get; set; }
- // …
+ /// <<summary>>
+ /// Setup http client
+ /// <</summary>>
+ public HttpExample()
+ {
+ Client = new HttpClient();
+ }
-“`
-”`go
-package main
+ /// Make a dummy request
+ public async Task MakePostRequest()
+ {
+ string url = "https://api.moesif.com/v1/search/~/search/usermetrics/users";
-import (
- “bytes”
- “net/http”
-)
-func main() {
+ await PostAsync(null, url);
- 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/usermetrics/users”, data)
- req.Header = headers
+ /// Performs a POST Request
+ public async Task PostAsync(undefined content, string url)
+ {
+ //Serialize Object
+ StringContent jsonContent = SerializeObject(content);
- client := &http.Client{}
- resp, err := client.Do(req)
- // …
-}
+ //Execute POST request
+ HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
+ }
-“`
-
-”`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/search/~/search/usermetrics/users”;
-
-
- 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);
+ /// 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();
+ //Create Json UTF8 String Content
+ return new StringContent(jsonObject, Encoding.UTF8, "application/json");
+ }
- //Deserialize Body to object
- var result = JsonConvert.DeserializeObject(responseBody);
- }
-}
+ /// Deserialize object from request response
+ private async Task DeserializeObject(HttpResponseMessage response)
+ {
+ //Read body
+ string responseBody = await response.Content.ReadAsStringAsync();
-“`
-
-”`java
-URL obj = new URL(“https://api.moesif.com/v1/search/~/search/usermetrics/users”);
-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());
+ //Deserialize Body to object
+ var result = JsonConvert.DeserializeObject(responseBody);
+ }
+}
-“`
+
URL obj = new URL("https://api.moesif.com/v1/search/~/search/usermetrics/users");
+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 https://api.moesif.com/v1/search/~/search/usermetrics/users`
+
+POST https://api.moesif.com/v1/search/~/search/usermetrics/users
Search UserMetrics/Users
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| +|body|body|undefined|false|The search definition using the Elasticsearch Query DSL|
-> Example responses ++Example responses
+
Status | +Meaning | +Description | +Schema | +
---|---|---|---|
200 | +OK | +success | +None | +