Skip to content

Latest commit

 

History

History
705 lines (549 loc) · 30.9 KB

ResourceApi.md

File metadata and controls

705 lines (549 loc) · 30.9 KB

waylay.services.resources.ResourceApi

All URIs are relative to https://api.waylay.io

Method HTTP request Description
create POST /resources/v1/resources Create Resource
delete DELETE /resources/v1/resources/{resourceId} Remove Resource
get GET /resources/v1/resources/{resourceId} Get Resource
list_changes GET /resources/v1/resources/{resourceId}/changes List Resource Changes
list_children GET /resources/v1/resources/{resourceId}/children List Resource Children
list_referrers GET /resources/v1/resources/{resourceId}/referrers List Referring Resources
list GET /resources/v1/resources Query Resources
patch PATCH /resources/v1/resources/{resourceId} Create Or Update Resource Partially
replace PUT /resources/v1/resources/{resourceId} Update Resource

create

create( headers ) -> ResourceCreationResponse

Create Resource

Creates a new Resource.

Example

from pprint import pprint

# Import the waylay-client from the waylay-sdk-core package
from waylay.sdk.client import WaylayClient
from waylay.sdk.api.api_exceptions import ApiError

# Intialize a waylay client instance
waylay_client = WaylayClient.from_profile()

# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-resources-types` is installed
from waylay.services.resources.models.resource_creation_response import ResourceCreationResponse
from waylay.services.resources.models.resource_entity import ResourceEntity
try:
    # Create Resource
    # calls `POST /resources/v1/resources`
    api_response = await waylay_client.resources.resource.create(
        # json data: use a generated model or a json-serializable python data structure (dict, list)
        json = waylay.services.resources.ResourceEntity() # ResourceEntity | 
    )
    print("The response of resources.resource.create:\n")
    pprint(api_response)
except ApiError as e:
    print("Exception when calling resources.resource.create: %s\n" % e)

Endpoint

POST /resources/v1/resources

Parameters

Name Type API binding Description Notes
json ResourceEntity json request body
headers HeaderTypes request headers

Return type

Selected path param Raw response param Return Type Description Links
Literal[""] (default) False (default) ResourceCreationResponse ResourceCreationResponse
str False (default) Any If any other string value for the selected path is provided, the exact type of the response will only be known at runtime.
/ True Response The raw http response object.

HTTP request headers

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

HTTP response details

Status code Description Response headers
201 Resource Created * Location - URI where the created Resource Constraint can be fetched
400 Validation Failure -
409 Resource Already Exists -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

delete

delete( resource_id: ResourceId, headers ) -> void (empty response body)

Remove Resource

Removes an existing Resource.

Example

from pprint import pprint

# Import the waylay-client from the waylay-sdk-core package
from waylay.sdk.client import WaylayClient
from waylay.sdk.api.api_exceptions import ApiError

# Intialize a waylay client instance
waylay_client = WaylayClient.from_profile()

# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-resources-types` is installed
try:
    # Remove Resource
    # calls `DELETE /resources/v1/resources/{resourceId}`
    await waylay_client.resources.resource.delete(
        waylay.services.resources.ResourceId(), # resource_id | path param "resourceId"
    )
except ApiError as e:
    print("Exception when calling resources.resource.delete: %s\n" % e)

Endpoint

DELETE /resources/v1/resources/{resourceId}

Parameters

Name Type API binding Description Notes
resource_id ResourceId path parameter "resourceId" Resource id
headers HeaderTypes request headers

Return type

Selected path param Raw response param Return Type Description Links
Literal[""] (default) False (default) void (empty response body)
str False (default) Any If any other string value for the selected path is provided, the exact type of the response will only be known at runtime.
/ True Response The raw http response object.

HTTP request headers

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

HTTP response details

Status code Description Response headers
204 Resource Removed -
400 Resource Still Referenced -
404 Resource Not Found -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get

get( resource_id: ResourceId, query: GetQuery, headers ) -> ResourceWithIdEntity

Get Resource

Retrieves a representation of the Resource.

Example

from pprint import pprint

