Skip to content

Latest commit

 

History

History
349 lines (225 loc) · 38.2 KB

README.md

File metadata and controls

349 lines (225 loc) · 38.2 KB

Collections

(collections)

Overview

Endpoints related to the Collections product

Available Operations

list

List Collections

Example Usage

from censys_platform import SDK


with SDK(
    personal_access_token="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:

    res = sdk.collections.list(organization_id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
organization_id Optional[str] The ID of a Censys organization to associate the request with. See the Getting Started docs for more information.
page_token Optional[str] page token for the requested page of collection results
page_size Optional[int] amount of results to return per page
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.V3CollectionsCrudListResponse

Errors

Error Type Status Code Content Type
models.ErrorModel 401, 403 application/problem+json
models.SDKError 4XX, 5XX */*

create

Create a Collection

Example Usage

from censys_platform import SDK


with SDK(
    personal_access_token="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:

    res = sdk.collections.create(organization_id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
organization_id Optional[str] The ID of a Censys organization to associate the request with. See the Getting Started docs for more information.
crud_create_input_body Optional[models.CrudCreateInputBody] N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.V3CollectionsCrudCreateResponse

Errors

Error Type Status Code Content Type
models.ErrorModel 401, 403 application/problem+json
models.SDKError 4XX, 5XX */*

delete

Delete a Collection

Example Usage

from censys_platform import SDK


with SDK(
    personal_access_token="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:

    res = sdk.collections.delete(collection_uid="<id>", organization_id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
collection_uid str ✔️ The UID for the collection
organization_id Optional[str] The ID of a Censys organization to associate the request with. See the Getting Started docs for more information.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.V3CollectionsCrudDeleteResponse

Errors

Error Type Status Code Content Type
models.ErrorModel 401, 403 application/problem+json
models.SDKError 4XX, 5XX */*

get

Get a Collection

Example Usage

from censys_platform import SDK


with SDK(
    personal_access_token="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:

    res = sdk.collections.get(collection_uid="<id>", organization_id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
collection_uid str ✔️ The UID for the collection
organization_id Optional[str] The ID of a Censys organization to associate the request with. See the Getting Started docs for more information.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.V3CollectionsCrudGetResponse

Errors

Error Type Status Code Content Type
models.ErrorModel 401, 403 application/problem+json
models.SDKError 4XX, 5XX */*

update

Update a Collection

Example Usage

from censys_platform import SDK


with SDK(
    personal_access_token="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:

    res = sdk.collections.update(collection_uid="<id>", organization_id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
collection_uid str ✔️ The UID for the collection
organization_id Optional[str] The ID of a Censys organization to associate the request with. See the Getting Started docs for more information.
crud_update_input_body Optional[models.CrudUpdateInputBody] N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.V3CollectionsCrudUpdateResponse

Errors

Error Type Status Code Content Type
models.ErrorModel 401, 403 application/problem+json
models.SDKError 4XX, 5XX */*

list_events

List a Collection's events

Example Usage

from censys_platform import SDK


with SDK(
    personal_access_token="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:

    res = sdk.collections.list_events(request={
        "organization_id": "<id>",
        "collection_uid": "<id>",
    })

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
request models.V3CollectionsListEventsRequest ✔️ The request object to use for the request.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.V3CollectionsListEventsResponse

Errors

Error Type Status Code Content Type
models.ErrorModel 401, 403 application/problem+json
models.SDKError 4XX, 5XX */*

aggregate

Run an aggregation via a Collection data set

Example Usage

from censys_platform import SDK


with SDK(
    personal_access_token="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:

    res = sdk.collections.aggregate(collection_uid="<id>", search_aggregate_input_body={
        "field": "<value>",
        "number_of_buckets": 590414,
        "query": "<value>",
    }, organization_id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
collection_uid str ✔️ The UID for the collection
search_aggregate_input_body models.SearchAggregateInputBody ✔️ N/A
organization_id Optional[str] The ID of a Censys organization to associate the request with. See the Getting Started docs for more information.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.V3CollectionsSearchAggregateResponse

Errors

Error Type Status Code Content Type
models.ErrorModel 401, 403 application/problem+json
models.SDKError 4XX, 5XX */*

search

Run a query via a Collection data set

Example Usage

from censys_platform import SDK


with SDK(
    personal_access_token="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:

    res = sdk.collections.search(collection_uid="<id>", search_query_input_body={
        "query": "<value>",
    }, organization_id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
collection_uid str ✔️ The UID for the collection
search_query_input_body models.SearchQueryInputBody ✔️ N/A
organization_id Optional[str] The ID of a Censys organization to associate the request with. See the Getting Started docs for more information.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.V3CollectionsSearchQueryResponse

Errors

Error Type Status Code Content Type
models.ErrorModel 401, 403 application/problem+json
models.SDKError 4XX, 5XX */*