Moesif API Reference
Moesif is an analytics and monetization platform for API products. This reference is for v1 of the Moesif APIs. For an overview on the Moesif platform, see the developer docs or implementation guides
There are two APIs:
Name | Host | Authentication |
---|---|---|
Collector API | api.moesif.net | Retrieve your Collector Application Id by logging into Moesif and going to API keys from bottom left menu. Place in the request X-Moesif-Application-Id header. More info |
Management API | api.moesif.com | Generate a Management API key by logging into Moesif and going to API keys from bottom left menu. Add it as a Bearer token to the request Authorization header. More info |
API definitions
The Collector API enables you to log raw data to Moesif at high volume such as events and user profiles. It’s a write-only, high-volume data collection network and is also used by the Moesif server integrations and plugins.
The Management API enables you to query and manage data in your Moesif account such as to embed charts in customer-facing applications.
Overview
Pagination and Filtering
Dates
Some endpoints require a date range for data to look at. This is done via the from
and the to
query parameters. There is also an optional time_zone
query parameter if you want the calendar dates aligned to your local time zone.
Time zone is UTC
by default and must be a TZ Database Name such as America/Los_Angeles
Relative dates support the following units:
symbol | unit |
---|---|
s | seconds |
m | minutes |
h | hours |
d | days |
w | weeks |
M | months |
now | current UTC time |
Dates can optionally be prepended with a -
or a +
Some examples:
From Date | To Date | Description |
---|---|---|
-24h | now | from 24 hours ago to now |
-1d | now | from 1 day ago to now |
-1w | now | from 1 week ago to now |
-2w | -1w | frm 2 weeks ago to 1 week ago |
-1M | 1M | from 1 month ago to 1 month in the future |
Search DSL
For certain search endpoints, Moesif supports querying and filtering using Elasticsearch DSL. Simply pass the DSL as the request body. While majority of DSL for Elasticsearch’s Request Body Search is supported by Moesif, other administrative APIs are unavailable. For help building a query for your business requirements, contact us.
Example: Getting most recent 500 errors
If you wanted to get the most recent API errors, you can filter by API calls with response status 500 and sort by request time in descending order.
POST https://api.moesif.com/search/~/search/events?from=-1d&to=now
Example Request
{
"post_filter": {
"bool": {
"should": {
"term": {
"response.status": "500"
}
}
}
},
"size": 50,
"sort": [
{
"request.time": "desc"
}
]
}
curl -XPOST \
-d '{"post_filter":{"bool":{"should":{"term":{"response.status":"500"}}}},"size":50,"sort":[{"request.time":"desc"}]}' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}' \
"https://api.moesif.com/search/~/search/events?from=-1d&to=now"
Example: Getting API usage per customer
Another popular use case is to get the monthly API usage for a specific customer so you can display current usage vs. plan quota in your customer facing portal. This can be done easily by looking at past month and getting a count for the user_id
POST https://api.moesif.com/search/~/search/count?from=-1M&to=now
Example Request
{
"post_filter": {
"bool": {
"should": {
"term": {
"user_id.raw": "123456"
}
}
}
}
}
curl -XPOST \
-d '{"post_filter":{"bool":{"should":{"term":{"user_id.raw":"123456"}}}}}' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}' \
"https://api.moesif.com/search/~/count/events?from=-1M&to=now"
Request Format
For POST, PUT, and PATCH requests, the request body should be JSON. The Content-Type
header
should be set to application/json
Response Format
The response body format is always JSON. Successful operations are seen via 2xx status code. Successful creation of new objects will be seen via 201. 4xx status implies client error.
The REST API JSON payloads uses underscore format (i.e some_key). Many of the API libs may use camelCase, PascalCase, or other as their model entities. Please select the respective language tab.
CORS
CORS is enabled on this API. Access-Control-Allow-Origin
is set to *
Errors
Error Code | Meaning |
---|---|
400 | Bad Request – Your request has an incorrect parameter |
401 | Unauthorized – Your X-Moesif-Application-Id or Authorization header is incorrect or missing required scopes |
402 | Payment Required – Your subscription is not active or has been cancelled |
404 | Not Found – The specified endpoint could not be found |
405 | Method Not Allowed – You tried to access a resource with an invalid HTTP method |
406 | Not Acceptable – You requested a format that is not JSON format, Moesif’s API supports JSON |
410 | Gone – The resource requested has been removed from our servers |
429 | Too Many Requests – You are hitting a rate limit such as too many queries at same time. |
500 | Internal Server Error – We had a problem with our server. Please contact us |
502 | Bad Gateway – A transient error when no server is available to handle your request, retry again or contact us if problem persists. |
503 | Service Unavailable – A transient error when no server is available to handle your request, retry again or contact us if problem persists. |
Rate Limits
The Management API has a rate limit of 300 queries/minute. Specific traffic patterns can burst higher. The Management API will return 429 Too Many Requests
once you hit this limit. Moesif reserves the right to modify these limits to protect the reliability of the Moesif Platform.
The Management API is intended for interactive workflows and programmatically query metrics. If you need to ingest a lot of data at once, you must use the Collector API. If you need to export a lot of data, you should use the bulk export feature.
API Libs
THese are low-level libraries to access the Moesif Collector API directly. For logging API calls at scale, most customers should integrate with one of Moesif’s API monitoring agents which instrument your API automatically and handle batching. Likewise, Moesif has client integrations for tracking users and their actions in your UI.
How to Install
Pick a language at the bottom left
![]()
Source Code:
https://github.com/moesif/moesifapi-java
// Add the dependency
<dependency>
<groupId>com.moesif.api</groupId>
<artifactId>moesifapi</artifactId>
<version>1.6.9</version>
</dependency>
Source Code:
https://github.com/moesif/moesifapi-nodejs
Package:
https://www.npmjs.com/package/moesifapi
// To Install Moesif Lib, run in your terminal
npm install --save moesifapi
Source Code:
https://github.com/moesif/moesifapi-python
Package:
https://pypi.python.org/pypi/moesifapi
# To Install Moesif Lib, run in your terminal
pip install moesifapi
Source Code:
https://github.com/moesif/moesifapi-ruby
Package:
https://rubygems.org/gems/moesif_api
# To Install Moesif Lib, run in your terminal
gem install moesif_api
Source Code:
https://github.com/moesif/moesifapi-csharp
Package:
https://www.nuget.org/packages/Moesif.Api/
// Install the Nuget Package via Package Manager Console:
Install-Package Moesif.Api
Source Code:
https://github.com/Moesif/moesifapi-go
go get github.com/moesif/moesifapi-go;
Source Code:
https://github.com/Moesif/moesifapi-php
// Install via Composer
composer require moesif/moesifapi-php
Install via NPM:
var moesif = require('moesif-browser-js');
moesif.init({
applicationId: 'YOUR_COLLECTOR_APPLICATION_ID'
// add other option here.
});
Install via CDN
<script src="//unpkg.com/moesif-browser-js@^1/moesif.min.js"></script>
<script type="text/javascript">
moesif.init({
applicationId: 'YOUR_COLLECTOR_APPLICATION_ID'
});
</script>
Select your language on the right:
- Shell
- Browser
- Node.js
- Python
- Ruby
- PHP
- Go
- C#
- Java
The SDKs are open-source and available on GitHub.
Collector API v1
The Collector API enables you to log data to Moesif at high volumes. This is also what the Moesif server integrations use. For more info, check out an overview of our analytics infrastructure.
Base URL (Public) | Base URL (When using Secure Proxy) |
---|---|
api.moesif.net/v1 |
localhost:9500/collector/v1 |
If you’re using the Moesif secure proxy for client-side encryption, the base URL is http://localhost:9500/collector/v1
assuming it’s running on port 9500
. See accessing Collector API
Moesif’s official SDKs and plugins only use HTTPS, but the API does support HTTP for very specific applications like legacy embedded devices (uncommon). It’s strongly recommended to ensure all communication is HTTPS.
Authentication
Authentication is handled by adding the HTTP header X-Moesif-Application-Id
to all requests.
Moesif recommends using the same Application Id for all integrations within the same application environment (i.e. product, staging, etc) so your analytics data is unified.
X-Moesif-Application-Id: YOUR_COLLECTOR_APPLICATION_ID
API Calls
Log an API Call
POST https://api.moesif.net/v1/events
Log a single API call to Moesif. The request payload is a single API event model containing the API request, the API response, and any custom event metadata.
POST https://api.moesif.net/v1/events
Example Request
{
"request": {
"time": "2022-09-06T04:45:42.914",
"uri": "https://api.acmeinc.com/items/12345/reviews/",
"verb": "POST",
"api_version": "1.1.0",
"ip_address": "61.48.220.123",
"headers": {
"Host": "api.acmeinc.com",
"Accept": "*/*",
"Connection": "Keep-Alive",
"Content-Type": "application/json",
"Content-Length": "126",
"Accept-Encoding": "gzip"
},
"body": {
"items": [
{
"direction_type": 1,
"item_id": "hello",
"liked": false
},
{
"direction_type": 2,
"item_id": "world",
"liked": true
}
]
},
"transfer_encoding": ""
},
"response": {
"time": "2022-09-06T04:45:42.914",
"status": 500,
"headers": {
"Vary": "Accept-Encoding",
"Pragma": "no-cache",
"Expires": "-1",
"Content-Type": "application/json; charset=utf-8",
"Cache-Control": "no-cache"
},
"body": {
"Error": "InvalidArgumentException",
"Message": "Missing field location"
},
"transfer_encoding": ""
},
"user_id": "12345",
"company_id": "67890",
"session_token": "XXXXXXXXX",
"metadata": {
"some_string": "I am a string",
"some_int": 77,
"some_object": {
"some_sub_field": "some_value"
}
}
}
# You can also use wget
curl -X POST https://api.moesif.net/v1/events \
-H 'Content-Type: application/json' \
-H 'X-Moesif-Application-Id: YOUR_COLLECTOR_APPLICATION_ID'
-d '{"request":{"time":"2022-09-06T04:45:42.914","uri":"https://api.acmeinc.com/items/12345/reviews/","verb":"POST","api_version":"1.1.0","ip_address":"61.48.220.123","headers":{"Host":"api.acmeinc.com","Accept":"*/*","Connection":"Keep-Alive","Content-Type":"application/json","Content-Length":"126","Accept-Encoding":"gzip"},"body":{"items":[{"direction_type":1,"item_id":"hello","liked":false},{"direction_type":2,"item_id":"world","liked":true}]},"transfer_encoding":""},"response":{"time":"2022-09-06T04:45:42.914","status":500,"headers":{"Vary":"Accept-Encoding","Pragma":"no-cache","Expires":"-1","Content-Type":"application/json; charset=utf-8","Cache-Control":"no-cache"},"body":{"Error":"InvalidArgumentException","Message":"Missing field location"},"transfer_encoding":""},"user_id":"12345","company_id":"67890","session_token":"XXXXXXXXX","metadata":{"some_string":"I am a string","some_int":77,"some_object":{"some_sub_field":"some_value"}}}'
// Import the Library
MoesifAPIClient client = new MoesifAPIClient("YOUR_COLLECTOR_APPLICATION_ID");
APIController api = getClient().getAPI();
// Generate the event
Map<String, String> reqHeaders = new HashMap<String, String>();
reqHeaders.put("Host", "api.acmeinc.com");
reqHeaders.put("Accept", "*/*");
reqHeaders.put("Connection", "Keep-Alive");
reqHeaders.put("User-Agent", "Apache-HttpClient");
reqHeaders.put("Content-Type", "application/json");
reqHeaders.put("Content-Length", "126");
reqHeaders.put("Accept-Encoding", "gzip");
Object reqBody = APIHelper.deserialize("{" +
"\"items\": [" +
"{" +
"\"type\": 1," +
"\"id\": \"hello\"" +,
"}," +
"{" +
"\"type\": 2," +
"\"id\": \"world\"" +
"}" +
"]" +
"}");
Map<String, String> rspHeaders = new HashMap<String, String>();
rspHeaders.put("Vary", "Accept-Encoding");
rspHeaders.put("Pragma", "no-cache");
rspHeaders.put("Expires", "-1");
rspHeaders.put("Content-Type", "application/json; charset=utf-8");
rspHeaders.put("Cache-Control","no-cache");
Object rspBody = APIHelper.deserialize("{" +
"\"Error\": \"InvalidArgumentException\"," +
"\"Message\": \"Missing field field_a\"" +
"}");
EventRequestModel eventReq = new EventRequestBuilder()
.time(new Date())
.uri("https://api.acmeinc.com/items/reviews/")
.verb("PATCH")
.apiVersion("1.1.0")
.ipAddress("61.48.220.123")
.headers(reqHeaders)
.body(reqBody)
.build();
EventResponseModel eventRsp = new EventResponseBuilder()
.time(new Date(System.currentTimeMillis() + 1000))
.status(500)
.headers(rspHeaders)
.body(rspBody)
.build();
EventModel eventModel = new EventBuilder()
.request(eventReq)
.response(eventRsp)
.userId("12345")
.companyId("67890")
.sessionToken("XXXXXXXXX")
.build();
// Asynchronous Call to Create Event
MoesifAPIClient client = new MoesifAPIClient("YOUR_COLLECTOR_APPLICATION_ID");
APIController api = getClient().getAPI();
APICallBack<Object> callBack = new APICallBack<Object>() {
public void onSuccess(HttpContext context, Object response) {
// Do something
}
public void onFailure(HttpContext context, Throwable error) {
// Do something else
}
};
api.createEventsBatchAsync(eventsList, callBack);
// Synchronous Call to Create Event
api.createEventsBatch(eventsList, callBack);
// 1. Import the module
var moesifapi = require('moesifapi');
var EventModel = moesifapi.UserModel;
var api = moesifapi.ApiController;
// 2. Configure the ApplicationId
var config = moesifapi.configuration;
config.ApplicationId = "YOUR_COLLECTOR_APPLICATION_ID";
// 3. Generate an API Event Model
var reqHeaders = JSON.parse('{' +
'"Host": "api.acmeinc.com",' +
'"Accept": "*/*",' +
'"Connection": "Keep-Alive",' +
'"User-Agent": "Apache-HttpClient",' +
'"Content-Type": "application/json",' +
'"Content-Length": "126",' +
'"Accept-Encoding": "gzip"' +
'}');
var reqBody = JSON.parse( '{' +
'"items": [' +
'{' +
'"type": 1,' +
'"id": "hello"' +
'},' +
'{' +
'"type": 2,' +
'"id": "world"' +
'}' +
']' +
'}');
var rspHeaders = JSON.parse('{' +
'"Vary": "Accept-Encoding",' +
'"Pragma": "no-cache",' +
'"Expires": "-1",' +
'"Content-Type": "application/json; charset=utf-8",' +
'"Cache-Control": "no-cache"' +
'}');
var rspBody = JSON.parse('{' +
'"Error": "InvalidArgumentException",' +
'"Message": "Missing field field_a"' +
'}');
var reqDate = new Date();
var eventReq = {
time: reqDate,
uri: "https://api.acmeinc.com/items/reviews/",
verb: "PATCH",
apiVersion: "1.1.0",
ipAddress: "61.48.220.123",
headers: reqHeaders,
body: reqBody
};
var eventRsp = {
time: (new Date()).setMilliseconds(reqDate.getMilliseconds() + 500),
status: 500,
headers: rspHeaders,
body: rspBody
};
var eventModel = {
request: eventReq,
response: eventRsp,
userId: "12345",
companyId: "67890",
sessionToken: "XXXXXXXXX"
};
var events = [new EventModel(eventModel),
new EventModel(eventModel),
new EventModel(eventModel),
new EventModel(eventModel)];
// 4. Send batch of events
api.createEventsBatch(events, function(error, response, context) {
// Do Something
});
from __future__ import print_function
from moesifapi.moesif_api_client import *
from moesifapi.models import *
from datetime import *
client = MoesifAPIClient(YOUR_COLLECTOR_APPLICATION_ID)
api = client.api
# Note: we recommend sending all API calls via MVC framework middleware.
req_headers = APIHelper.json_deserialize(""" {
"Host": "api.acmeinc.com",
"Accept": "*/*",
"Connection": "Keep-Alive",
"User-Agent": "Apache-HttpClient",
"Content-Type": "application/json",
"Content-Length": "126",
"Accept-Encoding": "gzip"
} """)
req_body = APIHelper.json_deserialize( """{
"items": [
{
"type": 1,
"id": "hello"
},
{
"type": 2,
"id": "world"
}
]
}""")
rsp_headers = APIHelper.json_deserialize(""" {
"Date": "Mon, 05 Sep 2022 23:46:49 GMT",
"Vary": "Accept-Encoding",
"Pragma": "no-cache",
"Expires": "-1",
"Content-Type": "application/json; charset=utf-8"
"Cache-Control": "no-cache"
} """)
rsp_body = APIHelper.json_deserialize( """{
"Error": "InvalidArgumentException",
"Message": "Missing field field_a"
}""")
event_req = EventRequestModel(time = datetime.utcnow() - timedelta(seconds=-1),
uri = "https://api.acmeinc.com/items/reviews/",
verb = "PATCH",
api_version = "1.1.0",
ip_address = "61.48.220.123",
headers = req_headers,
body = req_body)
event_rsp = EventResponseModel(time = datetime.utcnow(),
status = 500,
headers = rsp_headers,
body = rsp_body)
event_model = EventModel(request = event_req,
response = event_rsp,
user_id = "12345",
company_id = "67890",
session_token = "XXXXXXXXX")
# Perform the API call through the SDK function
api.create_event(event_model)
require 'moesif_api'
client = MoesifApi::MoesifAPIClient.new(YOUR_COLLECTOR_APPLICATION_ID)
api = client.api_controller
req_headers = JSON.parse('{'\
'"Host": "api.acmeinc.com",'\
'"Accept": "*/*",'\
'"Connection": "Keep-Alive",'\
'"User-Agent": "Apache-HttpClient",'\
'"Content-Type": "application/json",'\
'"Content-Length": "126",'\
'"Accept-Encoding": "gzip"'\
'}')
req_body = JSON.parse( '{'\
'"items": ['\
'{'\
'"type": 1,'\
'"id": "hello"'\
'},'\
'{'\
'"type": 2,'\
'"id": "world"'\
'}'\
']'\
'}')
rsp_headers = JSON.parse('{'\
'"Date": "Mon, 05 Sep 2022 23:46:49 GMT",'\
'"Vary": "Accept-Encoding",'\
'"Pragma": "no-cache",'\
'"Expires": "-1",'\
'"Content-Type": "application/json; charset=utf-8",'\
'"Cache-Control": "no-cache"'\
'}')
rsp_body = JSON.parse('{'\
'"Error": "InvalidArgumentException",'\
'"Message": "Missing field field_a"'\
'}')
event_req = EventRequestModel.new()
event_req.time = "2022-09-06T04:45:42.914"
event_req.uri = "https://api.acmeinc.com/items/reviews/"
event_req.verb = "PATCH"
event_req.api_version = "1.1.0"
event_req.ip_address = "61.48.220.123"
event_req.headers = req_headers
event_req.body = req_body
event_rsp = EventResponseModel.new()
event_rsp.time = "2022-09-06T04:45:42.914"
event_rsp.status = 500
event_rsp.headers = rsp_headers
event_rsp.body = rsp_body
event_model = EventModel.new()
event_model.request = event_req
event_model.response = event_rsp
event_model.user_id ="12345"
event_model.company_id ="67890"
event_model.session_token = "XXXXXXXXX"
# Perform the API call through the SDK function
response = api.create_event(event_model)
using Moesif.Api;
using Moesif.Api.Helpers;
// Create client instance using your ApplicationId
var client = new MoesifApiClient("YOUR_COLLECTOR_APPLICATION_ID");
var apiClient = GetClient().Api;
// Parameters for the API call
var reqHeaders = APIHelper.JsonDeserialize<object>(@" {
""Host"": ""api.acmeinc.com"",
""Accept"": ""*/*"",
""Connection"": ""Keep-Alive"",
""User-Agent"": ""Apache-HttpClient"",
""Content-Type"": ""application/json"",
""Content-Length"": ""126"",
""Accept-Encoding"": ""gzip""
}");
var reqBody = APIHelper.JsonDeserialize<object>(@" {
""items"": [
{
""type"": 1,
""id"": ""hello""
},
{
""type"": 2,
""id"": ""world""
}
]
}");
var rspHeaders = APIHelper.JsonDeserialize<object>(@" {
""Date"": ""Mon, 05 Sep 2022 23:46:49 GMT"",
""Vary"": ""Accept-Encoding"",
""Pragma"": ""no-cache"",
""Expires"": ""-1"",
""Content-Type"": ""application/json; charset=utf-8"",
""Cache-Control"": ""no-cache""
} ");
var rspBody = APIHelper.JsonDeserialize<object>(@" {
""Error"": ""InvalidArgumentException"",
""Message"": ""Missing field field_a""
}");
var eventReq = new EventRequestModel()
{
Time = DateTime.Parse("2022-09-06T04:45:42.914"),
Uri = "https://api.acmeinc.com/items/reviews/",
Verb = "PATCH",
ApiVersion = "1.1.0",
IpAddress = "61.48.220.123",
Headers = reqHeaders,
Body = reqBody
};
var eventRsp = new EventResponseModel()
{
Time = DateTime.Parse("2022-09-06T04:45:42.914"),
Status = 500,
Headers = rspHeaders,
Body = rspBody
};
var eventModel = new EventModel()
{
Request = eventReq,
Response = eventRsp,
UserId = "12345",
CompanyId = "67890",
SessionToken = "XXXXXXXXX"
};
//////////////////////////////////////
// Example for making an async call //
//////////////////////////////////////
try
{
await controller.CreateEventAsync(eventModel);
}
catch(APIException)
{
// Handle Error
};
///////////////////////////////////////////
// Example for making a synchronous call //
///////////////////////////////////////////
try
{
controller.CreateEvent(eventModel);
}
catch(APIException)
{
// Handle Error
};
import "github.com/moesif/moesifapi-go"
import "github.com/moesif/moesifapi-go/models"
import "time"
apiClient := moesifapi.NewAPI("YOUR_COLLECTOR_APPLICATION_ID")
reqTime := time.Now().UTC()
apiVersion := "1.0"
ipAddress := "61.48.220.123"
req := models.EventRequestModel{
Time: &reqTime,
Uri: "https://api.acmeinc.com/widgets",
Verb: "GET",
ApiVersion: &apiVersion,
IpAddress: &ipAddress,
Headers: map[string]interface{}{
"ReqHeader1": "ReqHeaderValue1",
},
Body: nil,
}
rspTime := time.Now().UTC().Add(time.Duration(1) * time.Second)
rsp := models.EventResponseModel{
Time: &rspTime,
Status: 500,
IpAddress: nil,
Headers: map[string]interface{}{
"RspHeader1": "RspHeaderValue1",
"Content-Type": "application/json",
"Content-Length": "1000",
},
Body: map[string]interface{}{
"Key1": "Value1",
"Key2": 12,
"Key3": map[string]interface{}{
"Key3_1": "SomeValue",
},
},
}
sessionToken := "XXXXXXXXX"
userId := "12345"
companyId: := "67890"
event := models.EventModel{
Request: req,
Response: rsp,
SessionToken: &sessionToken,
Tags: nil,
UserId: &userId,
CompanyId: &companyId,
}
// Queue the event (will queue the requests into batches and flush buffers periodically.)
err := apiClient.QueueEvent(&event)
// Create the event synchronously
err := apiClient.CreateEvent(&event)
<?php
// Depending on your project setup, you might need to include composer's
// autoloader in your PHP code to enable autoloading of classes.
require_once "vendor/autoload.php";
// Import the SDK client in your project:
use MoesifApi\MoesifApiClient;
// Instantiate the client. After this, you can now access the Moesif API
// and call the respective methods:
$client = new MoesifApiClient("YOUR_COLLECTOR_APPLICATION_ID");
$api = $client->getApi();
$event = new Models\EventModel();
$reqdate = new DateTime();
$rspdate = new DateTime();
$event->request = array(
"time" => $reqdate->format(DateTime::ISO8601),
"uri" => "https://api.acmeinc.com/items/reviews/",
"verb" => "PATCH",
"api_version" => "1.1.0",
"ip_address" => "61.48.220.123",
"headers" => array(
"Host" => "api.acmeinc.com",
"Accept" => "_/_",
"Connection" => "Keep-Alive",
"User-Agent" => "moesifapi-php/1.1.5",
"Content-Type" => "application/json",
"Content-Length" => "126",
"Accept-Encoding" => "gzip"),
"body" => array(
"review_id" => 132232,
"item_id" => "ewdcpoijc0",
"liked" => false)
);
$event->response = array(
"time" => $rspdate->format(DateTime::ISO8601),
"status" => 500,
"headers" => array(
"Date" => "Tue, 1 Mar 2022 23:46:49 GMT",
"Vary" => "Accept-Encoding",
"Pragma" => "no-cache",
"Expires" => "-1",
"Content-Type" => "application/json; charset=utf-8",
"X-Powered-By" => "ARR/3.0",
"Cache-Control" => "no-cache",
"Arr-Disable-Session-Affinity" => "true"),
"body" => array(
"item_id" => "13221",
"title" => "Red Brown Chair",
"description" => "Red brown chair for sale",
"price" => 22.23
)
);
$event->metadata = array(
"foo" => "bar"
);
$event->user_id = "12345";
$event->company_id = "67890";
$event->session_token = "XXXXXXXXX";
$api->createEvent($event);
Name | Type | Required | Description |
---|---|---|---|
request | object | true | The object that specifies the API request. |
time |
string(date-time) | true | Timestamp for the request in ISO 8601 format. |
uri |
string | true | Full uri such as https://api.acmeinc.com/?query=string including protocol, host, and query string. |
verb |
string | true | HTTP method used such as GET or POST . |
api_version |
string | false | API Version you want to tag this request with such as 1.0.0. |
ip_address |
string | false | IP address of the requester, If not set, we extract the remote IP address. |
headers |
object | true | Headers of the request as a Map<string, string> . Multiple headers with the same key name should be combined together such that the values are joined by a comma. HTTP Header Protocol on w3.org. |
body |
object | false | Payload of the request in either JSON or a base64 encoded string. |
transfer_encoding |
string | false | Specifies the transfer encoding of request.body field. If set to json then the response.body must be a JSON object. If set to base64, then request.body must be a base64 encoded string. Helpful for binary payloads. If not set, the body is assumed to be json. |
response | object | false | The object that specifies the API response. The response object can be undefined such as a request timeouts. |
time |
string(date-time) | true | Timestamp for the response in ISO 8601 format. |
status |
integer | true | HTTP status code as number such as 200 or 500. |
ip_address |
string | false | IP address of the responding server. |
headers |
object | true | Headers of the response as a Map<string, string> . Multiple headers with the same key name should be combined together such that the values are joined by a comma. HTTP Header Protocol on w3.org |
body |
object | false | Payload of the response in either JSON or a base64 encoded string. |
transfer_encoding |
string | false | Specifies the transfer encoding of response.body field. If set to json then the response.body must be a JSON object. If set to base64, then response.body must be a base64 encoded string. Helpful for binary payloads. If not set, the body is assumed to be json. |
session_token | string | false | Set the API key/session token used for this API call. Moesif will auto-detect API sessions if not set. |
user_id | string | false | Associate this API call to a user. |
company_id | string | false | Associate this API call to a company (Helpful for B2B companies). |
direction | string | false | The direction of this API call which can be Incoming or Outgoing. |
metadata | object | false | An object containing any custom event metadata you want to store with this event. |
Log API Calls in Batch
POST https://api.moesif.net/v1/events/batch
Creates and logs a batch of API calls to Moesif. The request payload is an array API calls entities, each consisting of the API request, the API response, and any custom event metadata.
This API takes a list form of the same model defined in create single event.
The maximum batch size is 12MB. Break up larger batches.
POST https://api.moesif.net/v1/events/batch
Example Request
[
{
"request": {
"time": "2022-09-06T04:45:42.914",
"uri": "https://api.acmeinc.com/items/83738/reviews/",
"verb": "POST",
"api_version": "1.1.0",
"ip_address": "61.48.220.123",
"headers": {
"Host": "api.acmeinc.com",
"Accept": "*/*",
"Connection": "Keep-Alive",
"Content-Type": "application/json",
"Content-Length": "126",
"Accept-Encoding": "gzip"
},
"body": {
"items": [
{
"direction_type": 1,
"item_id": "hello",
"liked": false
},
{
"direction_type": 2,
"item_id": "world",
"liked": true
}
]
},
"transfer_encoding": ""
},
"response": {
"time": "2022-09-06T04:45:42.914",
"status": 500,
"headers": {
"Vary": "Accept-Encoding",
"Pragma": "no-cache",
"Expires": "-1",
"Content-Type": "application/json; charset=utf-8",
"Cache-Control": "no-cache"
},
"body": {
"Error": "InvalidArgumentException",
"Message": "Missing field location"
},
"transfer_encoding": ""
},
"user_id": "12345",
"company_id": "67890",
"session_token": "XXXXXXXXX",
"metadata": {
"some_string": "I am a string",
"some_int": 77,
"some_object": {
"some_sub_field": "some_value"
}
}
}
]
# You can also use wget
curl -X POST https://api.moesif.net/v1/events/batch \
-H 'Content-Type: application/json' \
-H 'X-Moesif-Application-Id: YOUR_COLLECTOR_APPLICATION_ID'
-d '[{"request":{"time":"2022-09-06T04:45:42.914","uri":"https://api.acmeinc.com/items/83738/reviews/","verb":"POST","api_version":"1.1.0","ip_address":"61.48.220.123","headers":{"Host":"api.acmeinc.com","Accept":"*/*","Connection":"Keep-Alive","Content-Type":"application/json","Content-Length":"126","Accept-Encoding":"gzip"},"body":{"items":[{"direction_type":1,"item_id":"hello","liked":false},{"direction_type":2,"item_id":"world","liked":true}]},"transfer_encoding":""},"response":{"time":"2022-09-06T04:45:42.914","status":500,"headers":{"Vary":"Accept-Encoding","Pragma":"no-cache","Expires":"-1","Content-Type":"application/json; charset=utf-8","Cache-Control":"no-cache"},"body":{"Error":"InvalidArgumentException","Message":"Missing field location"},"transfer_encoding":""},"user_id":"12345","company_id":"67890","session_token":"XXXXXXXXX","metadata":{"some_string":"I am a string","some_int":77,"some_object":{"some_sub_field":"some_value"}}}]'
// Import the Library
MoesifAPIClient client = new MoesifAPIClient("YOUR_COLLECTOR_APPLICATION_ID");
APIController api = getClient().getAPI();
// Generate the events
Map<String, String> reqHeaders = new HashMap<String, String>();
reqHeaders.put("Host", "api.acmeinc.com");
reqHeaders.put("Accept", "*/*");
reqHeaders.put("Connection", "Keep-Alive");
reqHeaders.put("User-Agent", "Apache-HttpClient");
reqHeaders.put("Content-Type", "application/json");
reqHeaders.put("Content-Length", "126");
reqHeaders.put("Accept-Encoding", "gzip");
Object reqBody = APIHelper.deserialize("{" +
"\"items\": [" +
"{" +
"\"type\": 1," +
"\"id\": \"hello\"" +
"}," +
"{" +
"\"type\": 2," +
"\"id\": \"world\"" +
"}" +
"]" +
"}");
Map<String, String> rspHeaders = new HashMap<String, String>();
rspHeaders.put("Date", "Mon, 05 Sep 2022 23:46:49 GMT");
rspHeaders.put("Vary", "Accept-Encoding");
rspHeaders.put("Pragma", "no-cache");
rspHeaders.put("Expires", "-1");
rspHeaders.put("Content-Type", "application/json; charset=utf-8");
rspHeaders.put("Cache-Control","no-cache");
Object rspBody = APIHelper.deserialize("{" +
"\"Error\": \"InvalidArgumentException\"," +
"\"Message\": \"Missing field field_a\"" +
"}");
EventRequestModel eventReq = new EventRequestBuilder()
.time(new Date())
.uri("https://api.acmeinc.com/items/reviews/")
.verb("PATCH")
.apiVersion("1.1.0")
.ipAddress("61.48.220.123")
.headers(reqHeaders)
.body(reqBody)
.build();
EventResponseModel eventRsp = new EventResponseBuilder()
.time(new Date(System.currentTimeMillis() + 1000))
.status(500)
.headers(rspHeaders)
.body(rspBody)
.build();
EventModel eventModel = new EventBuilder()
.request(eventReq)
.response(eventRsp)
.userId("12345")
.companyId("67890")
.sessionToken("XXXXXXXXX")
.build();
List<EventModel> events = new ArrayList<EventModel>();
events.add(eventModel);
events.add(eventModel);
events.add(eventModel);
events.add(eventModel);
// Asynchronous Call to create new event
MoesifAPIClient client = new MoesifAPIClient("YOUR_COLLECTOR_APPLICATION_ID");
APIController api = getClient().getAPI();
APICallBack<Object> callBack = new APICallBack<Object>() {
public void onSuccess(HttpContext context, Object response) {
// Do something
}
public void onFailure(HttpContext context, Throwable error) {
// Do something else
}
};
api.createEventsBatchAsync(events, callBack);
// Synchronous Call to create new event
api.createEventsBatch(events, callBack);
// Import the module:
var moesifapi = require('moesifapi');
// Set your application id
var config = moesifapi.configuration;
config.ApplicationId = 'YOUR_COLLECTOR_APPLICATION_ID';
// Create API Event Models and set fields
var reqHeaders = JSON.parse('{' +
'"Host": "api.acmeinc.com",' +
'"Accept": "*/*",' +
'"Connection": "Keep-Alive",' +
'"User-Agent": "Apache-HttpClient",' +
'"Content-Type": "application/json",' +
'"Content-Length": "126",' +
'"Accept-Encoding": "gzip"' +
'}');
var reqBody = JSON.parse( '{' +
'"items": [' +
'{' +
'"type": 1,' +
'"id": "hello"' +
'},' +
'{' +
'"type": 2,' +
'"id": "world"' +
'}' +
']' +
'}');
var rspHeaders = JSON.parse('{' +
'"Vary": "Accept-Encoding",' +
'"Pragma": "no-cache",' +
'"Expires": "-1",' +
'"Content-Type": "application/json; charset=utf-8",' +
'"Cache-Control": "no-cache"' +
'}');
var rspBody = JSON.parse('{' +
'"Error": "InvalidArgumentException",' +
'"Message": "Missing field field_a"' +
'}');
var reqDate = new Date();
var eventReq = {
time: reqDate,
uri: "https://api.acmeinc.com/items/reviews/",
verb: "PATCH",
apiVersion: "1.1.0",
ipAddress: "61.48.220.123",
headers: reqHeaders,
body: reqBody
};
var eventRsp = {
time: (new Date()).setMilliseconds(reqDate.getMilliseconds() + 500),
status: 500,
headers: rspHeaders,
body: rspBody
};
var eventA = {
request: eventReq,
response: eventRsp,
userId: "12345",
companyId: "67890",
sessionToken: "XXXXXXXXX"
};
var myEventModels = [ eventA ]
//Access various controllers by:
var controller = moesifapi.ApiController;
// Send the actual events
controller.createEventsBatch(myEventModels, function(error, response, context) {
// Handle Errors
});
from __future__ import print_function
from moesifapi.moesif_api_client import *
from moesifapi.models import *
from datetime import *
# Setup API Client
client = MoesifAPIClient(YOUR_COLLECTOR_APPLICATION_ID)
api = client.api_controller
# Create API Event Models and set fields
req_headers = APIHelper.json_deserialize(""" {
"Host": "api.acmeinc.com",
"Accept": "*/*",
"Connection": "Keep-Alive",
"User-Agent": "Apache-HttpClient",
"Content-Type": "application/json",
"Content-Length": "126",
"Accept-Encoding": "gzip"
} """)
req_body = APIHelper.json_deserialize( """{
"items": [
{
"type": 1,
"id": "hello"
},
{
"type": 2,
"id": "world"
}
]
}""")
rsp_headers = APIHelper.json_deserialize(""" {
"Date": "Mon, 05 Sep 2022 23:46:49 GMT",
"Vary": "Accept-Encoding",
"Pragma": "no-cache",
"Expires": "-1",
"Content-Type": "application/json; charset=utf-8"
"Cache-Control": "no-cache"
} """)
rsp_body = APIHelper.json_deserialize( """{
"Error": "InvalidArgumentException",
"Message": "Missing field field_a"
}""")
event_req = EventRequestModel(time = datetime.utcnow() - timedelta(seconds=-1),
uri = "https://api.acmeinc.com/items/reviews/",
verb = "PATCH",
api_version = "1.1.0",
ip_address = "61.48.220.123",
headers = req_headers,
body = req_body)
event_rsp = EventResponseModel(time = datetime.utcnow(),
status = 500,
headers = rsp_headers,
body = rsp_body)
event_a = EventModel(request = event_req,
response = event_rsp,
user_id = "12345",
company_id = "67890",
session_token = "XXXXXXXXX")
my_events = [ event_a ]
# Send the actual events
api.create_events_batch(my_events)
require 'moesif_api'
# Setup API Client
client = MoesifApi::MoesifAPIClient.new(YOUR_COLLECTOR_APPLICATION_ID)
api = client.api_controller
# Create API Event Models and set fields
event_a = EventModel.new()
event_a.user_id = "12345"
event_a.company_id = "67890"
my_event_models = [ event_a ]
# Send the actual events
api.create_events_batch(my_event_models)
using Moesif.Api;
using Moesif.Api.Helpers;
// Create client instance using your ApplicationId
var client = new MoesifApiClient("YOUR_COLLECTOR_APPLICATION_ID");
var apiClient = GetClient().Api;
// Parameters for the API call
var reqHeaders = APIHelper.JsonDeserialize<object>(@" {
""Host"": ""api.acmeinc.com"",
""Accept"": ""*/*"",
""Connection"": ""Keep-Alive"",
""User-Agent"": ""Apache-HttpClient"",
""Content-Type"": ""application/json"",
""Content-Length"": ""126"",
""Accept-Encoding"": ""gzip""
}");
var reqBody = APIHelper.JsonDeserialize<object>(@" {
""items"": [
{
""type"": 1,
""id"": ""hello""
},
{
""type"": 2,
""id"": ""world""
}
]
}");
var rspHeaders = APIHelper.JsonDeserialize<object>(@" {
""Date"": ""Mon, 05 Sep 2022 23:46:49 GMT"",
""Vary"": ""Accept-Encoding"",
""Pragma"": ""no-cache"",
""Expires"": ""-1"",
""Content-Type"": ""application/json; charset=utf-8"",
""Cache-Control"": ""no-cache""
} ");
var rspBody = APIHelper.JsonDeserialize<object>(@" {
""Error"": ""InvalidArgumentException"",
""Message"": ""Missing field field_a""
}");
var reqDate = new Date();
var eventReq = new EventRequestModel()
{
Time = DateTime.Parse("2022-09-06T04:45:42.914"),
Uri = "https://api.acmeinc.com/items/reviews/",
Verb = "PATCH",
ApiVersion = "1.1.0",
IpAddress = "61.48.220.123",
Headers = reqHeaders,
Body = reqBody
};
var eventRsp = new EventResponseModel()
{
Time = DateTime.Parse("2022-09-06T04:45:42.914"),
Status = 500,
Headers = rspHeaders,
Body = rspBody
};
var eventModel = new EventModel()
{
Request = eventReq,
Response = eventRsp,
UserId = "12345",
CompanyId = "67890",
SessionToken = "XXXXXXXXX"
};
// Create a List
var events = new List<EventModel>();
events.Add(eventModel);
events.Add(eventModel);
events.Add(eventModel);
//////////////////////////////////////
// Example for making an async call //
//////////////////////////////////////
try
{
await controller.CreateEventsBatchAsync(events);
}
catch(APIException)
{
// Handle Error
};
///////////////////////////////////////////
// Example for making a synchronous call //
///////////////////////////////////////////
try
{
controller.CreateEventsBatch(events);
}
catch(APIException)
{
// Handle Error
};
import "github.com/moesif/moesifapi-go"
import "github.com/moesif/moesifapi-go/models"
import "time"
apiClient := moesifapi.NewAPI("YOUR_COLLECTOR_APPLICATION_ID")
reqTime := time.Now().UTC()
apiVersion := "1.0"
ipAddress := "61.48.220.123"
req := models.EventRequestModel{
Time: &reqTime,
Uri: "https://api.acmeinc.com/widgets",
Verb: "GET",
ApiVersion: &apiVersion,
IpAddress: &ipAddress,
Headers: map[string]interface{}{
"ReqHeader1": "ReqHeaderValue1",
},
Body: nil,
}
rspTime := time.Now().UTC().Add(time.Duration(1) * time.Second)
rsp := models.EventResponseModel{
Time: &rspTime,
Status: 500,
IpAddress: nil,
Headers: map[string]interface{}{
"RspHeader1": "RspHeaderValue1",
},
Body: map[string]interface{}{
"Key1": "Value1",
"Key2": 12,
"Key3": map[string]interface{}{
"Key3_1": "SomeValue",
},
},
}
sessionToken := "XXXXXXXXX"
userId := "12345"
companyId := "6789"
event := models.EventModel{
Request: req,
Response: rsp,
SessionToken: &sessionToken,
Tags: nil,
UserId: &userId,
CompanyId: &companyId,
}
events := make([]*models.EventModel, 20)
for i := 0; i < 20; i++ {
events[i] = &event
}
// Queue the events
err := apiClient.QueueEvents(events)
// Create the events batch synchronously
err := apiClient.CreateEventsBatch(event)
<?php
// Depending on your project setup, you might need to include composer's
// autoloader in your PHP code to enable autoloading of classes.
require_once "vendor/autoload.php";
// Import the SDK client in your project:
use MoesifApi\MoesifApiClient;
// Instantiate the client. After this, you can now access the Moesif API
// and call the respective methods:
$client = new MoesifApiClient("Your application Id");
$api = $client->getApi();
Name | Type | Required | Description |
---|---|---|---|
request | object | true | The object that specifies the API request. |
time |
string(date-time) | true | Timestamp for the request in ISO 8601 format. |
uri |
string | true | Full uri such as https://api.acmeinc.com/?query=string including protocol, host, and query string. |
verb |
string | true | HTTP method used such as GET or POST . |
api_version |
string | false | API Version you want to tag this request with such as 1.0.0. |
ip_address |
string | false | IP address of the requester, If not set, we extract the remote IP address. |
headers |
object | true | Headers of the request as a Map<string, string> . Multiple headers with the same key name should be combined together such that the values are joined by a comma. HTTP Header Protocol on w3.org. |
body |
object | false | Payload of the request in either JSON or a base64 encoded string. |
transfer_encoding |
string | false | Specifies the transfer encoding of request.body field. If set to json then the response.body must be a JSON object. If set to base64, then request.body must be a base64 encoded string. Helpful for binary payloads. If not set, the body is assumed to be json. |
response | object | false | The object that specifies the API response. The response object can be undefined such as a request timeouts. |
time |
string(date-time) | true | Timestamp for the response in ISO 8601 format. |
status |
integer | true | HTTP status code as number such as 200 or 500. |
ip_address |
string | false | IP address of the responding server. |
headers |
object | true | Headers of the response as a Map<string, string> . Multiple headers with the same key name should be combined together such that the values are joined by a comma. HTTP Header Protocol on w3.org |
body |
object | false | Payload of the response in either JSON or a base64 encoded string. |
transfer_encoding |
string | false | Specifies the transfer encoding of response.body field. If set to json then the response.body must be a JSON object. If set to base64, then response.body must be a base64 encoded string. Helpful for binary payloads. If not set, the body is assumed to be json. |
session_token | string | false | Set the API key/session token used for this API call. Moesif will auto-detect API sessions if not set. |
user_id | string | false | Associate this API call to a user. |
company_id | string | false | Associate this API call to a company (Helpful for B2B companies). |
direction | string | false | The direction of this API call which can be Incoming or Outgoing. |
metadata | object | false | An object containing any custom event metadata you want to store with this event. |
Actions
Track a User Action
POST https://api.moesif.net/v1/actions
Log a single user action to Moesif. An action represents something a customer performed on your website such as Sign In or Purchased Subscription. Each action consists of an Action Name and optional Metadata.
An example tracking actions using moesif-browser-js:
var moesif = require('moesif-browser-js');
moesif.init({
applicationId: 'YOUR_COLLECTOR_APPLICATION_ID'
});
// The first argument (required) contains the action name string.
// The second argument (optional) contains event metadata.
moesif.track('Clicked Sign Up', {
button_label: 'Get Started',
sign_up_method: 'Google SSO'
});
POST https://api.moesif.net/v1/actions
Example Request
{
"action_name": "Clicked Sign Up",
"user_id": "12345",
"company_id": "67890",
"session_token": "XXXXX",
"request": {
"uri": "https://acmeinc.com/pricing",
"user_agent_string": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"
},
"metadata": {
"button_label": "Get Started",
"sign_up_method": "Google SSO"
}
}
# You can also use wget
curl -X POST https://api.moesif.net/v1/actions \
-H 'Content-Type: application/json' \
-H 'X-Moesif-Application-Id: YOUR_COLLECTOR_APPLICATION_ID' \
-d '{"action_name":"Clicked Sign Up","user_id":"12345","company_id":"67890","session_token":"XXXXX","request":{"uri":"https://acmeinc.com/pricing","user_agent_string":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"},"metadata":{"button_label":"Get Started","sign_up_method":"Google SSO"}}'
var moesif = require('moesif-browser-js');
moesif.init({
applicationId: 'YOUR_COLLECTOR_APPLICATION_ID'
});
// The first argument (required) contains the action name string.
// The second argument (optional) contains event metadata.
moesif.track('Clicked Sign Up', {
button_label: 'Get Started',
sign_up_method: 'Google SSO'
});
Name | Type | Required | Description |
---|---|---|---|
action_name | string | true | A recognizable name such as Clicked Sign Up or Purchased Subscription |
session_token | string | false | The customer’s current session token as a string. |
user_id | string | false | The user identifier to associate this action with. |
company_id | string | false | The company identifier to associate this action with (Helpful for B2B companies). |
metadata | object | false | An object containing any custom event metadata you want to store with this event. |
request | object | true | The object containing the action’s request context. |
time |
string(date-time) | false | Timestamp for the action in ISO 8601 format. Set by server automatically if not set. |
uri |
string | true | Full uri customer is on such as https://wwww.acmeinc.com/pricing?utm_source=adwords including protocol, host, and query string. |
ip_address |
string | false | IP address of the customer, If not set, we extract the remote IP address. |
user_agent_string |
string | false | The customer’s browser agent string for device context. |
Track User Actions in Batch
POST https://api.moesif.net/v1/actions/batch
Log a batch of user action to Moesif. An action represents something a customer performed on your website such as Sign In or Purchased Subscription. Each action consists of an Action Name and optional Metadata.
This API takes an array form of the same model defined for track single action. The maximum batch size is 12MB. Break up larger batches.
An example tracking actions using moesif-browser-js:
var moesif = require('moesif-browser-js');
moesif.init({
applicationId: 'YOUR_COLLECTOR_APPLICATION_ID'
});
// The first argument (required) contains the action name string.
// The second argument (optional) contains event metadata.
moesif.track('Clicked Sign Up', {
button_label: 'Get Started',
sign_up_method: 'Google SSO'
});
POST https://api.moesif.net/v1/actions/batch
Example Request
[
{
"action_name": "Clicked Sign Up",
"user_id": "12345",
"company_id": "67890",
"session_token": "XXXXX",
"request": {
"uri": "https://acmeinc.com/pricing",
"user_agent_string": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"
},
"metadata": {
"button_label": "Get Started",
"sign_up_method": "Google SSO"
}
},
{
"action_name": "Purchased Subscription",
"user_id": "12345",
"company_id": "67890",
"session_token": "XXXXX",
"request": {
"uri": "https://acmeinc.com/pricing",
"user_agent_string": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"
},
"metadata": {
"plan_name": "Pay As You Go",
"plan_revenue": 5000
}
}
]
# You can also use wget
curl -X POST https://api.moesif.net/v1/actions/batch \
-H 'Content-Type: application/json' \
-H 'X-Moesif-Application-Id: YOUR_COLLECTOR_APPLICATION_ID' \
-d '[{"action_name":"Clicked Sign Up","user_id":"12345","company_id":"67890","session_token":"XXXXX","request":{"uri":"https://acmeinc.com/pricing","user_agent_string":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"},"metadata":{"button_label":"Get Started","sign_up_method":"Google SSO"}},{"action_name":"Purchased Subscription","user_id":"12345","company_id":"67890","session_token":"XXXXX","request":{"uri":"https://acmeinc.com/pricing","user_agent_string":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"},"metadata":{"plan_name":"Pay As You Go","plan_revenue":5000}}]'
var moesif = require('moesif-browser-js');
moesif.init({
applicationId: 'YOUR_COLLECTOR_APPLICATION_ID'
});
// The first argument (required) contains the action name string.
// The second argument (optional) contains event metadata.
moesif.track('Clicked Sign Up', {
button_label: 'Get Started',
sign_up_method: 'Google SSO'
});
Name | Type | Required | Description |
---|---|---|---|
action_name | string | true | A recognizable name such as Clicked Sign Up or Purchased Subscription |
session_token | string | false | The customer’s current session token as a string. |
user_id | string | false | The user identifier to associate this action with. |
company_id | string | false | The company identifier to associate this action with (Helpful for B2B companies). |
metadata | object | false | An object containing any custom event metadata you want to store with this event. |
request | object | true | The object containing the action’s request context. |
time |
string(date-time) | false | Timestamp for the action in ISO 8601 format. Set by server automatically if not set. |
uri |
string | true | Full uri customer is on such as https://wwww.acmeinc.com/pricing?utm_source=adwords including protocol, host, and query string. |
ip_address |
string | false | IP address of the customer, If not set, we extract the remote IP address. |
user_agent_string |
string | false | The customer’s browser agent string for device context. |
Users
Update a User
POST https://api.moesif.net/v1/users
Updates a user profile in Moesif, which can be a customer or API consumer. Adding user metadata enables you to understand API usage across different cohorts, user demographics, acquisition channels, etc.
Moesif has client integrations like moesif-browser-js or Segment to make this easy.
User properties can be stored via the metadata
object.
We’ve reserved some metadata
fields that have semantic meanings for users, and we handle them in special ways.
For example, we expect email to be a string containing the user’s email address which is used to look up a user’s demographic enrichment data
and send behavioral emails.
Reserved metadata fields include:
- name (Which can contain both first and last name)
- first_name
- last_name
- phone
- photo_url
Create vs update
If the user does not exist, Moesif will create a new one.
If a user exists, the new user properties will be merged with the existing properties recursively. This means you don’t need to resend the entire user object if you are only updating a single field.
Do not call identifyUser for anonymous visitors. The SDK automatically tracks these via a generated anonymousId in localStorage. Once you call identifyUser, Moesif automatically merges multiple user profiles if needed.
POST https://api.moesif.net/v1/users
Example Request
{
"user_id": "12345",
"company_id": "67890",
"session_token": "XXXXXXXXXX",
"campaign": {
"utm_source": "google",
"utm_medium": "cpc",
"utm_campaign": "adwords",
"utm_term": "api+tooling",
"utm_content": "landing"
},
"metadata": {
"email": "john@acmeinc.com",
"first_name": "John",
"last_name": "Doe",
"title": "Software Engineer",
"sales_info": {
"stage": "Customer",
"lifetime_value": 24000,
"account_owner": "mary@contoso.com"
}
}
}
# You can also use wget
curl -X POST https://api.moesif.net/v1/users \
-d '{"user_id":"12345","company_id":"67890","session_token":"XXXXXXXXXX","campaign":{"utm_source":"google","utm_medium":"cpc","utm_campaign":"adwords","utm_term":"api+tooling","utm_content":"landing"},"metadata":{"email":"john@acmeinc.com","first_name":"John","last_name":"Doe","title":"Software Engineer","sales_info":{"stage":"Customer","lifetime_value":24000,"account_owner":"mary@contoso.com"}}}' \
-H 'Accept: application/json' \
-H 'X-Moesif-Application-Id: YOUR_COLLECTOR_APPLICATION_ID'
var moesifapi = require('moesifapi');
var apiClient = moesifapi.ApiController;
moesifapi.configuration.ApplicationId = "YOUR_COLLECTOR_APPLICATION_ID";
// Only userId is required.
// metadata can be any custom object
var user = {
userId: '12345',
companyId: '67890'
campaign: {
utmSource: 'google',
utmMedium: 'cpc',
utmCampaign: 'adwords',
utmTerm: 'api+tooling',
utmContent: 'landing'
},
metadata: {
email: 'john@acmeinc.com',
firstName: 'John',
lastName: 'Doe',
title: 'Software Engineer',
salesInfo: {
stage: 'Customer',
lifetimeValue: 24000,
accountOwner: 'mary@contoso.com',
},
}
};
// 4. Create a single user
apiClient.updateUser(new moesifapi.UserModel(user), function(error, response, context) {
// Do Something
});
from moesifapi.moesif_api_client import *
from moesifapi.models import *
api_client = MoesifAPIClient("YOUR_COLLECTOR_APPLICATION_ID").api
# Only user_id is required.
# Campaign object is optional, but useful if you want to track ROI of acquisition channels
# See https://www.moesif.com/docs/api#users for campaign schema
# metadata can be any custom object
user = {
'user_id': '12345',
'company_id': '67890', # If set, associate user with a company object
'campaign': {
'utm_source': 'google',
'utm_medium': 'cpc',
'utm_campaign': 'adwords',
'utm_term': 'api+tooling',
'utm_content': 'landing'
},
'metadata': {
'email': 'john@acmeinc.com',
'first_name': 'John',
'last_name': 'Doe',
'title': 'Software Engineer',
'sales_info': {
'stage': 'Customer',
'lifetime_value': 24000,
'account_owner': 'mary@contoso.com'
},
}
}
update_user = api_client.update_user(user)
api_client = MoesifApi::MoesifAPIClient.new('YOUR_COLLECTOR_APPLICATION_ID').api
metadata => {
:email => 'john@acmeinc.com',
:first_name => 'John',
:last_name => 'Doe',
:title => 'Software Engineer',
:salesInfo => {
:stage => 'Customer',
:lifetime_value => 24000,
:accountOwner => 'mary@contoso.com',
}
}
# Campaign object is optional, but useful if you want to track ROI of acquisition channels
# See https://www.moesif.com/docs/api#users for campaign schema
campaign = CampaignModel.new()
campaign.utm_source = "google"
campaign.utm_medium = "cpc"
campaign.utm_campaign = "adwords"
campaign.utm_term = "api+tooling"
campaign.utm_content = "landing"
# Only user_id is required.
# metadata can be any custom object
user = UserModel.new()
user.user_id = "12345"
user.company_id = "67890" # If set, associate user with a company object
user.campaign = campaign
user.metadata = metadata
update_user = api_client.update_user(user)
<?php
// Depending on your project setup, you might need to include composer's
// autoloader in your PHP code to enable autoloading of classes.
require_once "vendor/autoload.php";
// Import the SDK client in your project:
use MoesifApi\MoesifApiClient;
$apiClient = new MoesifApiClient("YOUR_COLLECTOR_APPLICATION_ID")->getApi();;
// Campaign object is optional, but useful if you want to track ROI of acquisition channels
// See https://www.moesif.com/docs/api#update-a-user for campaign schema
$campaign = new Models\CampaignModel();
$campaign->utmSource = "google";
$campaign->utmCampaign = "cpc";
$campaign->utmMedium = "adwords";
$campaign->utmContent = "api+tooling";
$campaign->utmTerm = "landing";
// metadata can be any custom object
$user->metadata = array(
"email" => "john@acmeinc.com",
"first_name" => "John",
"last_name" => "Doe",
"title" => "Software Engineer",
"sales_info" => array(
"stage" => "Customer",
"lifetime_value" => 24000,
"account_owner" => "mary@contoso.com"
)
);
$user = new Models\UserModel();
$user->userId = "12345";
$user->companyId = "67890"; // If set, associate user with a company object
$user->campaign = $campaign;
$user->metadata = $metadata;
$apiClient->updateUser($user);
import "github.com/moesif/moesifapi-go"
import "github.com/moesif/moesifapi-go/models"
apiClient := moesifapi.NewAPI("YOUR_COLLECTOR_APPLICATION_ID")
// Campaign object is optional, but useful if you want to track ROI of acquisition channels
// See https://www.moesif.com/docs/api#users for campaign schema
campaign := models.CampaignModel {
UtmSource: "google",
UtmMedium: "cpc",
UtmCampaign: "adwords",
UtmTerm: "api+tooling",
UtmContent: "landing",
}
// metadata can be any custom dictionary
metadata := map[string]interface{}{
"email", "john@acmeinc.com",
"first_name", "John",
"last_name", "Doe",
"title", "Software Engineer",
"sales_info", map[string]interface{}{
"stage", "Customer",
"lifetime_value", 24000,
"account_owner", "mary@contoso.com",
},
}
// Only UserId is required
user := models.UserModel{
UserId: "12345",
CompanyId: "67890", // If set, associate user with a company object
Campaign: &campaign,
Metadata: &metadata,
}
// Queue the user asynchronously
err := apiClient.QueueUser(&user)
// Update the user synchronously
err := apiClient.UpdateUser(&user)
var apiClient = new MoesifApiClient("YOUR_COLLECTOR_APPLICATION_ID").Api;;
// Campaign object is optional, but useful if you want to track ROI of acquisition channels
// See https://www.moesif.com/docs/api#users for campaign schema
var campaign = new CampaignModel()
{
UtmSource = "google",
UtmMedium = "cpc"
UtmCampaign = "adwords"
UtmTerm = "api+tooling"
UtmContent = "landing"
};
// metadata can be any custom dictionary
var metadata = new Dictionary<string, object>
{
{"email", "john@acmeinc.com"},
{"first_name", "John"},
{"last_name", "Doe"},
{"title", "Software Engineer"},
{"sales_info", new Dictionary<string, object> {
{"stage", "Customer"},
{"lifetime_value", 24000},
{"account_owner", "mary@contoso.com"}
}
};
// Only user_id is required
var user = new UserModel()
{
UserId = "12345",
CompanyId = "67890",
Campaign = campaign,
Metadata = metadata
};
// Update the user asynchronously
await apiClient.UpdateUserAsync(user);
// Update the user synchronously
apiClient.UpdateUser(user);
MoesifAPIClient apiClient = new MoesifAPIClient("YOUR_COLLECTOR_APPLICATION_ID");
// Campaign object is optional, but useful if you want to track ROI of acquisition channels
// See https://www.moesif.com/docs/api#users for campaign schema
CampaignModel campaign = new CampaignBuilder()
.utmSource("google")
.utmCampaign("cpc")
.utmMedium("adwords")
.utmTerm("api+tooling")
.utmContent("landing")
.build();
// Only userId is required
// metadata can be any custom object
UserModel user = new UserBuilder()
.userId("12345")
.companyId("67890") // If set, associate user with a company object
.campaign(campaign)
.metadata(APIHelper.deserialize("{" +
"\"email\": \"johndoe@acmeinc.com\"," +
"\"first_name\": \"John\"," +
"\"last_name\": \"Doe\"," +
"\"title\": \"Software Engineer\"," +
"\"sales_info\": {" +
"\"stage\": \"Customer\"," +
"\"lifetime_value\": 24000," +
"\"account_owner\": \"mary@contoso.com\"" +
"}" +
"}"))
.build();
// Synchronous Call to update user
apiClient.updateUser(user);
// Asynchronous Call to update user
apiClient.updateUserAsync(user, callBack);
var moesif = require('moesif-browser-js');
moesif.init({
applicationId: 'YOUR_COLLECTOR_APPLICATION_ID'
// add other option here.
});
// The second argument containing user metatdata is optional,
// but useful to store customer properties like email and name.
moesif.identifyUser('12345', {
email: 'john@acmeinc.com',
firstName: 'John',
lastName: 'Doe',
title: 'Software Engineer',
salesInfo: {
stage: 'Customer',
lifetimeValue: 24000,
accountOwner: 'mary@contoso.com',
},
});
User id
Users in Moesif are identified via a user_id
and should be a permanent and robust identifier, like a database id.
We recommend not using values that can change like email addresses or usernames.
The user_id matches the identifyUser hook in your API monitoring agent.
Users can also be associated to a company by setting the company_id
field when you update a user. This enables tracking API usage for
individual users along with account-level usage.
Name | Type | Required | Description |
---|---|---|---|
user_id | string | true | The unique identifier for this user. |
company_id | string | false | Associate the user with a company (Helpful for B2B companies) |
session_token | string | false | Associate this user with a new API key/session token. This field is append only meaning when you set this field, previously set tokens are not removed. |
modified_time | string(date-time) | false | Last modified time of user profile. Set automatically by Moesif if not provided. |
ip_address | string | false | Set the user’s last known ip address. Moesif sets this automatically from the user’s most recent API activity if not provided. |
user_agent_string | string | false | Set the user’s last known user agent. Moesif sets this automatically from the user’s most recent API activity if not provided. |
campaign | object | false | Referrer and UTM parameters to track effectiveness of your acquisition channels. Set automatically by moesif-browser-js, but not with server side SDKs |
utm_source |
string | false | UTM parameter that identifies which site sent the traffic |
utm_medium |
string | false | UTM parameter that identifies what type of link was used, such as cost per click or email. |
utm_campaign |
string | false | UTM parameter that identifies a specific product promotion or strategic campaign. |
utm_term |
string | false | UTM parameter that identifies search terms. |
utm_content |
string | false | UTM parameter that identifies what specifically was clicked to bring the user to the site, such as a banner ad or a text link. |
referrer |
string | false | The referring URI before your domain. |
referring_domain |
string | false | The referring domain of the page that linked to your domain. |
gclid |
string | false | Google click Identifier to track Google Ads |
metadata | object | false | An object containing user demographics or other properties you want to store with this profile. |
Update Users in Batch
POST https://api.moesif.net/v1/users/batch
Updates a list of user profiles in a single batch. Users can be customers or end users accessing the API. Adding user metadata enables you to understand API usage across different cohorts, user demographics, acquisition channels, etc.
Any custom user properties can be stored via the metadata
object.
We’ve reserved some fields names in the metadata
object that have semantic meanings for users, and we handle them in special ways.
For example, we expect email to be a string containing the user’s email address which is used to sync with
external CRMs and to look up a user’s Gravatar and demographics.
Reserved metadata fields include:
- name (Which can contain both first and last name)
- first_name
- last_name
- phone
- photo_url
Create vs update
If the user does not exist, Moesif will create a new one.
If a user exists, the new user properties will be merged with the existing properties recursively. This means you don’t need to resend the entire user object if you are only updating a single field.
POST https://api.moesif.net/v1/users/batch
Example Request
[
{
"user_id": "12345",
"company_id": "67890",
"session_token": "XXXXXXXXXX",
"campaign": {
"utm_source": "google",
"utm_medium": "cpc",
"utm_campaign": "adwords",
"utm_term": "api+tooling",
"utm_content": "landing"
},
"metadata": {
"email": "john@acmeinc.com",
"first_name": "John",
"last_name": "Doe",
"title": "Software Engineer",
"sales_info": {
"stage": "Customer",
"lifetime_value": 24000,
"account_owner": "mary@contoso.com"
}
}
},
{
"user_id": "54321",
"company_id": "67890",
"session_token": "XXXXXXXXXX",
"campaign": {
"utm_source": "google",
"utm_medium": "cpc",
"utm_campaign": "adwords",
"utm_term": "api+tooling",
"utm_content": "landing"
},
"metadata": {
"email": "mary@acmeinc.com",
"first_name": "Mary",
"last_name": "Jane",
"title": "Software Engineer",
"sales_info": {
"stage": "Customer",
"lifetime_value": 24000,
"account_owner": "mary@contoso.com"
}
}
}
]
# You can also use wget
curl -X POST https://api.moesif.net/v1/users/batch \
-d '[{"user_id":"12345","company_id":"67890","session_token":"XXXXXXXXXX","campaign":{"utm_source":"google","utm_medium":"cpc","utm_campaign":"adwords","utm_term":"api+tooling","utm_content":"landing"},"metadata":{"email":"john@acmeinc.com","first_name":"John","last_name":"Doe","title":"Software Engineer","sales_info":{"stage":"Customer","lifetime_value":24000,"account_owner":"mary@contoso.com"}}},{"user_id":"54321","company_id":"67890","session_token":"XXXXXXXXXX","campaign":{"utm_source":"google","utm_medium":"cpc","utm_campaign":"adwords","utm_term":"api+tooling","utm_content":"landing"},"metadata":{"email":"mary@acmeinc.com","first_name":"Mary","last_name":"Jane","title":"Software Engineer","sales_info":{"stage":"Customer","lifetime_value":24000,"account_owner":"mary@contoso.com"}}}]' \
-H 'Accept: application/json' \
-H 'X-Moesif-Application-Id: YOUR_COLLECTOR_APPLICATION_ID'
var moesifapi = require('moesifapi');
var apiClient = moesifapi.ApiController;
moesifapi.configuration.ApplicationId = "YOUR_COLLECTOR_APPLICATION_ID";
// 3. Generate a User Model
var userA = {
userId: '12345',
companyId: '67890'
campaign: {
utmSource: 'google',
utmMedium: 'cpc',
utmCampaign: 'adwords',
utmTerm: 'api+tooling',
utmContent: 'landing'
},
metadata: {
email: 'john@acmeinc.com',
firstName: 'John',
lastName: 'Doe',
title: 'Software Engineer',
salesInfo: {
stage: 'Customer',
lifetimeValue: 24000,
accountOwner: 'mary@contoso.com',
},
}
};
};
var userB = {
userId: '67890',
companyId: '67890'
campaign: {
utmSource: 'google',
utmMedium: 'cpc',
utmCampaign: 'adwords',
utmTerm: 'api+tooling',
utmContent: 'landing'
},
metadata: {
email: 'mary@contoso.com',
firstName: 'Mary',
lastName: 'Jane',
title: 'Software Engineer',
salesInfo: {
stage: 'Customer',
lifetimeValue: 24000,
accountOwner: 'mary@contoso.com',
},
}
};
var users = [
new moesifapi.UserModel(userA),
new moesifapi.UserModel(userB)
];
// 4. Send batch of users
apiClient.updateUsersBatch(users, function(error, response, context) {
// Do Something
});
from moesifapi.moesif_api_client import *
from moesifapi.models import *
api_client = MoesifAPIClient("YOUR_COLLECTOR_APPLICATION_ID").api
userA = {
'user_id': '12345',
'company_id': '67890', # If set, associate user with a company object
'metadata': {
'email': 'john@acmeinc.com',
'first_name': 'John',
'last_name': 'Doe',
'title': 'Software Engineer',
'sales_info': {
'stage': 'Customer',
'lifetime_value': 24000,
'account_owner': 'mary@contoso.com'
},
}
}
userB = {
'user_id': '54321',
'company_id': '67890', # If set, associate user with a company object
'metadata': {
'email': 'mary@acmeinc.com',
'first_name': 'Mary',
'last_name': 'Jane',
'title': 'Software Engineer',
'sales_info': {
'stage': 'Customer',
'lifetime_value': 48000,
'account_owner': 'mary@contoso.com'
},
}
}
update_users = api_client.update_users_batch([userA, userB])
api_client = MoesifApi::MoesifAPIClient.new('YOUR_COLLECTOR_APPLICATION_ID').api
users = []
metadata => {
:email => 'john@acmeinc.com',
:first_name => 'John',
:last_name => 'Doe',
:title => 'Software Engineer',
:salesInfo => {
:stage => 'Customer',
:lifetime_value => 24000,
:accountOwner => 'mary@contoso.com',
}
}
# Campaign object is optional, but useful if you want to track ROI of acquisition channels
# See https://www.moesif.com/docs/api#users for campaign schema
campaign = CampaignModel.new()
campaign.utm_source = "google"
campaign.utm_medium = "cpc"
campaign.utm_campaign = "adwords"
campaign.utm_term = "api+tooling"
campaign.utm_content = "landing"
# Only user_id is required.
# metadata can be any custom object
user = UserModel.new()
user.user_id = "12345"
user.company_id = "67890" # If set, associate user with a company object
user.campaign = campaign
user.metadata = metadata
users << user
api_client = api_controller.update_users_batch(user_model)
<?php
// Depending on your project setup, you might need to include composer's
// autoloader in your PHP code to enable autoloading of classes.
require_once "vendor/autoload.php";
use MoesifApi\MoesifApiClient;
$apiClient = new MoesifApiClient("YOUR_COLLECTOR_APPLICATION_ID")->getApi();
// metadata can be any custom object
$userA->metadata = array(
"email" => "john@acmeinc.com",
"first_name" => "John",
"last_name" => "Doe",
"title" => "Software Engineer",
"sales_info" => array(
"stage" => "Customer",
"lifetime_value" => 24000,
"account_owner" => "mary@contoso.com"
)
);
$userA = new Models\UserModel();
$userA->userId = "12345";
$userA->companyId = "67890"; // If set, associate user with a company object
$userA->campaign = $campaign;
$userA->metadata = $metadata;
// metadata can be any custom object
$userB->metadata = array(
"email" => "mary@acmeinc.com",
"first_name" => "Mary",
"last_name" => "Jane",
"title" => "Software Engineer",
"sales_info" => array(
"stage" => "Customer",
"lifetime_value" => 24000,
"account_owner" => "mary@contoso.com"
)
);
$userB = new Models\UserModel();
$userB->userId = "12345";
$userB->companyId = "67890"; // If set, associate user with a company object
$userB->campaign = $campaign;
$userB->metadata = $metadata;
$users = array($userA, $userB)
$apiClient->updateUsersBatch($user);
import "github.com/moesif/moesifapi-go"
import "github.com/moesif/moesifapi-go/models"
apiClient := moesifapi.NewAPI("YOUR_COLLECTOR_APPLICATION_ID")
// List of Users
var users []*models.UserModel
// Campaign object is optional, but useful if you want to track ROI of acquisition channels
// See https://www.moesif.com/docs/api#users for campaign schema
campaign := models.CampaignModel {
UtmSource: "google",
UtmMedium: "cpc",
UtmCampaign: "adwords",
UtmTerm: "api+tooling",
UtmContent: "landing",
}
// metadata can be any custom dictionary
metadata := map[string]interface{}{
"email", "john@acmeinc.com",
"first_name", "John",
"last_name", "Doe",
"title", "Software Engineer",
"sales_info", map[string]interface{}{
"stage", "Customer",
"lifetime_value", 24000,
"account_owner", "mary@contoso.com",
},
}
// Only UserId is required
userA := models.UserModel{
UserId: "12345",
CompanyId: "67890", // If set, associate user with a company object
Campaign: &campaign,
Metadata: &metadata,
}
users = append(users, &userA)
// Queue the user asynchronously
err := apiClient.QueueUsers(&users)
// Update the user synchronously
err := apiClient.UpdateUsersBatch(&users)
var apiClient = new MoesifApiClient("YOUR_COLLECTOR_APPLICATION_ID").Api;;
var users = new List<UserModel>();
var metadataA = new Dictionary<string, object>
{
{"email", "john@acmeinc.com"},
{"first_name", "John"},
{"last_name", "Doe"},
{"title", "Software Engineer"},
{"sales_info", new Dictionary<string, object> {
{"stage", "Customer"},
{"lifetime_value", 24000},
{"account_owner", "mary@contoso.com"}
}
};
// Only user_id is required
var userA = new UserModel()
{
UserId = "12345",
CompanyId = "67890", // If set, associate user with a company object
Metadata = metadataA
};
var metadataB = new Dictionary<string, object>
{
{"email", "mary@acmeinc.com"},
{"first_name", "Mary"},
{"last_name", "Jane"},
{"title", "Software Engineer"},
{"sales_info", new Dictionary<string, object> {
{"stage", "Customer"},
{"lifetime_value", 24000},
{"account_owner", "mary@contoso.com"}
}
};
// Only user_id is required
var userB = new UserModel()
{
UserId = "54321",
CompanyId = "67890",
Metadata = metadataA
};
users.Add(userA);
users.Add(userB);
// Update the users asynchronously
await apiClient.UpdateUsersBatchAsync(users);
// Update the users synchronously
apiClient.UpdateUsersBatch(users);
MoesifAPIClient apiClient = new MoesifAPIClient("YOUR_COLLECTOR_APPLICATION_ID");
List<UserModel> users = new ArrayList<UserModel>();
UserModel userA = new UserBuilder()
.userId("12345")
.companyId("67890")
.campaign(campaign)
.metadata(APIHelper.deserialize("{" +
"\"email\": \"johndoe@acmeinc.com\"," +
"\"first_name\": \"John\"," +
"\"last_name\": \"Doe\"," +
"\"title\": \"Software Engineer\"," +
"\"sales_info\": {" +
"\"stage\": \"Customer\"," +
"\"lifetime_value\": 24000," +
"\"account_owner\": \"mary@contoso.com\"" +
"}" +
"}"))
.build();
users.add(userA);
UserModel userB = new UserBuilder()
.userId("54321")
.companyId("67890")
.campaign(campaign)
.metadata(APIHelper.deserialize("{" +
"\"email\": \"johndoe@acmeinc.com\"," +
"\"first_name\": \"John\"," +
"\"last_name\": \"Doe\"," +
"\"title\": \"Software Engineer\"," +
"\"sales_info\": {" +
"\"stage\": \"Customer\"," +
"\"lifetime_value\": 24000," +
"\"account_owner\": \"mary@contoso.com\"" +
"}" +
"}"))
.build();
users.add(userB);
// Asynchronous call to update users
APICallBack<Object> callBack = new APICallBack<Object>() {
public void onSuccess(HttpContext context, Object response) {
// Do something
}
public void onFailure(HttpContext context, Throwable error) {
// Do something else
}
};
// Asynchronous call to update users
apiClient.updateUsersBatchAsync(users, callBack);
// Synchronous call to update users
apiClient.updateUsersBatch(users, callBack);
Since this is a client side SDK, you cannot save a batch of users with moesif-browser-js.
User id
Users in Moesif are identified via a user_id
and should be a permanent and robust identifier, like a database id.
We recommend not using values that can change like email addresses or usernames.
The user_id matches the identifyUser hook in your API monitoring agent.
Users can also be associated to a company by setting the company_id
field when you update a user. This enables tracking API usage for
individual users along with account-level usage.
Name | Type | Required | Description |
---|---|---|---|
user_id | string | true | The unique identifier for this user. |
company_id | string | false | Associate the user with a company (Helpful for B2B companies). |
session_token | string | false | Associate this user with a new API key/session token. This field is append only meaning when you set this field, previously set tokens are not removed. |
modified_time | string(date-time) | false | Last modified time of user profile. Set automatically by Moesif if not provided. |
ip_address | string | false | Set the user’s last known ip address. Moesif sets this automatically from the user’s most recent API activity if not provided. |
user_agent_string | string | false | Set the user’s last known user agent. Moesif sets this automatically from the user’s most recent API activity if not provided. |
campaign | object | false | Referrer and UTM parameters to track effectiveness of your acquisition channels. Set automatically by moesif-browser-js, but not with server side SDKs. |
utm_source |
string | false | UTM parameter that identifies which site sent the traffic. |
utm_medium |
string | false | UTM parameter that identifies what type of link was used, such as cost per click or email. |
utm_campaign |
string | false | UTM parameter that identifies a specific product promotion or strategic campaign. |
utm_term |
string | false | UTM parameter that identifies search terms. |
utm_content |
string | false | UTM parameter that identifies what specifically was clicked to bring the user to the site, such as a banner ad or a text link. |
referrer |
string | false | The referring URI before your domain. |
referring_domain |
string | false | The referring domain of the page that linked to your domain. |
gclid |
string | false | Google click Identifier to track Google Ads. |
metadata | object | false | An object containing user demographics or other properties you want to store with this profile. |
Companies
Update a Company
POST https://api.moesif.net/v1/companies
Updates a company profile in Moesif. A company can be an enterprise account or a group of users accessing the API. Adding company metadata enables you to understand API usage across different cohorts, company demographics, acquisition channels, etc.
Any custom company properties can be stored via the metadata
object.
You can also set the company’s website domain which enables Moesif to automatically your company profiles
with publicly available information.
Create vs update
If the company does not exist, Moesif will create a new one.
If a company exists, the new company properties will be merged with the existing properties recursively. This means you don’t need to resend the entire company object if you are only updating a single field.
If you call both identifyUser() and identifyCompany() in the same session, then Moesif will automatically associate the user with the company.
POST https://api.moesif.net/v1/companies
Example Request
{
"company_id": "12345",
"company_domain": "acmeinc.com",
"campaign": {
"utm_source": "google",
"utm_medium": "cpc",
"utm_campaign": "adwords",
"utm_term": "api+tooling",
"utm_content": "landing"
},
"metadata": {
"org_name": "Acme, Inc",
"plan_name": "Free",
"deal_stage": "Lead",
"mrr": 24000,
"demographics": {
"alexa_ranking": 500000,
"employee_count": 47
}
}
}
# You can also use wget
curl -X POST https://api.moesif.net/v1/companies \
-d '{"company_id":"12345","company_domain":"acmeinc.com","campaign":{"utm_source":"google","utm_medium":"cpc","utm_campaign":"adwords","utm_term":"api+tooling","utm_content":"landing"},"metadata":{"org_name":"Acme, Inc","plan_name":"Free","deal_stage":"Lead","mrr":24000,"demographics":{"alexa_ranking":500000,"employee_count":47}}}' \
-H 'Accept: application/json' \
-H 'X-Moesif-Application-Id: YOUR_COLLECTOR_APPLICATION_ID'
var moesifapi = require('moesifapi');
var apiClient = moesifapi.ApiController;
moesifapi.configuration.ApplicationId = "YOUR_COLLECTOR_APPLICATION_ID";
// Only companyId is required.
// Campaign object is optional, but useful if you want to track ROI of acquisition channels
// See https://www.moesif.com/docs/api#update-a-company for campaign schema
// metadata can be any custom object
var company = {
companyId: '67890',
companyDomain: 'acmeinc.com', // If domain is set, Moesif will enrich your profiles with publicly available info
campaign: {
utmSource: 'google',
utmMedium: 'cpc',
utmCampaign: 'adwords',
utmTerm: 'api+tooling',
utmContent: 'landing'
},
metadata: {
orgName: 'Acme, Inc',
planName: 'Free Plan',
dealStage: 'Lead',
mrr: 24000,
demographics: {
alexaRanking: 500000,
employeeCount: 47
}
}
};
apiClient.updateCompany(company, function(error, response, context) {
// Do Something
});
from moesifapi.moesif_api_client import *
from moesifapi.models import *
api_client = MoesifAPIClient("YOUR_COLLECTOR_APPLICATION_ID").api
# Only company_id is required.
# Campaign object is optional, but useful if you want to track ROI of acquisition channels
# See https://www.moesif.com/docs/api#update-a-company for campaign schema
# metadata can be any custom object
company = {
'company_id': '12345',
'company_domain': 'acmeinc.com', # If domain is set, Moesif will enrich your profiles with publicly available info
'campaign': {
'utm_source': 'google',
'utm_medium': 'cpc',
'utm_campaign': 'adwords',
'utm_term': 'api+tooling',
'utm_content': 'landing'
},
'metadata': {
'org_name': 'Acme, Inc',
'plan_name': 'Free',
'deal_stage': 'Lead',
'mrr': 24000,
'demographics': {
'alexa_ranking': 500000,
'employee_count': 47
},
}
}
update_company = api_client.update_company(company)
api_client = MoesifApi::MoesifAPIClient.new('YOUR_COLLECTOR_APPLICATION_ID').api
metadata => {
:org_name => 'Acme, Inc',
:plan_name => 'Free',
:deal_stage => 'Lead',
:mrr => 24000,
:demographics => {
:alexa_ranking => 500000,
:employee_count => 47
}
}
# Campaign object is optional, but useful if you want to track ROI of acquisition channels
# See https://www.moesif.com/docs/api#update-a-company for campaign schema
campaign = CampaignModel.new()
campaign.utm_source = "google"
campaign.utm_medium = "cpc"
campaign.utm_campaign = "adwords"
campaign.utm_term = "api+tooling"
campaign.utm_content = "landing"
# Only company_id is required.
# metadata can be any custom object
company = CompanyModel.new()
company.company_id = "67890"
company.company_domain = "acmeinc.com" # If domain is set, Moesif will enrich your profiles with publicly available info
company.campaign = campaign
company.metadata = metadata
update_company = api_client.update_company(company)
<?php
// Depending on your project setup, you might need to include composer's
// autoloader in your PHP code to enable autoloading of classes.
require_once "vendor/autoload.php";
use MoesifApi\MoesifApiClient;
$apiClient = new MoesifApiClient("YOUR_COLLECTOR_APPLICATION_ID")->getApi();
// Campaign object is optional, but useful if you want to track ROI of acquisition channels
// See https://www.moesif.com/docs/api#update-a-company for campaign schema
$campaign = new Models\CampaignModel();
$campaign->utmSource = "google";
$campaign->utmCampaign = "cpc";
$campaign->utmMedium = "adwords";
$campaign->utmContent = "api+tooling";
$campaign->utmTerm = "landing";
$company = new Models\CompanyModel();
$company->companyId = "67890";
$company->companyDomain = "acmeinc.com";
$company->campaign = $campaign;
// metadata can be any custom object
$company->metadata = array(
"org_name" => "Acme, Inc",
"plan_name" => "Free",
"deal_stage" => "Lead",
"mrr" => 24000,
"demographics" => array(
"alexa_ranking" => 500000,
"employee_count" => 47
)
);
$apiClient->updateCompany($company);
import "github.com/moesif/moesifapi-go"
import "github.com/moesif/moesifapi-go/models"
apiClient := moesifapi.NewAPI("YOUR_COLLECTOR_APPLICATION_ID")
// Campaign object is optional, but useful if you want to track ROI of acquisition channels
// See https://www.moesif.com/docs/api#update-a-company for campaign schema
campaign := models.CampaignModel {
UtmSource: "google",
UtmMedium: "cpc",
UtmCampaign: "adwords",
UtmTerm: "api+tooling",
UtmContent: "landing",
}
// metadata can be any custom dictionary
metadata := map[string]interface{}{
"org_name", "Acme, Inc",
"plan_name", "Free",
"deal_stage", "Lead",
"mrr", 24000,
"demographics", map[string]interface{}{
"alexa_ranking", 500000,
"employee_count", 47,
},
}
// Prepare company model
company := models.CompanyModel{
CompanyId: "67890", // The only required field is your company id
CompanyDomain: "acmeinc.com", // If domain is set, Moesif will enrich your profiles with publicly available info
Campaign: &campaign,
Metadata: &metadata,
}
// Queue the company asynchronously
apiClient.QueueCompany(&company)
// Update the company synchronously
err := apiClient.UpdateCompany(&company)
var apiClient = new MoesifApiClient("YOUR_COLLECTOR_APPLICATION_ID").Api;;
// Campaign object is optional, but useful if you want to track ROI of acquisition channels
// See https://www.moesif.com/docs/api#companies for campaign schema
var campaign = new CampaignModel()
{
UtmSource = "google",
UtmMedium = "cpc"
UtmCampaign = "adwords"
UtmTerm = "api+tooling"
UtmContent = "landing"
};
// metadata can be any custom dictionary
var metadata = new Dictionary<string, object>
{
{"org_name", "Acme, Inc"},
{"plan_name", "Free"},
{"deal_stage", "Lead"},
{"mrr", 24000},
{"demographics", new Dictionary<string, object> {
{"alexa_ranking", 500000},
{"employee_count", 47}
}
};
// Only company id is required
var company = new CompanyModel()
{
CompanyId = "67890",
CompanyDomain = "acmeinc.com", // If domain is set, Moesif will enrich your profiles with publicly available info
Campaign = campaign,
Metadata = metadata
};
// Update the company asynchronously
await apiClient.UpdateCompanyAsync(company);
// Update the company synchronously
apiClient.UpdateCompany(company);
MoesifAPIClient apiClient = new MoesifAPIClient("YOUR_COLLECTOR_APPLICATION_ID").Api;
// Campaign object is optional, but useful if you want to track ROI of acquisition channels
// See https://www.moesif.com/docs/api#update-a-company for campaign schema
CampaignModel campaign = new CampaignBuilder()
.utmSource("google")
.utmCampaign("cpc")
.utmMedium("adwords")
.utmTerm("api+tooling")
.utmContent("landing")
.build();
// Only companyId is required
// metadata can be any custom object
CompanyModel company = new CompanyBuilder()
.companyId("67890")
.companyDomain("acmeinc.com") // If set, Moesif will enrich your profiles with publicly available info
.campaign(campaign)
.metadata(APIHelper.deserialize("{" +
"\"org_name\": \"Acme, Inc\"," +
"\"plan_name\": \"Free\"," +
"\"deal_stage\": \"Lead\"," +
"\"mrr\": 24000," +
"\"demographics\": {" +
"\"alexa_ranking\": 500000," +
"\"employee_count\": 47" +
"}" +
"}"))
.build();
// Asynchronous Call to update company
apiClient.updateCompanyAsync(company, callBack);
// Synchronous Call to update company
apiClient.updateCompany(company, callBack);
var moesif = require('moesif-browser-js');
moesif.init({
applicationId: 'YOUR_COLLECTOR_APPLICATION_ID'
// add other option here.
});
// Only the first argument is a string containing the company id.
// This is the only required field.
//
// The second argument is a object used to store a company info like plan,
// MRR, and company demographics.
//
// The third argument is a string containing company website or email domain.
// If set, Moesif will enrich your profiles with publicly available info.
metadata = {
orgName: 'Acme, Inc',
planName: 'Free Plan',
dealStage: 'Lead',
mrr: 24000,
demographics: {
alexaRanking: 500000,
employeeCount: 47
}
};
moesif.identifyCompany('67890', metadata, 'acmeinc.com');
Company ids
Users in Moesif are identified via a company_id
and should be a permanent and robust identifier, like a database id.
We recommend not using values that can change like website domain or company name.
The company_id matches the identifyCompany hook in your API monitoring agent.
Users can also be associated to a company by setting the company_id
field when you update a user. This enables tracking API usage for
individual users along with account-level usage.
Name | Type | Required | Description |
---|---|---|---|
company_id | string | true | The unique identifier for this company. |
company_domain | string | false | If set, Moesif will enrich your company profile with publicly available info |
session_token | string | false | Associate this company with a new API key/session token. This field is append only meaning when you set this field, previously set tokens are not removed. |
modified_time | string(date-time) | false | Last modified time of company profile. Set automatically by Moesif if not provided. |
ip_address | string | false | Set the company’s last known ip address. Moesif sets this automatically from the user’s most recent API activity if not provided. |
campaign | object | false | Referrer and UTM parameters to track effectiveness of your acquisition channels. Set automatically by moesif-browser-js, but not with server side SDKs |
utm_source |
string | false | UTM parameter that identifies which site sent the traffic |
utm_medium |
string | false | UTM parameter that identifies what type of link was used, such as cost per click or email. |
utm_campaign |
string | false | UTM parameter that identifies a specific product promotion or strategic campaign. |
utm_term |
string | false | UTM parameter that identifies search terms. |
utm_content |
string | false | UTM parameter that identifies what specifically was clicked to bring the company to the site, such as a banner ad or a text link. |
referrer |
string | false | The referring URI before your domain. |
referring_domain |
string | false | The referring domain of the page that linked to your domain. |
gclid |
string | false | Google click Identifier to track Google Ads |
metadata | object | false | An object containing company demographics or other properties you want to store with this profile. |
Update Companies in Batch
POST https://api.moesif.net/v1/companies/batch
Updates a list of companies profile in Moesif.
A custom JSON object can be placed in the metadata
object of each company
which will be stored as part of the company profile.
While optional, you can set the company_domain
field which enables Moesif
to enrich your company profiles with stuff like company logo.
If company does not exist, a new one will be created. If a company exists, it will be merged on top of existing fields. Any new field set will override the existing fields. This is done via recursive merge which merges inner objects.
POST https://api.moesif.net/v1/companies/batch
Example Request
[
{
"company_id": "12345",
"company_domain": "acmeinc.com",
"campaign": {
"utm_source": "google",
"utm_medium": "cpc",
"utm_campaign": "adwords",
"utm_term": "api+tooling",
"utm_content": "landing"
},
"metadata": {
"org_name": "Acme, Inc",
"plan_name": "Free",
"deal_stage": "Lead",
"mrr": 24000,
"demographics": {
"alexa_ranking": 500000,
"employee_count": 47
}
}
},
{
"company_id": "54321",
"company_domain": "contoso.com",
"campaign": {
"utm_source": "facebook",
"utm_medium": "dislay",
"utm_campaign": "retargeting"
},
"metadata": {
"org_name": "Contoso, Inc",
"plan_name": "Paid",
"deal_stage": "Lead",
"mrr": 48000,
"demographics": {
"alexa_ranking": 500000,
"employee_count": 47
}
}
}
]
# You can also use wget
curl -X POST https://api.moesif.net/v1/companies/batch \
-d '[{"company_id":"12345","company_domain":"acmeinc.com","campaign":{"utm_source":"google","utm_medium":"cpc","utm_campaign":"adwords","utm_term":"api+tooling","utm_content":"landing"},"metadata":{"org_name":"Acme, Inc","plan_name":"Free","deal_stage":"Lead","mrr":24000,"demographics":{"alexa_ranking":500000,"employee_count":47}}},{"company_id":"54321","company_domain":"contoso.com","campaign":{"utm_source":"facebook","utm_medium":"dislay","utm_campaign":"retargeting"},"metadata":{"org_name":"Contoso, Inc","plan_name":"Paid","deal_stage":"Lead","mrr":48000,"demographics":{"alexa_ranking":500000,"employee_count":47}}}]' \
-H 'Accept: application/json' \
-H 'X-Moesif-Application-Id: YOUR_COLLECTOR_APPLICATION_ID'
var moesifapi = require('moesifapi');
var apiClient = moesifapi.ApiController;
moesifapi.configuration.ApplicationId = "YOUR_COLLECTOR_APPLICATION_ID";
// Only companyId is required.
// Campaign object is optional, but useful if you want to track ROI of acquisition channels
// See https://www.moesif.com/docs/api#update-a-company for campaign schema
// metadata can be any custom object
var companies = [{
companyId: '67890',
companyDomain: 'acmeinc.com', // If domain is set, Moesif will enrich your profiles with publicly available info
campaign: {
utmSource: 'google',
utmMedium: 'cpc',
utmCampaign: 'adwords',
utmTerm: 'api+tooling',
utmContent: 'landing'
},
metadata: {
orgName: 'Acme, Inc',
planName: 'Free Plan',
dealStage: 'Lead',
mrr: 24000,
demographics: {
alexaRanking: 500000,
employeeCount: 47
}
}
},
{
companyId: '09876',
companyDomain: 'contoso.com', // If domain is set, Moesif will enrich your profiles with publicly available info
campaign: {
utmSource: 'facebook',
utmMedium: 'cpc',
utmCampaign: 'retargeting'
},
metadata: {
orgName: 'Contoso, Inc',
planName: 'Paid Plan',
dealStage: 'Lead',
mrr: 48000,
demographics: {
alexaRanking: 500000,
employeeCount: 53
}
}
}
]
apiClient.updateCompanies(companies, function(error, response, context) {
// Do Something
});
from moesifapi.moesif_api_client import *
from moesifapi.models import *
api_client = MoesifAPIClient("YOUR_COLLECTOR_APPLICATION_ID").api
# Only company_id is required.
# Campaign object is optional, but useful if you want to track ROI of acquisition channels
# See https://www.moesif.com/docs/api#update-a-company for campaign schema
# metadata can be any custom object
companies = [{
'company_id': '67890',
'company_domain': 'acmeinc.com', # If domain is set, Moesif will enrich your profiles with publicly available info
'campaign': {
'utm_source': 'google',
'utm_medium': 'cpc',
'utm_campaign': 'adwords',
'utm_term': 'api+tooling',
'utm_content': 'landing'
},
'metadata': {
'org_name': 'Acme, Inc',
'plan_name': 'Free',
'deal_stage': 'Lead',
'mrr': 24000,
'demographics': {
'alexa_ranking': 500000,
'employee_count': 47
},
}
},
{
'company_id': '09876',
'company_domain': 'contoso.com', # If domain is set, Moesif will enrich your profiles with publicly available info
'campaign': {
'utm_source': 'facebook',
'utm_medium': 'cpc',
'utm_campaign': 'retargeting'
},
'metadata': {
'org_name': 'Contoso, Inc',
'plan_name': 'Paid',
'deal_stage': 'Lead',
'mrr': 48000,
'demographics': {
'alexa_ranking': 500000,
'employee_count': 53
},
}
}]
update_company = api_client.update_companies(companies)
api_client = MoesifApi::MoesifAPIClient.new('YOUR_COLLECTOR_APPLICATION_ID').api
companies = []
metadata => {
:org_name => 'Acme, Inc',
:plan_name => 'Free',
:deal_stage => 'Lead',
:mrr => 24000,
:demographics => {
:alexa_ranking => 500000,
:employee_count => 47
}
}
# Campaign object is optional, but useful if you want to track ROI of acquisition channels
# See https://www.moesif.com/docs/api#update-a-company for campaign schema
campaign = CampaignModel.new()
campaign.utm_source = "google"
campaign.utm_medium = "cpc"
campaign.utm_campaign = "adwords"
campaign.utm_term = "api+tooling"
campaign.utm_content = "landing"
# Only company_id is required.
# metadata can be any custom object
company = CompanyModel.new()
company.company_id = "67890"
company.company_domain = "acmeinc.com" # If domain is set, Moesif will enrich your profiles with publicly available info
company.campaign = campaign
company.metadata = metadata
companies << company
update_company = api_client.update_companies(companies)
<?php
// Depending on your project setup, you might need to include composer's
// autoloader in your PHP code to enable autoloading of classes.
require_once "vendor/autoload.php";
use MoesifApi\MoesifApiClient;
$apiClient = new MoesifApiClient("YOUR_COLLECTOR_APPLICATION_ID")->getApi();
// Campaign object is optional, but useful if you want to track ROI of acquisition channels
// See https://www.moesif.com/docs/api#update-a-company for campaign schema
$campaignA = new Models\CampaignModel();
$campaignA->utmSource = "google";
$campaignA->utmCampaign = "cpc";
$campaignA->utmMedium = "adwords";
$campaignA->utmContent = "api+tooling";
$campaignA->utmTerm = "landing";
$companyA = new Models\CompanyModel();
$companyA->companyId = "67890";
$companyA->companyDomain = "acmeinc.com";
$companyA->campaign = $campaign;
// metadata can be any custom object
$companyB->metadata = array(
"org_name" => "Acme, Inc",
"plan_name" => "Free",
"deal_stage" => "Lead",
"mrr" => 24000,
"demographics" => array(
"alexa_ranking" => 500000,
"employee_count" => 47
)
);
$companyB = new Models\CompanyModel();
$companyB->companyId = "67890";
$companyB->companyDomain = "acmeinc.com";
$companyB->campaign = $campaign;
// metadata can be any custom object
$companyB->metadata = array(
"org_name" => "Acme, Inc",
"plan_name" => "Free",
"deal_stage" => "Lead",
"mrr" => 24000,
"demographics" => array(
"alexa_ranking" => 500000,
"employee_count" => 47
)
);
$companies = array($companyA, $companyB)
$apiClient->updateCompaniesBatch(array($companies));
import "github.com/moesif/moesifapi-go"
import "github.com/moesif/moesifapi-go/models"
apiClient := moesifapi.NewAPI("YOUR_COLLECTOR_APPLICATION_ID")
// List of Companies
var companies []*models.CompanyModel
// Campaign object is optional, but useful if you want to track ROI of acquisition channels
// See https://www.moesif.com/docs/api#update-a-company for campaign schema
campaign := models.CampaignModel {
UtmSource: "google",
UtmMedium: "cpc",
UtmCampaign: "adwords",
UtmTerm: "api+tooling",
UtmContent: "landing",
}
// metadata can be any custom dictionary
metadata := map[string]interface{}{
"org_name", "Acme, Inc",
"plan_name", "Free",
"deal_stage", "Lead",
"mrr", 24000,
"demographics", map[string]interface{}{
"alexa_ranking", 500000,
"employee_count", 47,
},
}
// Prepare company model
companyA := models.CompanyModel{
CompanyId: "67890", // The only required field is your company id
CompanyDomain: "acmeinc.com", // If domain is set, Moesif will enrich your profiles with publicly available info
Campaign: &campaign,
Metadata: &metadata,
}
companies = append(companies, &companyA)
// Queue the company asynchronously
apiClient.QueueCompanies(&companies)
// Update the company synchronously
err := apiClient.UpdateCompaniesBatch(&companies)
var apiClient = new MoesifApiClient("YOUR_COLLECTOR_APPLICATION_ID").Api;;
var companies = new List<CompanyModel>();
// Campaign object is optional, but useful if you want to track ROI of acquisition channels
// See https://www.moesif.com/docs/api#companies for campaign schema
var campaignA = new CampaignModel()
{
UtmSource = "google",
UtmMedium = "cpc"
UtmCampaign = "adwords"
UtmTerm = "api+tooling"
UtmContent = "landing"
};
// metadata can be any custom dictionary
var metadataA = new Dictionary<string, object>
{
{"org_name", "Acme, Inc"},
{"plan_name", "Free"},
{"deal_stage", "Lead"},
{"mrr", 24000},
{"demographics", new Dictionary<string, object> {
{"alexa_ranking", 500000},
{"employee_count", 47}
}
};
// Only company id is required
var companyA = new CompanyModel()
{
CompanyId = "67890",
CompanyDomain = "acmeinc.com", // If domain is set, Moesif will enrich your profiles with publicly available info
Campaign = campaign,
Metadata = metadata
};
// metadata can be any custom dictionary
var metadataB = new Dictionary<string, object>
{
{"org_name", "Contoso, Inc"},
{"plan_name", "Paid"},
{"deal_stage", "Lead"},
{"mrr", 48000},
{"demographics", new Dictionary<string, object> {
{"alexa_ranking", 500000},
{"employee_count", 53}
}
};
// Only company id is required
var companyB = new CompanyModel()
{
CompanyId = "09876",
CompanyDomain = "contoso.com", // If domain is set, Moesif will enrich your profiles with publicly available info
Campaign = campaign,
Metadata = metadata
};
companies.Add(companyA);
companies.Add(companyB);
// Update the companies asynchronously
await apiClient.UpdateCompaniesBatchAsync(companies);
// Update the companies synchronously
apiClient.UpdateCompaniesBatch(companies);
MoesifAPIClient apiClient = new MoesifAPIClient("YOUR_COLLECTOR_APPLICATION_ID").Api;
// Campaign object is optional, but useful if you want to track ROI of acquisition channels
// See https://www.moesif.com/docs/api#update-a-company for campaign schema
CampaignModel campaign = new CampaignBuilder()
.utmSource("google")
.utmCampaign("cpc")
.utmMedium("adwords")
.utmTerm("api+tooling")
.utmContent("landing")
.build();
// Only companyId is required
// metadata can be any custom object
CompanyModel company = new CompanyBuilder()
.companyId("67890")
.companyDomain("acmeinc.com") // If set, Moesif will enrich your profiles with publicly available info
.campaign(campaign)
.metadata(APIHelper.deserialize("{" +
"\"org_name\": \"Acme, Inc\"," +
"\"plan_name\": \"Free\"," +
"\"deal_stage\": \"Lead\"," +
"\"mrr\": 24000," +
"\"demographics\": {" +
"\"alexa_ranking\": 500000," +
"\"employee_count\": 47" +
"}" +
"}"))
.build();
// Asynchronous Call to update company
apiClient.updateCompanyAsync(company, callBack);
// Synchronous Call to update company
apiClient.updateCompany(company, callBack);
Since this is a client side SDK, you cannot save a batch of companies with moesif-browser-js.
Company ids
Users in Moesif are identified via a company_id
and should be a permanent and robust identifier, like a database id.
We recommend not using values that can change like website domain or company name.
The company_id matches the identifyCompany hook in your API monitoring agent.
Users can also be associated to a company by setting the company_id
field when you update a user. This enables tracking API usage for
individual users along with account-level usage.
Name | Type | Required | Description |
---|---|---|---|
company_id | string | true | The unique identifier for this company. |
company_domain | string | false | If set, Moesif will enrich your company profile with publicly available info |
session_token | string | false | Associate this company with a new API key/session token. This field is append only meaning when you set this field, previously set tokens are not removed. |
modified_time | string(date-time) | false | Last modified time of company profile. Set automatically by Moesif if not provided. |
ip_address | string | false | Set the company’s last known ip address. Moesif sets this automatically from the user’s most recent API activity if not provided. |
campaign | object | false | Referrer and UTM parameters to track effectiveness of your acquisition channels. Set automatically by moesif-browser-js, but not with server side SDKs |
utm_source |
string | false | UTM parameter that identifies which site sent the traffic |
utm_medium |
string | false | UTM parameter that identifies what type of link was used, such as cost per click or email. |
utm_campaign |
string | false | UTM parameter that identifies a specific product promotion or strategic campaign. |
utm_term |
string | false | UTM parameter that identifies search terms. |
utm_content |
string | false | UTM parameter that identifies what specifically was clicked to bring the company to the site, such as a banner ad or a text link. |
referrer |
string | false | The referring URI before your domain. |
referring_domain |
string | false | The referring domain of the page that linked to your domain. |
gclid |
string | false | Google click Identifier to track Google Ads |
metadata | object | false | An object containing company demographics or other properties you want to store with this profile. |
Management API v1
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
Management API to query data in Moesif. You can use the management API to export data for custom reports or to build custom dashboards. Only SSL encrypted traffic is allowed.
Base URL (Public) | Base URL (When using Secure Proxy) |
---|---|
api.moesif.com/v1 |
localhost:9500/api |
If you’re using the Moesif secure proxy, the base URL is http://localhost:9500/api
assuming it’s running on port 9500
. Do not include the /v1 path segment when using secure proxy.
Authentication
Your Management API token must be added to the request Authorization header using the following format:
curl -X POST -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' https://api.moesif.com/v1
You can generate a Management API Key from the bottom left menu by logging into Moesif and clicking on “API Keys” from the bottom left menu.
Scope | Scope Description |
---|---|
create:encrypted_keys | Create encrypted Keys for the Moesif secure proxy |
delete:dashboards | Delete existing dashboards |
update:dashboards | Update existing dashboards |
create:dashboards | Create a new team dashboard that can be shared |
read:public_workspaces | Read public workspaces/shared links |
read:virtual_eventtypes | Read existing virtual events/tags |
update:companies | Update existing companies and associated company metadata |
create:companies | Create new companies and associated company metadata |
create:reports | Create a new report such as SmartDiff |
delete:workspaces | Delete existing workspaces |
create:workspaces | Create a new workspace/chart that can be shared |
read:workspaces | Read existing workspaces |
update:virtual_eventtypes | Update existing virtual events/tags |
create:cohorts | Save new customer cohorts |
delete:encrypted_keys | Delete encrypted Keys for the Moesif secure proxy |
read:dashboards | Read existing dashboards |
read:events | Read/query events and associated event metadata |
create:events | Create new events and associated event metadata |
read:cohorts | Read previously saved customer cohorts |
read:encrypted_keys | Read encrypted Keys for the Moesif secure proxy |
update:apps | Update an existing application |
update:encrypted_keys | Update encrypted Keys for the Moesif secure proxy |
update:organizations | Update an existing application |
create:access_tokens | Create new tokens to access the Management API or Collector API |
create:users | Create new users and associated user metadata |
create:apps | Create a new application/project under the organization |
update:workspaces | Update existing workspaces |
delete:cohorts | Delete previously saved customer cohorts |
read:users | Read/query users and associated user metadata |
delete:virtual_eventtypes | Delete existing virtual events/tags |
read:reports | Read reports such as SmartDiff |
delete:reports | Delete existing reports such as SmartDiff |
update:users | Update existing users and associated user metadata |
update:cohorts | Update previously saved customer cohorts |
read:companies | Read/query companies and associated company metadata |
create:virtual_eventtypes | Create virtual events/tags |
delete:apps | Delete an existing application |
delete:companies | Delete existing companies and associated company metadata |
read:apps | Read the organization’s applications |
create:eth_abi | Create/upload new Ethereum ABI Entries |
delete:users | Delete existing users and associated user metadata |
Dashboards
Update a Dashboard
# You can also use wget
curl -X POST https://api.moesif.com/v1/~/dashboards/{dashId} \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/~/dashboards/{dashId}',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.moesif.com/v1/~/dashboards/{dashId}', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://api.moesif.com/v1/~/dashboards/{dashId}',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.moesif.com/v1/~/dashboards/{dashId}', 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());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/dashboards/{dashId}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/~/dashboards/{dashId}");
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/~/dashboards/{dashId}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
dashId | path | string | true | No description |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
201 | Created | success | None |
Delete a Dashboard
# You can also use wget
curl -X DELETE https://api.moesif.com/v1/~/dashboards/{dashId} \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/~/dashboards/{dashId}',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Authorization': 'Bearer {access-token}'
}
r = requests.delete('https://api.moesif.com/v1/~/dashboards/{dashId}', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.delete 'https://api.moesif.com/v1/~/dashboards/{dashId}',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Authorization' => 'Bearer {access-token}',
);
$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(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/dashboards/{dashId}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/~/dashboards/{dashId}");
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 https://api.moesif.com/v1/~/dashboards/{dashId}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
dashId | path | string | true | No description |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Delete a Dashboard
# You can also use wget
curl -X DELETE https://api.moesif.com/v1/~/dashboard/{dashId} \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/~/dashboard/{dashId}',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Authorization': 'Bearer {access-token}'
}
r = requests.delete('https://api.moesif.com/v1/~/dashboard/{dashId}', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.delete 'https://api.moesif.com/v1/~/dashboard/{dashId}',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('DELETE','https://api.moesif.com/v1/~/dashboard/{dashId}', 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());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Authorization": []string{"Bearer {access-token}"},
}
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)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/~/dashboard/{dashId}");
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 https://api.moesif.com/v1/~/dashboard/{dashId}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
dashId | path | string | true | No description |
parent_id | query | string | false | No description |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Add Dashboards ACL permission
# You can also use wget
curl -X POST https://api.moesif.com/v1/~/dashboards/{id}/policy/acl \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/~/dashboards/{id}/policy/acl',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.moesif.com/v1/~/dashboards/{id}/policy/acl', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://api.moesif.com/v1/~/dashboards/{id}/policy/acl',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.moesif.com/v1/~/dashboards/{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());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/dashboards/{id}/policy/acl", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/~/dashboards/{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 https://api.moesif.com/v1/~/dashboards/{id}/policy/acl
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
id | path | string | true | No description |
grantee | query | string | false | No description |
permission | query | string | false | No description |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Delete Dashboards ACL permission
# You can also use wget
curl -X DELETE https://api.moesif.com/v1/~/dashboards/{id}/policy/acl?grantee=string \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/~/dashboards/{id}/policy/acl?grantee=string',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Authorization': 'Bearer {access-token}'
}
r = requests.delete('https://api.moesif.com/v1/~/dashboards/{id}/policy/acl', params={
'grantee': 'string'
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.delete 'https://api.moesif.com/v1/~/dashboards/{id}/policy/acl',
params: {
'grantee' => 'string'
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Authorization' => 'Bearer {access-token}',
);
$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(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/dashboards/{id}/policy/acl", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/~/dashboards/{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 https://api.moesif.com/v1/~/dashboards/{id}/policy/acl
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
id | path | string | true | No description |
grantee | query | string | true | No description |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Partial Update Dashboards in Batch
# You can also use wget
curl -X POST https://api.moesif.com/v1/~/dashboard/batch \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/~/dashboard/batch',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.moesif.com/v1/~/dashboard/batch', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://api.moesif.com/v1/~/dashboard/batch',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.moesif.com/v1/~/dashboard/batch', 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());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/dashboard/batch", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/~/dashboard/batch");
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/~/dashboard/batch
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
201 | Created | success | None |
Copy Dashboard
# You can also use wget
curl -X POST https://api.moesif.com/v1/~/dashboard/{id}/copy \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/~/dashboard/{id}/copy',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.moesif.com/v1/~/dashboard/{id}/copy', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://api.moesif.com/v1/~/dashboard/{id}/copy',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.moesif.com/v1/~/dashboard/{id}/copy', 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());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/dashboard/{id}/copy", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/~/dashboard/{id}/copy");
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/~/dashboard/{id}/copy
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
id | path | string | true | No description |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
201 | Created | success | None |
Create New Dashboard
# You can also use wget
curl -X POST https://api.moesif.com/v1/~/dashboards \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/~/dashboards',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.moesif.com/v1/~/dashboards', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://api.moesif.com/v1/~/dashboards',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.moesif.com/v1/~/dashboards', 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());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/dashboards", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/~/dashboards");
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/~/dashboards
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
Example response
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
201 | Created | success | None |
Response Schema
Status Code 201
Name | Type | Required | Description |
---|
Get a Dashboard
# You can also use wget
curl -X GET https://api.moesif.com/v1/~/dashboards \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/~/dashboards',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://api.moesif.com/v1/~/dashboards', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://api.moesif.com/v1/~/dashboards',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.moesif.com/v1/~/dashboards', 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());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/dashboards", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/~/dashboards");
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 https://api.moesif.com/v1/~/dashboards
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Keystore
Create New Encrypted key/s
# You can also use wget
curl -X POST https://api.moesif.com/v1/v1/~/keystore \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/v1/~/keystore',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.moesif.com/v1/v1/~/keystore', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://api.moesif.com/v1/v1/~/keystore',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$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(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.moesif.com/v1/v1/~/keystore", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/v1/~/keystore");
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/v1/~/keystore
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
body | body | See Below | false | No description |
Example response
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
201 | Created | success | None |
Response Schema
Status Code 201
Name | Type | Required | Description |
---|
Get Encrypted keys
# You can also use wget
curl -X GET https://api.moesif.com/v1/v1/~/keystore \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/v1/~/keystore',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://api.moesif.com/v1/v1/~/keystore', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://api.moesif.com/v1/v1/~/keystore',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$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(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.moesif.com/v1/v1/~/keystore", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/v1/~/keystore");
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 https://api.moesif.com/v1/v1/~/keystore
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
from | query | string(date-time) | false | No description |
to | query | string(date-time) | false | No description |
type | undefined | See Below | false | No description |
Example response
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Response Schema
Status Code 200
Name | Type | Required | Description |
---|
Get Encrypted key
# You can also use wget
curl -X GET https://api.moesif.com/v1/v1/~/keystore/{keyId} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/v1/~/keystore/{keyId}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://api.moesif.com/v1/v1/~/keystore/{keyId}', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://api.moesif.com/v1/v1/~/keystore/{keyId}',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$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(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.moesif.com/v1/v1/~/keystore/{keyId}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/v1/~/keystore/{keyId}");
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 https://api.moesif.com/v1/v1/~/keystore/{keyId}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
keyId | path | string | true | No description |
Example response
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Response Schema
Status Code 200
Name | Type | Required | Description |
---|
Workspaces
Get new Workspace Token
# You can also use wget
curl -X GET https://api.moesif.com/v1/workspaces/access_token \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/workspaces/access_token',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://api.moesif.com/v1/workspaces/access_token', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://api.moesif.com/v1/workspaces/access_token',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$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(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.moesif.com/v1/workspaces/access_token", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/workspaces/access_token");
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 https://api.moesif.com/v1/workspaces/access_token
Get a new Workspace Access Token
Example response
200 undefined
{
"_id": "string",
"token": "string",
"url": "string"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | Signeken |
Response Schema
Status Code 200
Name | Type | Required | Description |
---|---|---|---|
» _id | string | true | No description |
» token | string | true | No description |
» url | string | false | No description |
Get Workspace Templates
# You can also use wget
curl -X GET https://api.moesif.com/v1/~/workspaces/templates \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/~/workspaces/templates',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://api.moesif.com/v1/~/workspaces/templates', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://api.moesif.com/v1/~/workspaces/templates',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$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(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/workspaces/templates", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/~/workspaces/templates");
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 https://api.moesif.com/v1/~/workspaces/templates
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
Example response
200 undefined
[]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | Inline |
Response Schema
Status Code 200
Name | Type | Required | Description |
---|
Update a Workspace
# You can also use wget
curl -X POST https://api.moesif.com/v1/~/workspaces/{id} \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/~/workspaces/{id}',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.moesif.com/v1/~/workspaces/{id}', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://api.moesif.com/v1/~/workspaces/{id}',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Authorization' => 'Bearer {access-token}',
);
$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(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/workspaces/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}");
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/~/workspaces/{id}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
id | path | string | true | No description |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Get a Workspace
# You can also use wget
curl -X GET https://api.moesif.com/v1/~/workspaces/{id} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/~/workspaces/{id}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://api.moesif.com/v1/~/workspaces/{id}', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://api.moesif.com/v1/~/workspaces/{id}',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$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(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/workspaces/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/~/workspaces/{id}");
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 https://api.moesif.com/v1/~/workspaces/{id}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
id | path | string | true | No description |
Example response
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Response Schema
Status Code 200
Name | Type | Required | Description |
---|
Delete a Workspace
# You can also use wget
curl -X DELETE https://api.moesif.com/v1/~/workspaces/{id} \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/~/workspaces/{id}',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Authorization': 'Bearer {access-token}'
}
r = requests.delete('https://api.moesif.com/v1/~/workspaces/{id}', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.delete 'https://api.moesif.com/v1/~/workspaces/{id}',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Authorization' => 'Bearer {access-token}',
);
$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());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Authorization": []string{"Bearer {access-token}"},
}
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)
// ...
}
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 https://api.moesif.com/v1/~/workspaces/{id}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
id | path | string | true | No description |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Get a Public Workspace
# You can also use wget
curl -X GET https://api.moesif.com/v1/workspaces/public/{id} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
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);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://api.moesif.com/v1/workspaces/public/{id}', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://api.moesif.com/v1/workspaces/public/{id}',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$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(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.moesif.com/v1/workspaces/public/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/workspaces/public/{id}");
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 https://api.moesif.com/v1/workspaces/public/{id}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
id | path | string | true | No description |
Example response
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Response Schema
Status Code 200
Name | Type | Required | Description |
---|
Add ACL permission
# You can also use wget
curl -X POST https://api.moesif.com/v1/~/workspaces/{id}/policy/acl \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Authorization':'Bearer {access-token}'
};
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);
});
import requests
headers = {
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.moesif.com/v1/~/workspaces/{id}/policy/acl', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://api.moesif.com/v1/~/workspaces/{id}/policy/acl',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Authorization' => 'Bearer {access-token}',
);
$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());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Authorization": []string{"Bearer {access-token}"},
}
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)
// ...
}
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 https://api.moesif.com/v1/~/workspaces/{id}/policy/acl
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
id | path | string | true | No description |
grantee | query | string | false | No description |
permission | query | string | false | No description |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Delete ACL permission
# You can also use wget
curl -X DELETE https://api.moesif.com/v1/~/workspaces/{id}/policy/acl?grantee=string \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Authorization':'Bearer {access-token}'
};
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);
});
import requests
headers = {
'Authorization': 'Bearer {access-token}'
}
r = requests.delete('https://api.moesif.com/v1/~/workspaces/{id}/policy/acl', params={
'grantee': 'string'
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.delete 'https://api.moesif.com/v1/~/workspaces/{id}/policy/acl',
params: {
'grantee' => 'string'
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Authorization' => 'Bearer {access-token}',
);
$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());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Authorization": []string{"Bearer {access-token}"},
}
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)
// ...
}
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 https://api.moesif.com/v1/~/workspaces/{id}/policy/acl
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
id | path | string | true | No description |
grantee | query | string | true | No description |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Create New Workspace
# You can also use wget
curl -X POST https://api.moesif.com/v1/~/workspaces \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/~/workspaces',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.moesif.com/v1/~/workspaces', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://api.moesif.com/v1/~/workspaces',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$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());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
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)
// ...
}
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 https://api.moesif.com/v1/~/workspaces
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
expiration | query | string(date-time) | false | No description |
Example response
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
201 | Created | success | None |
Response Schema
Status Code 201
Name | Type | Required | Description |
---|
Get Workspaces
# 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 {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
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);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://api.moesif.com/v1/~/workspaces', params={
'take': '0', 'access': [
"string"
]
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://api.moesif.com/v1/~/workspaces',
params: {
'take' => 'integer(int32)',
'access' => 'array[string]'
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$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());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
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)
// ...
}
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 https://api.moesif.com/v1/~/workspaces
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
take | query | integer(int32) | true | No description |
before_id | query | string | false | No description |
type | query | string | false | No description |
access | query | array[string] | true | No description |
Example response
200 undefined
[]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | Inline |
Response Schema
Status Code 200
Name | Type | Required | Description |
---|
Create a New Comment
# You can also use wget
curl -X POST https://api.moesif.com/v1/~/workspaces/{id}/comments \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Authorization':'Bearer {access-token}'
};
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);
});
import requests
headers = {
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.moesif.com/v1/~/workspaces/{id}/comments', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://api.moesif.com/v1/~/workspaces/{id}/comments',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Authorization' => 'Bearer {access-token}',
);
$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());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Authorization": []string{"Bearer {access-token}"},
}
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)
// ...
}
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 https://api.moesif.com/v1/~/workspaces/{id}/comments
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
id | path | string | true | No description |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
201 | Created | success | None |
Create New Workspace
# You can also use wget
curl -X POST https://api.moesif.com/v1/~/workspaces/default?app_id=string \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/~/workspaces/default?app_id=string',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.moesif.com/v1/~/workspaces/default', params={
'app_id': 'string'
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://api.moesif.com/v1/~/workspaces/default',
params: {
'app_id' => 'string'
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.moesif.com/v1/~/workspaces/default', 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());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/workspaces/default", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/~/workspaces/default?app_id=string");
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/~/workspaces/default
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | true | No description |
Example response
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
201 | Created | success | None |
Response Schema
Status Code 201
Name | Type | Required | Description |
---|
Cohorts
Update a Cohort
# You can also use wget
curl -X POST https://api.moesif.com/v1/~/cohorts/{cohortId} \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/~/cohorts/{cohortId}',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.moesif.com/v1/~/cohorts/{cohortId}', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://api.moesif.com/v1/~/cohorts/{cohortId}',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Authorization' => 'Bearer {access-token}',
);
$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());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Authorization": []string{"Bearer {access-token}"},
}
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)
// ...
}
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 https://api.moesif.com/v1/~/cohorts/{cohortId}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
cohortId | path | string | true | No description |
body | body | See Below | false | No description |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Delete Cohort
# You can also use wget
curl -X DELETE https://api.moesif.com/v1/~/cohorts/{cohortId} \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/~/cohorts/{cohortId}',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Authorization': 'Bearer {access-token}'
}
r = requests.delete('https://api.moesif.com/v1/~/cohorts/{cohortId}', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.delete 'https://api.moesif.com/v1/~/cohorts/{cohortId}',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Authorization' => 'Bearer {access-token}',
);
$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());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Authorization": []string{"Bearer {access-token}"},
}
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)
// ...
}
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 https://api.moesif.com/v1/~/cohorts/{cohortId}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
cohortId | path | string | true | No description |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Create New Cohort
# You can also use wget
curl -X POST https://api.moesif.com/v1/~/cohorts \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/~/cohorts',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.moesif.com/v1/~/cohorts', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://api.moesif.com/v1/~/cohorts',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.moesif.com/v1/~/cohorts', 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());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/cohorts", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/~/cohorts");
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/~/cohorts
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
body | body | See Below | false | No description |
Example response
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
201 | Created | success | None |
Response Schema
Status Code 201
Name | Type | Required | Description |
---|
Get Cohorts
# You can also use wget
curl -X GET https://api.moesif.com/v1/~/cohorts?cohort_type=string \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/~/cohorts?cohort_type=string',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://api.moesif.com/v1/~/cohorts', params={
'cohort_type': 'string'
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://api.moesif.com/v1/~/cohorts',
params: {
'cohort_type' => 'string'
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.moesif.com/v1/~/cohorts', 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());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/cohorts", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/~/cohorts?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 https://api.moesif.com/v1/~/cohorts
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
cohort_type | query | string | true | No description |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
OAuth
Get Token Info
# You can also use wget
curl -X GET https://api.moesif.com/v1/~/oauth/tokeninfo?scope=string \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/~/oauth/tokeninfo?scope=string',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://api.moesif.com/v1/~/oauth/tokeninfo', params={
'scope': 'string'
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://api.moesif.com/v1/~/oauth/tokeninfo',
params: {
'scope' => 'string'
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$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(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/oauth/tokeninfo", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/~/oauth/tokeninfo?scope=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 https://api.moesif.com/v1/~/oauth/tokeninfo
Get info for user’s token
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
scope | query | string | true | No description |
Example response
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Response Schema
Status Code 200
Name | Type | Required | Description |
---|
Get a new Access Token
# You can also use wget
curl -X GET https://api.moesif.com/v1/~/oauth/access_tokens?target=string&scope=string \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/~/oauth/access_tokens?target=string&scope=string',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://api.moesif.com/v1/~/oauth/access_tokens', params={
'target': 'string', 'scope': 'string'
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://api.moesif.com/v1/~/oauth/access_tokens',
params: {
'target' => 'string',
'scope' => 'string'
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$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(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/oauth/access_tokens", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/~/oauth/access_tokens?target=string&scope=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 https://api.moesif.com/v1/~/oauth/access_tokens
Get a new access_token using logged in user’s token
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
target | query | string | true | No description |
scope | query | string | true | No description |
expiration | query | string(date-time) | false | No description |
Example response
200 undefined
{
"app_token": "string"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | AccessToken |
Response Schema
Status Code 200
Name | Type | Required | Description |
---|---|---|---|
» app_token | string | true | No description |
URL Encoder
Encodes a URL
# You can also use wget
curl -X POST https://api.moesif.com/v1/url_encoder
const request = require('node-fetch');
fetch('https://api.moesif.com/v1/url_encoder',
{
method: 'POST'
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
r = requests.post('https://api.moesif.com/v1/url_encoder', params={
)
print r.json()
require 'rest-client'
require 'json'
result = RestClient.post 'https://api.moesif.com/v1/url_encoder',
params: {
}
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.moesif.com/v1/url_encoder', 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());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.moesif.com/v1/url_encoder", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/url_encoder");
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/url_encoder
Encodes the URL to be used with Moesif Collector/Proxy Server
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
body | body | Url | false | No description |
Example request
Request Schema
{
"url": "string"
}
Name | Type | Required | Description |
---|---|---|---|
» url | string | true | No description |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Applications
Create a new App
# You can also use wget
curl -X POST https://api.moesif.com/v1/~/apps \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/~/apps',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.moesif.com/v1/~/apps', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://api.moesif.com/v1/~/apps',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.moesif.com/v1/~/apps', 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());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/apps", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
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()));
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/~/apps
Create a new app under the selected organization
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
body | body | AppCreate | false | No description |
Example response
200 undefined
{
"name": "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 | success | AppResponse |
Response Schema
Status Code 200
Name | Type | Required | Description |
---|---|---|---|
» name | string | true | No description |
» search_api_base_url | string | false | No description |
» week_starts_on | integer(int32) | false | No description |
» id | string | false | No description |
» portal_api_base_url | string | false | No description |
» secure_proxy | boolean | false | No description |
» time_zone | string | false | No description |
Gets Apps
# You can also use wget
curl -X GET https://api.moesif.com/v1/~/apps?take=0 \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/~/apps?take=0',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://api.moesif.com/v1/~/apps', params={
'take': '0'
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://api.moesif.com/v1/~/apps',
params: {
'take' => 'integer(int32)'
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.moesif.com/v1/~/apps', 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());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.moesif.com/v1/~/apps", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/~/apps?take=0");
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 https://api.moesif.com/v1/~/apps
Gets a list of apps for the selected organization
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
take | query | integer(int32) | true | No description |
before_id | query | string | false | No description |
Example response
200 undefined
[
{
"name": "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 | success | Inline |
Response Schema
Status Code 200
Name | Type | Required | Description |
---|---|---|---|
» name | string | true | No description |
» search_api_base_url | string | false | No description |
» week_starts_on | integer(int32) | false | No description |
» id | string | false | No description |
» portal_api_base_url | string | false | No description |
» secure_proxy | boolean | false | No description |
» time_zone | string | false | No description |
Update Apps
# You can also use wget
curl -X POST https://api.moesif.com/v1/~/apps/{id} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/~/apps/{id}',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.moesif.com/v1/~/apps/{id}', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://api.moesif.com/v1/~/apps/{id}',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$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(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/apps/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/~/apps/{id}");
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/~/apps/{id}
Update the name of the app for the selected organization
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
id | path | string | true | No description |
Example response
200 undefined
{
"name": "string",
"search_api_base_url": "string",
"week_starts_on": 0,
"portal_api_base_url": "string",
"secure_proxy": true,
"time_zone": "string"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | AppUpdate |
Response Schema
Status Code 200
Name | Type | Required | Description |
---|---|---|---|
» name | string | false | No description |
» search_api_base_url | string | false | No description |
» week_starts_on | integer(int32) | false | No description |
» portal_api_base_url | string | false | No description |
» secure_proxy | boolean | false | No description |
» time_zone | string | false | No description |
Delete Apps
# You can also use wget
curl -X DELETE https://api.moesif.com/v1/~/apps/{id} \
-H 'Accept: 0' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'0',
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/~/apps/{id}',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': '0',
'Authorization': 'Bearer {access-token}'
}
r = requests.delete('https://api.moesif.com/v1/~/apps/{id}', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => '0',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.delete 'https://api.moesif.com/v1/~/apps/{id}',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => '0',
'Authorization' => 'Bearer {access-token}',
);
$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(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"0"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/~/apps/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/~/apps/{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 https://api.moesif.com/v1/~/apps/{id}
Delete the app for the selected organization
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
id | path | string | true | No description |
Example response
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Response Schema
Status Code 200
Name | Type | Required | Description |
---|
Health
Health Probe
# You can also use wget
curl -X GET https://api.moesif.com/v1/health/probe \
-H 'Accept: application/json'
const request = require('node-fetch');
const headers = {
'Accept':'application/json'
};
fetch('https://api.moesif.com/v1/health/probe',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('https://api.moesif.com/v1/health/probe', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'https://api.moesif.com/v1/health/probe',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.moesif.com/v1/health/probe', 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());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.moesif.com/v1/health/probe", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/health/probe");
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 https://api.moesif.com/v1/health/probe
Example response
200 undefined
{
"status": true,
"region": "string",
"health": "string"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | Status |
Response Schema
Status Code 200
Name | Type | Required | Description |
---|---|---|---|
» status | boolean | true | No description |
» region | string | true | No description |
» health | string | true | No description |
CompanyMetrics
Search CompanyMetrics/Companies
# You can also use wget
curl -X POST https://api.moesif.com/v1/search/~/search/companymetrics/companies \
-H 'Accept: 0' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'0',
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/search/~/search/companymetrics/companies',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': '0',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.moesif.com/v1/search/~/search/companymetrics/companies', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => '0',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://api.moesif.com/v1/search/~/search/companymetrics/companies',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => '0',
'Authorization' => 'Bearer {access-token}',
);
$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(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"0"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/search/companymetrics/companies", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
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
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
from | query | string(date-time) | false | The start date, which can be absolute such as 2022-09-06T00:00:00Z or relative such as -24h |
to | query | string(date-time) | false | The end date, which can be absolute such as 2022-03-02T00:00:00Z or relative such as now |
body | body | See Below | false | The search definition using the Elasticsearch Query DSL |
Example response
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Response Schema
Status Code 200
Name | Type | Required | Description |
---|
Search CompanyMetrics/Metrics
# You can also use wget
curl -X POST https://api.moesif.com/v1/search/~/search/companymetrics/metrics?from=2022-03-22T01:20:49Z&to=2022-03-22T01:20:49Z \
-H 'Accept: 0' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'0',
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/search/~/search/companymetrics/metrics?from=2022-03-22T01:20:49Z&to=2022-03-22T01:20:49Z',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': '0',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.moesif.com/v1/search/~/search/companymetrics/metrics', params={
'from': '2022-03-22T01:20:49Z', 'to': '2022-03-22T01:20:49Z'
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => '0',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://api.moesif.com/v1/search/~/search/companymetrics/metrics',
params: {
'from' => 'string(date-time)',
'to' => 'string(date-time)'
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => '0',
'Authorization' => 'Bearer {access-token}',
);
$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/metrics', 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());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"0"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/search/companymetrics/metrics", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/search/~/search/companymetrics/metrics?from=2022-03-22T01:20:49Z&to=2022-03-22T01:20:49Z");
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/metrics
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
from | query | string(date-time) | true | The start date, which can be absolute such as 2022-09-06T00:00:00Z or relative such as -24h |
to | query | string(date-time) | true | The end date, which can be absolute such as 2022-03-02T00:00:00Z or relative such as now |
body | body | See Below | false | The search definition using the Elasticsearch Query DSL |
Example response
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Response Schema
Status Code 200
Name | Type | Required | Description |
---|
UserMetrics
Search UserMetrics/Metrics
# You can also use wget
curl -X POST https://api.moesif.com/v1/search/~/search/usermetrics/metrics?from=2022-03-22T01:20:49Z&to=2022-03-22T01:20:49Z \
-H 'Accept: 0' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'0',
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/search/~/search/usermetrics/metrics?from=2022-03-22T01:20:49Z&to=2022-03-22T01:20:49Z',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': '0',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.moesif.com/v1/search/~/search/usermetrics/metrics', params={
'from': '2022-03-22T01:20:49Z', 'to': '2022-03-22T01:20:49Z'
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => '0',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://api.moesif.com/v1/search/~/search/usermetrics/metrics',
params: {
'from' => 'string(date-time)',
'to' => 'string(date-time)'
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => '0',
'Authorization' => 'Bearer {access-token}',
);
$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/metrics', 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());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"0"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/search/usermetrics/metrics", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/search/~/search/usermetrics/metrics?from=2022-03-22T01:20:49Z&to=2022-03-22T01:20:49Z");
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/metrics
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
from | query | string(date-time) | true | The start date, which can be absolute such as 2022-09-06T00:00:00Z or relative such as -24h |
to | query | string(date-time) | true | The end date, which can be absolute such as 2022-03-02T00:00:00Z or relative such as now |
body | body | See Below | false | The search definition using the Elasticsearch Query DSL |
Example response
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Response Schema
Status Code 200
Name | Type | Required | Description |
---|
Search UserMetrics/Users
# You can also use wget
curl -X POST https://api.moesif.com/v1/search/~/search/usermetrics/users \
-H 'Accept: 0' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'0',
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/search/~/search/usermetrics/users',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': '0',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.moesif.com/v1/search/~/search/usermetrics/users', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => '0',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://api.moesif.com/v1/search/~/search/usermetrics/users',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => '0',
'Authorization' => 'Bearer {access-token}',
);
$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(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"0"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/search/usermetrics/users", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
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
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
from | query | string(date-time) | false | The start date, which can be absolute such as 2022-09-06T00:00:00Z or relative such as -24h |
to | query | string(date-time) | false | The end date, which can be absolute such as 2022-03-02T00:00:00Z or relative such as now |
body | body | See Below | false | The search definition using the Elasticsearch Query DSL |
Example response
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Response Schema
Status Code 200
Name | Type | Required | Description |
---|
Properties
Get Property Mapping for CompanyMetrics
# You can also use wget
curl -X GET https://api.moesif.com/v1/search/~/mappings/companymetrics/properties?app_id=string \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/search/~/mappings/companymetrics/properties?app_id=string',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://api.moesif.com/v1/search/~/mappings/companymetrics/properties', params={
'app_id': 'string'
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://api.moesif.com/v1/search/~/mappings/companymetrics/properties',
params: {
'app_id' => 'string'
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$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(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.moesif.com/v1/search/~/mappings/companymetrics/properties", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/search/~/mappings/companymetrics/properties?app_id=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 https://api.moesif.com/v1/search/~/mappings/companymetrics/properties
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | true | No description |
from | query | string(date-time) | false | No description |
Example response
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Response Schema
Status Code 200
Name | Type | Required | Description |
---|
Companies
Get a Company
# You can also use wget
curl -X GET https://api.moesif.com/v1/search/~/companies/{id} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/search/~/companies/{id}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://api.moesif.com/v1/search/~/companies/{id}', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://api.moesif.com/v1/search/~/companies/{id}',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$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(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.moesif.com/v1/search/~/companies/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/search/~/companies/{id}");
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 https://api.moesif.com/v1/search/~/companies/{id}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
id | path | string | true | No description |
Example response
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Response Schema
Status Code 200
Name | Type | Required | Description |
---|
Delete a Company
# You can also use wget
curl -X DELETE https://api.moesif.com/v1/search/~/companies/{id} \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/search/~/companies/{id}',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Authorization': 'Bearer {access-token}'
}
r = requests.delete('https://api.moesif.com/v1/search/~/companies/{id}', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.delete 'https://api.moesif.com/v1/search/~/companies/{id}',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Authorization' => 'Bearer {access-token}',
);
$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(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("DELETE", "https://api.moesif.com/v1/search/~/companies/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/search/~/companies/{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 https://api.moesif.com/v1/search/~/companies/{id}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
id | path | string | true | No description |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Search Companies
# You can also use wget
curl -X POST https://api.moesif.com/v1/search/~/search/companies \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/search/~/search/companies',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.moesif.com/v1/search/~/search/companies', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://api.moesif.com/v1/search/~/search/companies',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.moesif.com/v1/search/~/search/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());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/search/companies", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/search/~/search/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/companies
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
body | body | See Below | false | The search definition using the Elasticsearch Query DSL |
Example response
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
201 | Created | success | None |
Response Schema
Status Code 201
Name | Type | Required | Description |
---|
Update a Company
# You can also use wget
curl -X POST https://api.moesif.com/v1/search/~/companies \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/search/~/companies',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.moesif.com/v1/search/~/companies', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://api.moesif.com/v1/search/~/companies',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$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(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/companies", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/search/~/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/~/companies
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
body | body | CompanyUpdate | false | No description |
Example response
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Response Schema
Status Code 200
Name | Type | Required | Description |
---|
Update Companies in Batch
# You can also use wget
curl -X POST https://api.moesif.com/v1/search/~/companies/batch \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/search/~/companies/batch',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.moesif.com/v1/search/~/companies/batch', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://api.moesif.com/v1/search/~/companies/batch',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$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(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/companies/batch", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/search/~/companies/batch");
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/~/companies/batch
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
body | body | array[object] | false | No description |
Example response
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Response Schema
Status Code 200
Name | Type | Required | Description |
---|
Count Companies
# You can also use wget
curl -X POST https://api.moesif.com/v1/search/~/count/companies?app_id=string \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/search/~/count/companies?app_id=string',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.moesif.com/v1/search/~/count/companies', params={
'app_id': 'string'
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://api.moesif.com/v1/search/~/count/companies',
params: {
'app_id' => 'string'
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$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(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/count/companies", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/search/~/count/companies?app_id=string");
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/~/count/companies
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | true | No description |
body | body | See Below | false | A query to restrict the results specified with the Elasticsearch Query DSL |
Example response
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | None |
Response Schema
Status Code 200
Name | Type | Required | Description |
---|
Events
Count Events
# You can also use wget
curl -X POST https://api.moesif.com/v1/search/~/count/events?from=2022-03-22T01:20:49Z&to=2022-03-22T01:20:49Z \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
const request = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://api.moesif.com/v1/search/~/count/events?from=2022-03-22T01:20:49Z&to=2022-03-22T01:20:49Z',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.moesif.com/v1/search/~/count/events', params={
'from': '2022-03-22T01:20:49Z', 'to': '2022-03-22T01:20:49Z'
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://api.moesif.com/v1/search/~/count/events',
params: {
'from' => 'string(date-time)',
'to' => 'string(date-time)'
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$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(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.moesif.com/v1/search/~/count/events", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
URL obj = new URL("https://api.moesif.com/v1/search/~/count/events?from=2022-03-22T01:20:49Z&to=2022-03-22T01:20:49Z");
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/~/count/events
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
orgId | path | string | true | No description |
app_id | query | string | false | No description |
from | query | string(date-time) | true | The start date, which can be absolute such as 2022-09-06T00:00:00Z or relative such as -24h |
to | query | string(da |