# Import the waylay-client from the waylay-sdk-core package
from waylay.sdk.client import WaylayClient
from waylay.sdk.api.api_exceptions import ApiError

# Intialize a waylay client instance
waylay_client = WaylayClient.from_profile()

# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-resources-types` is installed
from waylay.services.resources.models.resource_with_id_entity import ResourceWithIdEntity
try:
    # Get Resource
    # calls `GET /resources/v1/resources/{resourceId}`
    api_response = await waylay_client.resources.resource.get(
        waylay.services.resources.ResourceId(), # resource_id | path param "resourceId"
        # query parameters:
        query = {
        },
    )
    print("The response of resources.resource.get:\n")
    pprint(api_response)
except ApiError as e:
    print("Exception when calling resources.resource.get: %s\n" % e)

Endpoint

GET /resources/v1/resources/{resourceId}

Parameters

Name Type API binding Description Notes
resource_id ResourceId path parameter "resourceId" Resource id
query QueryParamTypes | None URL query parameter
query['denormalized'] (dict)
query.denormalized (Query)
bool query parameter "denormalized" Unless explicitly set to `false`, attributes inherited from a linked Resource Type will be included in the representation. [optional] [default True]
query['field'] (dict)
query.var_field (Query)
List[str] query parameter "field" Select which attributes to render for each matching Resource (repeated). [optional]
query['fields'] (dict)
query.fields (Query)
List[str] query parameter "fields" Select which attributes to render for each matching Resource (comma-separated). [optional]
headers HeaderTypes request headers

Return type

Selected path param Raw response param Return Type Description Links
Literal[""] (default) False (default) ResourceWithIdEntity ResourceWithIdEntity
str False (default) Any If any other string value for the selected path is provided, the exact type of the response will only be known at runtime.
/ True Response The raw http response object.

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/hal+json

HTTP response details

Status code Description Response headers
200 Resource Fetched -
404 Resource Not Found -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list_changes

list_changes( resource_id: ResourceId, query: ListChangesQuery, headers ) -> List[ResourceChange]

List Resource Changes

Lists the change history of a Resource.

Example

from pprint import pprint

# Import the waylay-client from the waylay-sdk-core package
from waylay.sdk.client import WaylayClient
from waylay.sdk.api.api_exceptions import ApiError

# Intialize a waylay client instance
waylay_client = WaylayClient.from_profile()

# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-resources-types` is installed
from waylay.services.resources.models.resource_change import ResourceChange
try:
    # List Resource Changes
    # calls `GET /resources/v1/resources/{resourceId}/changes`
    api_response = await waylay_client.resources.resource.list_changes(
        waylay.services.resources.ResourceId(), # resource_id | path param "resourceId"
        # query parameters:
        query = {
        },
    )
    print("The response of resources.resource.list_changes:\n")
    pprint(api_response)
except ApiError as e:
    print("Exception when calling resources.resource.list_changes: %s\n" % e)

Endpoint

GET /resources/v1/resources/{resourceId}/changes

Parameters

Name Type API binding Description Notes
resource_id ResourceId path parameter "resourceId" Resource id
query QueryParamTypes | None URL query parameter
query['skip'] (dict)
query.skip (Query)
int query parameter "skip" (Paging) items to skip in the listing [optional] [default 0]
query['limit'] (dict)
query.limit (Query)
int query parameter "limit" (Paging) maximal number of items returned [optional] [default 100]
headers HeaderTypes request headers

Return type

Selected path param Raw response param Return Type Description Links
Literal[""] (default) False (default) List[ResourceChange] List[ResourceChange]
str False (default) Any If any other string value for the selected path is provided, the exact type of the response will only be known at runtime.
/ True Response The raw http response object.

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/vnd.waylay.paged+json

HTTP response details

Status code Description Response headers
200 Resource Changes * X-Count - Total number of resource constraints that fulfill the given criteria of which this is one page of results.
404 Resource Not Found -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list_children

list_children( resource_id: ResourceId, query: ListChildrenQuery, headers ) -> ResourceListing

List Resource Children

Lists the children of a Resource, these are the Resources that have the given Resource referenced with the parentId attribute.

Example

