Title: | Functions to use Numetric's API |
---|---|
Description: | Functions for accessing and manipulating datasets and dashboards in Numetric. You need an API key and dataset Ids and dashboard Ids. |
Authors: | Ronald Guymon <[email protected]> |
Maintainer: | Ronald Guymon <[email protected]> |
License: | Numetric |
Version: | 0.1.0 |
Built: | 2025-01-01 02:49:00 UTC |
Source: | https://github.com/RonGuymon/numetricAPI |
Adds data to a new or existing dataset. If the primary key already exists in the indexed data, then the old data will be replaced with the new data.
If the primary key doesn't already exist in the dataset, then the new data will be added on to the existing data.
This function uses the V2 version of the API.
addRows(apiKey, datasetId, dataframeName, chunkSize = 1500, printSample = F, nullArrays = F)
addRows(apiKey, datasetId, dataframeName, chunkSize = 1500, printSample = F, nullArrays = F)
apiKey |
You can find the API key in the settings after logging into Numetric |
datasetId |
The dataset ID, in quotes. It can be found by using the getDatasets function, or by navigating to the dataset in Numetric, and selecting the string after the last forward slash. |
dataframeName |
The name of the dataframe, without quotes. |
chunkSize |
Defaults to 1,500 rows. |
printSample |
Defaults to False. If set to True, then it will return a sample of the data that is being indexed to verify that it's correctly being converted to JSON. |
nullArrays |
Defaults to False. Set to true if your data has arrays within a cell, and if some of those arrays have NULL values. |
Returns the status (e.g., 200, 401).
Adds data to a new or existing dataset. If the primary key already exists in the indexed data, then the old data will be replaced with the new data.
If the primary key doesn't already exist in the dataset, then the new data will be added on to the existing data.
This function uses the V3 version of the API.
addRowsV3(apiKey, datasetId, dataframeName, chunkSize = 1500, printSample = F, nullArrays = F)
addRowsV3(apiKey, datasetId, dataframeName, chunkSize = 1500, printSample = F, nullArrays = F)
apiKey |
You can find the API key in the settings after logging into Numetric |
datasetId |
The dataset ID, in quotes. It can be found by using the getDatasets function, or by navigating to the dataset in Numetric, and selecting the string after the last forward slash. |
dataframeName |
The name of the dataframe, without quotes. |
chunkSize |
Defaults to 1,500 rows. |
printSample |
Defaults to False. If set to True, then it will return a sample of the data that is being indexed to verify that it's correctly being converted to JSON. |
nullArrays |
Defaults to False. Set to true if your data has arrays within a cell, and if some of those arrays have NULL values. |
Returns the status (e.g., 200, 401).
Returns a dataframe with a list of bucket variable values, and the number of observations for each bucket.
This is especially useful when you have a dataset larger than 10,000 rows because it allows you to create a loop through the data getting only the data for each bucket.
This function uses the V2 version of the API.
bucketQuery(apiKey, datasetId, bucketVar, filterType = "none", filterField, filterValue, customFilterValue, must = "true", lowerBound, upperBound, childField, childOperation)
bucketQuery(apiKey, datasetId, bucketVar, filterType = "none", filterField, filterValue, customFilterValue, must = "true", lowerBound, upperBound, childField, childOperation)
apiKey |
The API key, in quotes. You can find the API key in the settings after logging into Numetric |
datasetId |
The dataset ID, in quotes. The dataset ID can be found by using the getDatasets function, or by navigating to the dataset in Numetric, and selecting the string after the last forward slash. |
bucketVar |
The name of the dataset column, in quotes, that will be used to bucket the data. |
filterType |
The type of filter to apply. Options are "term", "range", "custom", or "none". Default value is "none". |
filterField |
The name of the column, in quotes, to use as a filter. This should not used when the filterType is "custom". |
filterValue |
This is only used when applying a term filter. The value in quotes, is what will be included. (If the must argument is set to "false", then this will be an exclude filter.) This should not used when the filterType is "custom". |
customFilterValue |
This is used in conjunction with a custom filterType. The format should be: "filter": "term", "field": "fieldName", "value": "value" |
must |
Whether the term filter is an include or excludes filter. By default it's set to "true", which is an includes filter. If set to "false", then it will be an excludes term filter. |
lowerBound |
This lower end of the range, lower boundary included, which is only specified when applying a range filter. The value, in quotes, should either be a date string formatted as "2017-06-02T00:00:00.000", or a number. |
upperBound |
This upper end of the range, upper boundary included, which is only specified when applying a range filter. The value, in quotes, should either be a date string formatted as "2017-06-02T00:00:00.000", or a number. |
childField |
The name of a column, in quotes, that you want to perform an operation on. |
childOperation |
The name of an operation (avg, sum, cardinality), in quotes, to perform on a child. |
Returns a dataframe.
Creates a new dashboard in Numetric.
This function uses the V2 version of the API.
createDashboard(apiKey, name = "None", category = "None", content)
createDashboard(apiKey, name = "None", category = "None", content)
apiKey |
You can find the API key in the settings after logging into Numetric |
name |
The name of the dashboard, in quotes, in Numetric. Defaults to "None". |
content |
JSON formatted string of text. See https://nrl.readme.io/docs for more information. |
Create a new dataset in a Numetric Org.
This function uses the V2 version of the API.
createDataset(apiKey, numetricName, dataframeName, category = "New Data", primaryKey, autocompletes = "", geoshapes = "", geopoints = "", boolean = "", everyone = "false")
createDataset(apiKey, numetricName, dataframeName, category = "New Data", primaryKey, autocompletes = "", geoshapes = "", geopoints = "", boolean = "", everyone = "false")
apiKey |
You can find the API key in the settings after logging into Numetric |
numetricName |
The name, in quotes, given to the dataset in the Numetric Warehouse. |
dataframeName |
The name, without quotes, of the dataframe that will be used to create the dataset in Numetric. |
category |
The category, in quotes, given to the dataset in the Numetric Warehouse. |
autocompletes |
The column name, or vector of column names, in quotes, that will autocomplete in the Numetric quick search bar. |
geoshapes |
The column name, or vector of column names, in quotes, that will be stored as a geoShape (point on a map). This needs to be in the format, "lat,long". |
geopoints |
The column name, or vector of column names, in quotes, that will be stored as a geoPoint (for heatmaps). This needs to be in the format, "lat,long". |
boolean |
The column name, or vector of column names, in quotes, that will be stored as True/False. True = 1, False = 0. |
everyone |
Defaults to "false". If set to "true", then it will allow everyone in the org to see the dataset. |
id |
The name of the column, in quotes, that will be used as the primary key. Each row should have a unique id, otherwise, the last row indexed will be the one saved. |
Returns the dataset id as a string.
Create a new table in a Numetric Org.
This function uses the V3 version of the API.
createTable(apiKey, numetricName, dataframeName, category = "New Data", primaryKey, geoshapes = "", geopoints = "", boolean = "", everyone = "false")
createTable(apiKey, numetricName, dataframeName, category = "New Data", primaryKey, geoshapes = "", geopoints = "", boolean = "", everyone = "false")
apiKey |
You can find the API key in the settings after logging into Numetric |
numetricName |
The name, in quotes, given to the dataset in the Numetric Warehouse. |
dataframeName |
The name, without quotes, of the dataframe that will be used to create the dataset in Numetric. |
category |
The category, in quotes, given to the dataset in the Numetric Warehouse. |
primaryKey |
A vector with the column name(s), in quotes, that will be used as the primary key. Each row should have a unique id, otherwise, the last row indexed will be the one saved. |
geoshapes |
The column name, or vector of column names, in quotes, that will be stored as a geoShape (point on a map). This needs to be in the format, "lat,long". |
geopoints |
The column name, or vector of column names, in quotes, that will be stored as a geoPoint (for heatmaps). This needs to be in the format, "lat,long". |
boolean |
The column name, or vector of column names, in quotes, that will be stored as True/False. True = 1, False = 0. |
everyone |
Defaults to "false". If set to "true", then it will allow everyone in the org to see the dataset. |
Numetric Id
Clears out all the rows of a dataset, but preserves the id and url of the dataset (as opposed to the deleteDataset function).
This function uses the V2 version of the API.
deleteAllRows(apiKey, datasetId)
deleteAllRows(apiKey, datasetId)
apiKey |
You can find the API key in the settings after logging into Numetric |
datasetId |
The dataset ID, in quotes. You can find the dataset ID by either (1) using the getDatasets function, or (2) navigating to the dataset, and then selecting the string after the last forward slash. |
RDeletes all the rows in a table. This function uses the V3 version of the API.
deleteAllRowsV3(apiKey, tableId)
deleteAllRowsV3(apiKey, tableId)
apiKey |
You can find the API key in the settings after logging into Numetric |
tableId |
The id of the table. You can find this by using the getTables function, or by navigating to the table, and then selecting the string after the last forward slash of the url. |
Deletes a dashboard using the API.
This function uses the V2 version of the API.
deleteDashboard(apiKey, dashboardId)
deleteDashboard(apiKey, dashboardId)
apiKey |
You can find the API key in the settings after logging into Numetric |
dashboardId |
The dashboard ID, in quotes. You can find the dashboard ID by either (1) using the getDashboards function, or (2) navigating to the dashboard, and then selecting the string after the last forward slash. |
Deletes a dataset using the API.
This function uses the V2 version of the API.
deleteDataset(apiKey, datasetId)
deleteDataset(apiKey, datasetId)
apiKey |
You can find the API key in the settings after logging into Numetric |
datasetId |
The dataset ID, in quotes. You can find the dataset ID by either (1) using the getDatasets function, or (2) navigating to the dataset, and then selecting the string after the last forward slash. |
Deletes rows of a dataset based on a vector of primary keys.
This function uses the V2 version of the API.
deleteSomeRows(apiKey, datasetId, rows)
deleteSomeRows(apiKey, datasetId, rows)
apiKey |
You can find the API key in the settings after logging into Numetric |
datasetId |
The dataset ID, in quotes. You can find the dataset ID by either (1) using the getDatasets function, or (2) navigating to the dataset, and then selecting the string after the last forward slash. |
rows |
A vector of rows containing the primary keys of the rows to be deleted. |
Deletes a table using the API.
This function uses the V3 version of the API.
deleteTable(apiKey, tableId)
deleteTable(apiKey, tableId)
apiKey |
You can find the API key in the settings after logging into Numetric |
tableId |
The table ID, in quotes. You can find the table ID by either (1) using the getTables function, or (2) navigating to the table, and then selecting the string after the last forward slash. |
Returns a dataframe with up to 10,000 rows of a dataset.
This function uses the V2 version of the API.
getAllRows(apiKey, datasetId, size = 10000, includes, excludes)
getAllRows(apiKey, datasetId, size = 10000, includes, excludes)
apiKey |
The API key, in quotes. You can find the API key in the settings after logging into Numetric |
datasetId |
The dataset Id, in quotes. You can find the dataset Id by using the getDatasets function, or by navigating to the dataset. The string after the last forward slash in the url is the dataset Id. |
size |
The maximum number of rows of data to return. The default and maximum is 10,000. |
includes |
Optional. A vector of stings listing the column names that you want to INCLUDE. The default is to include all columns. |
excludes |
Optional. A vector of stings listing the column names that you want to EXCLUDE. The default is to exclude no columns. |
Returns a dataframe.
Returns every single row of a V3 table.
This function uses the V3 version of the API.
getAllRowsV3(apiKey, datasetId)
getAllRowsV3(apiKey, datasetId)
apiKey |
You can find the API key in the settings after logging into Numetric |
datasetId |
The id of the dataset. This can be found by navigating to the dataset in Numetric, and then referring to the string of characters after the last forward slash in the URL. |
Numetric Id
Returns the JSON for a Numetric Dashboard
This function uses the V2 version of the API.
getDashboard(apiKey, dashboardId)
getDashboard(apiKey, dashboardId)
apiKey |
You can find the API key in the settings after logging into Numetric |
dashboardId |
The dashboard ID, in quotes. You can find the dashboard ID by either (1) using the getDashboards function, or (2) navigating to the dashboard, and then selecting the string after the last forward slash. |
Returns a dataframe with meta-data about all of the dashboards in an org.
This function uses the V2 version of the API.
getDashboards(apiKey)
getDashboards(apiKey)
apiKey |
You can find the API key in the settings after logging into Numetric |
Returns a dataframe.
Returns a table with meta-data about all the tables. This function uses the V2 version of the API.
getDatasets(apiKey)
getDatasets(apiKey)
apiKey |
You can find the API key in the settings after logging into Numetric |
Find out if the index is complete. This function uses the V2 version of the API.
getDatasetStatus(apiKey, datasetId)
getDatasetStatus(apiKey, datasetId)
apiKey |
You can find the API key in the settings after logging into Numetric |
datasetId |
The dataset ID can be found by using the getDatasets function, or by navigating to the dataset in Numetric, and selecting the string after the last forward slash. |
Returns a dataframe.
Returns a dataframe with up to 10,000 rows of a dataset after applying a term or range filter.
This is especially useful when trying to download a dataset from Numetric that has more than 10,000 rows.
This function uses the V2 version of the API.
getFilteredRows(apiKey, datasetId, filterType = "term", filterField = "", filterValue = "", customFilterValue = "", startRange = "", endRange = "", size = 10000, includes = "", excludes = "")
getFilteredRows(apiKey, datasetId, filterType = "term", filterField = "", filterValue = "", customFilterValue = "", startRange = "", endRange = "", size = 10000, includes = "", excludes = "")
apiKey |
The API key, in quotes. You can find the API key in the settings after logging into Numetric |
filterType |
The type of filter to apply. Options are "term", "range", "custom", or "none". Default value is "none". |
filterField |
The name of the column, in quotes, to use as a filter. This should not used when the filterType is "custom". |
filterValue |
This is only used when applying a term filter. The value in quotes, is what will be included. (If the must argument is set to "false", then this will be an exclude filter.) This should not used when the filterType is "custom". |
customFilterValue |
This is used in conjunction with a custom filterType. The format should be: "filter": "term", "field": "fieldName", "value": "value" |
startRange |
If the filterType == range, then this is a minimum numeric value or date, in quotes. If it's a date, then it should be in the format of "2017-05-30T00.00.00.000". |
endRange |
If the filterType == range, then this is a maximum numeric value or date, in quotes. If it's a date, then it should be in the format of "2017-05-30T00.00.00.000". |
size |
The maximum number of rows of data to return. The default and maximum is 10,000. |
includes |
Optional. A vector of stings listing the column names that you want to INCLUDE. The default is to include all columns. |
excludes |
Optional. A vector of stings listing the column names that you want to EXCLUDE. The default is to exclude no columns. |
bucketVar |
The name of the dataset column, in quotes, that will be used to bucket the data. |
must |
Whether the term filter is an include or excludes filter. By default it's set to "true", which is an includes filter. If set to "false", then it will be an excludes term filter. |
Returns a dataframe.
Returns a one row dataframe with meta data about the table of interest. This function uses the V3 version of the API.
getTableDetails(apiKey, tableId, fieldNames = T)
getTableDetails(apiKey, tableId, fieldNames = T)
apiKey |
You can find the API key in the settings after logging into Numetric |
tableId |
The id of the table. You can find this by using the getTables function, or by navigating to the table, and then selecting the string after the last forward slash of the url. |
fieldNames |
By default it returns the display name, order, and type of all the fields. This can make the table very wide. If set to false, this field information will not be returned. |
Returns a table with meta-data about all the tables. This function uses the V3 version of the API.
getTables(apiKey)
getTables(apiKey)
apiKey |
You can find the API key in the settings after logging into Numetric |
Updates the name, category, and content of an existing Numetric dashboard.
This function uses the V2 version of the API.
updateDashboard(apiKey, dashboardId, name = "None", category = "None", content)
updateDashboard(apiKey, dashboardId, name = "None", category = "None", content)
apiKey |
You can find the API key in the settings after logging into Numetric |
dashboardId |
The id of the dashboard. This can be found by using the getDashboards function, or by navigating to the dashboard and then selecting the string after the last forward slash. |
name |
The name of the dashboard, in quotes, in Numetric. Defaults to "None". |
category |
The category, in quotes, of the dashboard. Defaults to "None". |
content |
JSON formatted string of text. See https://nrl.readme.io/docs for more information. |
Uupdate an existing dataset in a Numetric Org.
This is useful when you want to add new columns to a dataset. You can also use it change the name or category of a dataset.
This function uses the V2 version of the API.
updateDataset(apiKey, datasetId, numetricName, dataframeName, category = "New Data", autocompletes = "", geoshapes = "", geopoints = "", boolean = "")
updateDataset(apiKey, datasetId, numetricName, dataframeName, category = "New Data", autocompletes = "", geoshapes = "", geopoints = "", boolean = "")
apiKey |
You can find the API key in the settings after logging into Numetric |
datasetId |
The dataset ID, in quotes, to be updated. It can be found by using the getDatasets function, or by navigating to the dataset in Numetric, and selecting the string after the last forward slash. |
numetricName |
The name, in quotes, given to the dataset in the Numetric Warehouse. |
dataframeName |
The name, without quotes, of the dataframe that will be used to create the dataset in Numetric. |
category |
The category, in quotes, given to the dataset in the Numetric Warehouse. |
autocompletes |
The column name, or vector of column names, in quotes, that will autocomplete in the Numetric quick search bar. |
geoshapes |
The column name, or vector of column names, in quotes, that will be stored as a geoShape (point on a map). This needs to be in the format, "lat,long". |
geopoints |
The column name, or vector of column names, in quotes, that will be stored as a geoPoint (for heatmaps). This needs to be in the format, "lat,long". |
boolean |
The column name, or vector of column names, in quotes, that will be stored as True/False. True = 1, False = 0. |
id |
The name of the column, in quotes, that will be used as the primary key. Each row should have a unique id, otherwise, the last row indexed will be the one saved. |
Returns the status of the update.
Updates a table using a dataframe.
This function uses the V3 version of the API.
updateTable(apiKey, tableId, numetricName, dataframeName, category = "New Data", primaryKey, geoshapes = "", geopoints = "", boolean = "")
updateTable(apiKey, tableId, numetricName, dataframeName, category = "New Data", primaryKey, geoshapes = "", geopoints = "", boolean = "")
apiKey |
You can find the API key in the settings after logging into Numetric |
tableId |
The id, in quotes, of a table in the Data Warehouse. |
numetricName |
The name, in quotes, given to the dataset in the Numetric Warehouse. |
dataframeName |
The name, without quotes, of the dataframe that will be used to create the dataset in Numetric. |
category |
The category, in quotes, given to the dataset in the Numetric Warehouse. |
primaryKey |
The name of the column, in quotes, that will be used as the primary key. Each row should have a unique id, otherwise, the last row indexed will be the one saved. |
geoshapes |
The column name, or vector of column names, in quotes, that will be stored as a geoShape (point on a map). This needs to be in the format, "lat,long". |
geopoints |
The column name, or vector of column names, in quotes, that will be stored as a geoPoint (for heatmaps). This needs to be in the format, "lat,long". |
boolean |
The column name, or vector of column names, in quotes, that will be stored as True/False. True = 1, False = 0. |
Numetric Id