Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Latest commit

 

History

History
222 lines (161 loc) · 12.4 KB

SearchApi.md

File metadata and controls

222 lines (161 loc) · 12.4 KB

JCAPIv1::SearchApi

All URIs are relative to https://console.jumpcloud.com/api

Method HTTP request Description
search_organizations_post POST /search/organizations Search Organizations
search_systems_post POST /search/systems Search Systems
search_systemusers_post POST /search/systemusers Search System Users

search_organizations_post

Organizationslist search_organizations_post(content_type, accept, opts)

Search Organizations

This endpoint will return Organization data based on your search parameters. This endpoint WILL NOT allow you to add a new Organization. You can use the supported parameters and pass those in the body of request. The parameters must be passed as Content-Type application/json. #### Sample Request curl -X POST https://console.jumpcloud.com/api/search/organizations \\ -H 'Accept: application/json' \\ -H 'Content-Type: application/json' \\ -H 'x-api-key: {API_KEY}' \\ -d '{ \"search\":{ \"fields\" : [\"settings.name\"], \"searchTerm\": \"Second\" }, \"fields\": [\"_id\", \"displayName\", \"logoUrl\"], \"limit\" : 0, \"skip\" : 0 }'

Example

# load the gem
require 'jcapiv1'
# setup authorization
JCAPIv1.configure do |config|
  # Configure API key authorization: x-api-key
  config.api_key['x-api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['x-api-key'] = 'Bearer'
end

api_instance = JCAPIv1::SearchApi.new

content_type = "application/json" # String | 

accept = "application/json" # String | 

opts = { 
  body: JCAPIv1::Search.new, # Search | 
  fields: "", # String | Use a space seperated string of field parameters to include the data in the response. If omitted, the default list of fields will be returned. 
  filter: "filter_example" # String | A filter to apply to the query.
  limit: 10, # Integer | The number of records to return at once. Limited to 100.
  skip: 0, # Integer | The offset into the records to return.
}

begin
  #Search Organizations
  result = api_instance.search_organizations_post(content_type, accept, opts)
  p result
rescue JCAPIv1::ApiError => e
  puts "Exception when calling SearchApi->search_organizations_post: #{e}"
end

Parameters

Name Type Description Notes
content_type String [default to application/json]
accept String [default to application/json]
body Search [optional]
fields String Use a space seperated string of field parameters to include the data in the response. If omitted, the default list of fields will be returned. [optional] [default to ]
filter String A filter to apply to the query. [optional]
limit Integer The number of records to return at once. Limited to 100. [optional] [default to 10]
skip Integer The offset into the records to return. [optional] [default to 0]

Return type

Organizationslist

Authorization

x-api-key

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

search_systems_post

Systemslist search_systems_post(content_type, accept, opts)

Search Systems

Return Systems in multi-record format allowing for the passing of the filter and searchFilter parameters. This WILL NOT allow you to add a new system. To support advanced filtering you can use the filter and searchFilter parameters that can only be passed in the body of POST /api/search/* routes. The filter and searchFilter parameters must be passed as Content-Type application/json. The filter parameter is an object with a single property, either and or or with the value of the property being an array of query expressions. This allows you to filter records using the logic of matching ALL or ANY records in the array of query expressions. If the and or or are not included the default behavior is to match ALL query expressions. The searchFilter parameter allows text searching on supported fields by specifying a searchTerm and a list of fields to query on. If any field has a partial text match on thesearchTerm the record will be returned. #### Sample Request Exact search for a list of hostnames curl -X POST https://console.jumpcloud.com/api/search/systems \\ -H 'Accept: application/json' \\ -H 'Content-Type: application/json' \\ -H 'x-api-key: {API_KEY}' \\ -d '{ \"filter\": { \"or\": [ {\"hostname\" : \"my-hostname\"}, {\"hostname\" : \"other-hostname\"} ] }, \"fields\" : \"os hostname displayName\" }' Text search for a hostname or display name curl -X POST https://console.jumpcloud.com/api/search/systems \\ -H 'Accept: application/json' \\ -H 'Content-Type: application/json' \\ -H 'x-api-key: {API_KEY}' \\ -d '{ \"searchFilter\": { \"searchTerm\": \"my-host\", \"fields\": [\"hostname\", \"displayName\"] }, \"fields\": \"os hostname displayName\" }' Combining filter and searchFilter to search for names that match a given OS curl -X POST https://console.jumpcloud.com/api/search/systems \\ -H 'Accept: application/json' \\ -H 'Content-Type: application/json' \\ -H 'x-api-key: {API_KEY}' \\ -d '{ \"searchFilter\": { \"searchTerm\": \"my-host\", \"fields\": [\"hostname\", \"displayName\"] }, \"filter\": { \"or\": [ {\"os\" : \"Ubuntu\"}, {\"os\" : \"Mac OS X\"} ] }, \"fields\": \"os hostname displayName\" }'

Example

# load the gem
require 'jcapiv1'
# setup authorization
JCAPIv1.configure do |config|
  # Configure API key authorization: x-api-key
  config.api_key['x-api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['x-api-key'] = 'Bearer'
end

api_instance = JCAPIv1::SearchApi.new

content_type = "application/json" # String | 

accept = "application/json" # String | 

opts = { 
  body: JCAPIv1::Search.new, # Search | 
  fields: "", # String | Use a space seperated string of field parameters to include the data in the response. If omitted, the default list of fields will be returned. 
  limit: 10, # Integer | The number of records to return at once. Limited to 100.
  x_org_id: "" # String | 
  skip: 0, # Integer | The offset into the records to return.
  filter: "filter_example" # String | A filter to apply to the query.
}

begin
  #Search Systems
  result = api_instance.search_systems_post(content_type, accept, opts)
  p result
rescue JCAPIv1::ApiError => e
  puts "Exception when calling SearchApi->search_systems_post: #{e}"
end

Parameters

Name Type Description Notes
content_type String [default to application/json]
accept String [default to application/json]
body Search [optional]
fields String Use a space seperated string of field parameters to include the data in the response. If omitted, the default list of fields will be returned. [optional] [default to ]
limit Integer The number of records to return at once. Limited to 100. [optional] [default to 10]
x_org_id String [optional] [default to ]
skip Integer The offset into the records to return. [optional] [default to 0]
filter String A filter to apply to the query. [optional]

Return type

Systemslist

Authorization

x-api-key

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

search_systemusers_post

Systemuserslist search_systemusers_post(content_type, accept, opts)

Search System Users

Return System Users in multi-record format allowing for the passing of the filter and searchFilter parameters. This WILL NOT allow you to add a new system user. To support advanced filtering you can use the filter and searchFilter parameters that can only be passed in the body of POST /api/search/* routes. The filter and searchFilter parameters must be passed as Content-Type application/json. The filter parameter is an object with a single property, either and or or with the value of the property being an array of query expressions. This allows you to filter records using the logic of matching ALL or ANY records in the array of query expressions. If the and or or are not included the default behavior is to match ALL query expressions. The searchFilter parameter allows text searching on supported fields by specifying a searchTerm and a list of fields to query on. If any field has a partial text match on thesearchTerm the record will be returned. #### Sample Request Exact search for a list of system users in a department curl -X POST https://console.jumpcloud.com/api/search/systemusers \\ -H 'Accept: application/json' \\ -H 'Content-Type: application/json' \\ -H 'x-api-key: {API_KEY}' \\ -d '{ \"filter\" : [{\"department\" : \"IT\"}], \"fields\" : \"email username sudo\" }' Text search for system users with and email on a domain curl -X POST https://console.jumpcloud.com/api/search/systemusers \\ -H 'Accept: application/json' \\ -H 'Content-Type: application/json' \\ -H 'x-api-key: {API_KEY}' \\ -d '{ \"searchFilter\" : { \"searchTerm\": \"@jumpcloud.com\", \"fields\": [\"email\"] }, \"fields\" : \"email username sudo\" }' Combining filter and searchFilter to text search for system users with and email on a domain who are in a list of departments curl -X POST https://console.jumpcloud.com/api/search/systemusers \\ -H 'Accept: application/json' \\ -H 'Content-Type: application/json' \\ -H 'x-api-key: {API_KEY}' \\ -d '{ \"searchFilter\": { \"searchTerm\": \"@jumpcloud.com\", \"fields\": [\"email\"] }, \"filter\": { \"or\": [ {\"department\" : \"IT\"}, {\"department\" : \"Sales\"} ] }, \"fields\" : \"email username sudo\" }'

Example

# load the gem
require 'jcapiv1'
# setup authorization
JCAPIv1.configure do |config|
  # Configure API key authorization: x-api-key
  config.api_key['x-api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['x-api-key'] = 'Bearer'
end

api_instance = JCAPIv1::SearchApi.new

content_type = "application/json" # String | 

accept = "application/json" # String | 

opts = { 
  body: JCAPIv1::Search.new, # Search | 
  fields: "", # String | Use a space seperated string of field parameters to include the data in the response. If omitted, the default list of fields will be returned. 
  filter: "filter_example" # String | A filter to apply to the query.
  limit: 10, # Integer | The number of records to return at once. Limited to 100.
  skip: 0, # Integer | The offset into the records to return.
  x_org_id: "" # String | 
}

begin
  #Search System Users
  result = api_instance.search_systemusers_post(content_type, accept, opts)
  p result
rescue JCAPIv1::ApiError => e
  puts "Exception when calling SearchApi->search_systemusers_post: #{e}"
end

Parameters

Name Type Description Notes
content_type String [default to application/json]
accept String [default to application/json]
body Search [optional]
fields String Use a space seperated string of field parameters to include the data in the response. If omitted, the default list of fields will be returned. [optional] [default to ]
filter String A filter to apply to the query. [optional]
limit Integer The number of records to return at once. Limited to 100. [optional] [default to 10]
skip Integer The offset into the records to return. [optional] [default to 0]
x_org_id String [optional] [default to ]

Return type

Systemuserslist

Authorization

x-api-key

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json