from pprint import pprint

# Import the waylay-client from the waylay-sdk-core package
from waylay.sdk.client import WaylayClient
from waylay.sdk.api.api_exceptions import ApiError

# Intialize a waylay client instance
waylay_client = WaylayClient.from_profile()

# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-resources-types` is installed
from waylay.services.resources.models.resource_listing import ResourceListing
try:
    # List Resource Children
    # calls `GET /resources/v1/resources/{resourceId}/children`
    api_response = await waylay_client.resources.resource.list_children(
        waylay.services.resources.ResourceId(), # resource_id | path param "resourceId"
        # query parameters:
        query = {
        },
    )
    print("The response of resources.resource.list_children:\n")
    pprint(api_response)
except ApiError as e:
    print("Exception when calling resources.resource.list_children: %s\n" % e)

Endpoint

GET /resources/v1/resources/{resourceId}/children

Parameters

Name Type API binding Description Notes
resource_id ResourceId path parameter "resourceId" Resource id
query QueryParamTypes | None URL query parameter
query['denormalized'] (dict)
query.denormalized (Query)
bool query parameter "denormalized" Unless explicitly set to `false`, attributes inherited from a linked Resource Type will be included in the representation. [optional] [default True]
query['field'] (dict)
query.var_field (Query)
List[str] query parameter "field" Select which attributes to render for each matching Resource (repeated). [optional]
query['fields'] (dict)
query.fields (Query)
List[str] query parameter "fields" Select which attributes to render for each matching Resource (comma-separated). [optional]
query['skip'] (dict)
query.skip (Query)
int query parameter "skip" (Paging) items to skip in the listing [optional] [default 0]
query['limit'] (dict)
query.limit (Query)
int query parameter "limit" (Paging) maximal number of items returned [optional] [default 100]
headers HeaderTypes request headers

Return type

Selected path param Raw response param Return Type Description Links
Literal[""] (default) False (default) ResourceListing ResourceListing
str False (default) Any If any other string value for the selected path is provided, the exact type of the response will only be known at runtime.
/ True Response The raw http response object.

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/hal+json

HTTP response details

Status code Description Response headers
200 Child Resources * X-Count - Total number of resource constraints that fulfill the given criteria of which this is one page of results.
404 Resource Not Found -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list_referrers

list_referrers( resource_id: ResourceId, query: ListReferrersQuery, headers ) -> ResourceListing

List Referring Resources

List the Resources that reference the given Resource. #### visibility This definition has visibility status beta.

Example

from pprint import pprint

# Import the waylay-client from the waylay-sdk-core package
from waylay.sdk.client import WaylayClient
from waylay.sdk.api.api_exceptions import ApiError

# Intialize a waylay client instance
waylay_client = WaylayClient.from_profile()

# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-resources-types` is installed
from waylay.services.resources.models.resource_listing import ResourceListing
try:
    # List Referring Resources
    # calls `GET /resources/v1/resources/{resourceId}/referrers`
    api_response = await waylay_client.resources.resource.list_referrers(
        waylay.services.resources.ResourceId(), # resource_id | path param "resourceId"
        # query parameters:
        query = {
        },
    )
    print("The response of resources.resource.list_referrers:\n")
    pprint(api_response)
except ApiError as e:
    print("Exception when calling resources.resource.list_referrers: %s\n" % e)

Endpoint

GET /resources/v1/resources/{resourceId}/referrers

Parameters

Name Type API binding Description Notes
resource_id ResourceId path parameter "resourceId" Resource id
query QueryParamTypes | None URL query parameter
query['field'] (dict)
query.var_field (Query)
List[str] query parameter "field" Select which attributes to render for each matching Resource (repeated). [optional]
query['fields'] (dict)
query.fields (Query)
List[str] query parameter "fields" Select which attributes to render for each matching Resource (comma-separated). [optional]
query['skip'] (dict)
query.skip (Query)
int query parameter "skip" (Paging) items to skip in the listing [optional] [default 0]
query['limit'] (dict)
query.limit (Query)
int query parameter "limit" (Paging) maximal number of items returned [optional] [default 100]
headers HeaderTypes request headers

Return type

Selected path param Raw response param Return Type Description Links
Literal[""] (default) False (default) ResourceListing ResourceListing
str False (default) Any If any other string value for the selected path is provided, the exact type of the response will only be known at runtime.
/ True Response The raw http response object.

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/hal+json

HTTP response details

Status code Description Response headers
200 Referring Resources * X-Count - Total number of resource constraints that fulfill the given criteria of which this is one page of results.
404 Resource Not Found -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list

list( query: ListQuery, headers ) -> ResourceListing

Query Resources

Lists Resources that satisfy the given filters.

Example

from pprint import pprint

# Import the waylay-client from the waylay-sdk-core package
from waylay.sdk.client import WaylayClient
from waylay.sdk.api.api_exceptions import ApiError

# Intialize a waylay client instance
waylay_client = WaylayClient.from_profile()

# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-resources-types` is installed
from waylay.services.resources.models.resource_id import ResourceId
from waylay.services.resources.models.resource_listing import ResourceListing
try:
    # Query Resources
    # calls `GET /resources/v1/resources`
    api_response = await waylay_client.resources.resource.list(
        # query parameters:
        query = {
            'tag': ['']
            'provider': 'provider_example'
            'customer': 'customer_example'
            'resourceTypeId': '17b8b6ea-0573-4381-8088-8692f7938165'
            'lat': 3.4
            'lon': 3.4
            'distance': 'distance_example'
            'toplevelOnly': true
        },
    )
    print("The response of resources.resource.list:\n")
    pprint(api_response)
except ApiError as e:
    print("Exception when calling resources.resource.list: %s\n" % e)

Endpoint

GET /resources/v1/resources

Parameters

Name Type API binding Description Notes
query QueryParamTypes | None URL query parameter
query['skip'] (dict)
query.skip (Query)
int query parameter "skip" (Paging) items to skip in the listing [optional] [default 0]
query['limit'] (dict)
query.limit (Query)
int query parameter "limit" (Paging) maximal number of items returned [optional] [default 100]
query['field'] (dict)
query.var_field (Query)
List[str] query parameter "field" Select which attributes to render for each matching Resource (repeated). [optional]
query['fields'] (dict)
query.fields (Query)
List[str] query parameter "fields" Select which attributes to render for each matching Resource (comma-separated). [optional]
query['filter'] (dict)
query.filter (Query)
str query parameter "filter" (Filter) fuzzy search on multiple fields. [optional]
query['query'] (dict)
query.query (Query)
str query parameter "query" Search string using a query language consisting of > `<metadata key>:<operation>(<arguments>)` Supported operations are - `eq`: equals - exact match - `in`: in - exact match - arguments are a (comma-separated) list of values - `lt`: smaller then - `lte`: smaller then or equal - `gt`: greater then - `gte`: greater then or equal - `ref`: references - argument should be uri /resources/<resourceId> - `exists`: check if the Resource has the specified metadata key - no argument allowed - `like`: wildcard search - argument should contain * and/or ? For more info see Waylay Docs [optional]
query['tag'] (dict)
query.tag (Query)
List[str] query parameter "tag" [optional]
query['id'] (dict)
query.id (Query)
List[ResourceId] query parameter "id" [optional]
query['provider'] (dict)
query.provider (Query)
str query parameter "provider" [optional]
query['customer'] (dict)
query.customer (Query)
str query parameter "customer" [optional]
query['resourceTypeId'] (dict)
query.resource_type_id (Query)
ResourceTypeId query parameter "resourceTypeId" [optional]
query['lat'] (dict)
query.lat (Query)
float query parameter "lat" [optional]
query['lon'] (dict)
query.lon (Query)
float query parameter "lon" [optional]
query['distance'] (dict)
query.distance (Query)
str query parameter "distance" [optional]
query['toplevelOnly'] (dict)
query.toplevel_only (Query)
bool query parameter "toplevelOnly" If true, search only for Resources without parent. [optional]
headers HeaderTypes request headers

Return type

Selected path param Raw response param Return Type Description Links
Literal[""] (default) False (default) ResourceListing ResourceListing
str False (default) Any If any other string value for the selected path is provided, the exact type of the response will only be known at runtime.
/ True Response The raw http response object.

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/hal+json, text/csv

HTTP response details

Status code Description Response headers
200 Resource Listing * X-Count - Total number of resource constraints that fulfill the given criteria of which this is one page of results.
400 Error Response -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

patch

patch( resource_id: ResourceId, headers ) -> ResourceWithIdEntity

Create Or Update Resource Partially

Updates some attributes of an existing Resource, or creates a new one. When updating an existing Resource you can remove keys by setting their value to null in the body

Example

from pprint import pprint

# Import the waylay-client from the waylay-sdk-core package
from waylay.sdk.client import WaylayClient
from waylay.sdk.api.api_exceptions import ApiError

# Intialize a waylay client instance
waylay_client = WaylayClient.from_profile()

# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-resources-types` is installed
from waylay.services.resources.models.patch_resource_entity import PatchResourceEntity
from waylay.services.resources.models.resource_with_id_entity import ResourceWithIdEntity
try:
    # Create Or Update Resource Partially
    # calls `PATCH /resources/v1/resources/{resourceId}`
    api_response = await waylay_client.resources.resource.patch(
        waylay.services.resources.ResourceId(), # resource_id | path param "resourceId"
        # json data: use a generated model or a json-serializable python data structure (dict, list)
        json = waylay.services.resources.PatchResourceEntity() # PatchResourceEntity | 
    )
    print("The response of resources.resource.patch:\n")
    pprint(api_response)
except ApiError as e:
    print("Exception when calling resources.resource.patch: %s\n" % e)

Endpoint

PATCH /resources/v1/resources/{resourceId}

Parameters

Name Type API binding Description Notes
resource_id ResourceId path parameter "resourceId" Resource id
json PatchResourceEntity json request body
headers HeaderTypes request headers

Return type

Selected path param Raw response param Return Type Description Links
Literal[""] (default) False (default) ResourceWithIdEntity ResourceWithIdEntity
str False (default) Any If any other string value for the selected path is provided, the exact type of the response will only be known at runtime.
/ True Response The raw http response object.

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json, application/hal+json

HTTP response details

Status code Description Response headers
200 Resource Created Or Updated -
400 Validation Failure -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

replace

replace( resource_id: ResourceId, headers ) -> ResourceWithIdEntity

Update Resource

Replaces a Resource with a new representation.

Example

from pprint import pprint

# Import the waylay-client from the waylay-sdk-core package
from waylay.sdk.client import WaylayClient
from waylay.sdk.api.api_exceptions import ApiError

# Intialize a waylay client instance
waylay_client = WaylayClient.from_profile()

# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-resources-types` is installed
from waylay.services.resources.models.resource_entity import ResourceEntity
from waylay.services.resources.models.resource_with_id_entity import ResourceWithIdEntity
try:
    # Update Resource
    # calls `PUT /resources/v1/resources/{resourceId}`
    api_response = await waylay_client.resources.resource.replace(
        waylay.services.resources.ResourceId(), # resource_id | path param "resourceId"
        # json data: use a generated model or a json-serializable python data structure (dict, list)
        json = waylay.services.resources.ResourceEntity() # ResourceEntity | 
    )
    print("The response of resources.resource.replace:\n")
    pprint(api_response)
except ApiError as e:
    print("Exception when calling resources.resource.replace: %s\n" % e)

Endpoint

PUT /resources/v1/resources/{resourceId}

Parameters

Name Type API binding Description Notes
resource_id ResourceId path parameter "resourceId" Resource id
json ResourceEntity json request body
headers HeaderTypes request headers

Return type

Selected path param Raw response param Return Type Description Links
Literal[""] (default) False (default) ResourceWithIdEntity ResourceWithIdEntity
str False (default) Any If any other string value for the selected path is provided, the exact type of the response will only be known at runtime.
/ True Response The raw http response object.

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json, application/hal+json

HTTP response details

Status code Description Response headers
200 Resource Replaced -
400 Validation Failure -

[Back to top] [Back to API list] [Back to Model list] [Back to README]