Skip to content

A Python-based NGSI-LD API client generated from its OpenAPI specification.

License

Notifications You must be signed in to change notification settings

giros-dit/python-ngsi-ld-client

Repository files navigation

ngsi-ld-client

This OAS file describes the NGSI-LD API defined by the ETSI ISG CIM group. This Cross-domain Context Information Management API allows to provide, consume and subscribe to context information in multiple scenarios and involving multiple stakeholders

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: latest
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.PythonExperimentalClientCodegen

Requirements.

Python >=3.9 v3.9 is needed so one can combine classmethod and property decorators to define object schema properties as classes

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

import ngsi_ld_client

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import ngsi_ld_client

Getting Started

Please follow the installation procedure and then run the following:

import time
import ngsi_ld_client
from pprint import pprint
from ngsi_ld_client.api import batch_operations_api
from ngsi_ld_client.model.batch_operation_result import BatchOperationResult
from ngsi_ld_client.model.entity_list import EntityList
from ngsi_ld_client.model.problem_details import ProblemDetails
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = ngsi_ld_client.Configuration(
    host = "http://localhost"
)


# Enter a context with an instance of the API client
with ngsi_ld_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = batch_operations_api.BatchOperationsApi(api_client)
    entity_list = EntityList([
        Entity(None)
    ]) # EntityList | 

    try:
        api_response = api_instance.batch_entity_creation(entity_list)
        pprint(api_response)
    except ngsi_ld_client.ApiException as e:
        print("Exception when calling BatchOperationsApi->batch_entity_creation: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to http://localhost

Class Method HTTP request Description
BatchOperationsApi batch_entity_creation POST /entityOperations/create
BatchOperationsApi batch_entity_delete POST /entityOperations/delete
BatchOperationsApi batch_entity_update POST /entityOperations/update
BatchOperationsApi batch_entity_upsert POST /entityOperations/upsert
CSourceRegistrationsApi query_csources GET /csourceRegistrations/
CSourceRegistrationsApi register_csource POST /csourceRegistrations/
CSourceRegistrationsApi remove_csource DELETE /csourceRegistrations/{registrationId}
CSourceRegistrationsApi retrieve_csource GET /csourceRegistrations/{registrationId}
CSourceSubscriptionsApi create_c_source_subscription POST /csourceSubscriptions/
CSourceSubscriptionsApi remove_c_source_subscription DELETE /csourceSubscriptions/{subscriptionId}
CSourceSubscriptionsApi retrieve_c_source_subscriptions GET /csourceSubscriptions/
CSourceSubscriptionsApi retrieve_c_source_subscriptions_by_id GET /csourceSubscriptions/{subscriptionId}
CSourceSubscriptionsApi update_c_source_subscription PATCH /csourceSubscriptions/{subscriptionId}
ContextInformationApi append_entity_attrs POST /entities/{entityId}/attrs/
ContextInformationApi create_entity POST /entities/
ContextInformationApi partial_attr_update PATCH /entities/{entityId}/attrs/{attrId}
ContextInformationApi query_entities GET /entities/
ContextInformationApi remove_entity_attr DELETE /entities/{entityId}/attrs/{attrId}
ContextInformationApi remove_entity_by_id DELETE /entities/{entityId}
ContextInformationApi retrieve_entity_by_id GET /entities/{entityId}
ContextInformationApi update_entity_attrs PATCH /entities/{entityId}/attrs/
ContextSourcesApi create_c_source_subscription POST /csourceSubscriptions/
ContextSourcesApi query_csources GET /csourceRegistrations/
ContextSourcesApi register_csource POST /csourceRegistrations/
ContextSourcesApi remove_c_source_subscription DELETE /csourceSubscriptions/{subscriptionId}
ContextSourcesApi remove_csource DELETE /csourceRegistrations/{registrationId}
ContextSourcesApi retrieve_c_source_subscriptions GET /csourceSubscriptions/
ContextSourcesApi retrieve_c_source_subscriptions_by_id GET /csourceSubscriptions/{subscriptionId}
ContextSourcesApi retrieve_csource GET /csourceRegistrations/{registrationId}
ContextSourcesApi update_c_source_subscription PATCH /csourceSubscriptions/{subscriptionId}
ContextSubscriptionApi create_subscription POST /subscriptions/
ContextSubscriptionApi remove_subscription DELETE /subscriptions/{subscriptionId}
ContextSubscriptionApi retrieve_subscription_by_id GET /subscriptions/{subscriptionId}
ContextSubscriptionApi retrieve_subscriptions GET /subscriptions/
ContextSubscriptionApi update_subscription PATCH /subscriptions/{subscriptionId}
EntitiesApi append_entity_attrs POST /entities/{entityId}/attrs/
EntitiesApi batch_entity_creation POST /entityOperations/create
EntitiesApi batch_entity_delete POST /entityOperations/delete
EntitiesApi batch_entity_update POST /entityOperations/update
EntitiesApi batch_entity_upsert POST /entityOperations/upsert
EntitiesApi create_entity POST /entities/
EntitiesApi partial_attr_update PATCH /entities/{entityId}/attrs/{attrId}
EntitiesApi query_entities GET /entities/
EntitiesApi remove_entity_attr DELETE /entities/{entityId}/attrs/{attrId}
EntitiesApi remove_entity_by_id DELETE /entities/{entityId}
EntitiesApi retrieve_entity_by_id GET /entities/{entityId}
EntitiesApi update_entity_attrs PATCH /entities/{entityId}/attrs/
SubscriptionsApi create_subscription POST /subscriptions/
SubscriptionsApi remove_subscription DELETE /subscriptions/{subscriptionId}
SubscriptionsApi retrieve_subscription_by_id GET /subscriptions/{subscriptionId}
SubscriptionsApi retrieve_subscriptions GET /subscriptions/
SubscriptionsApi update_subscription PATCH /subscriptions/{subscriptionId}
TemporalApi add_temporal_entity_attrs POST /temporal/entities/{entityId}/attrs/
TemporalApi create_update_entity_temporal POST /temporal/entities/
TemporalApi modify_entity_temporal_attr_instance PATCH /temporal/entities/{entityId}/attrs/{attrId}/{instanceId}
TemporalApi query_temporal_entities GET /temporal/entities/
TemporalApi remove_entity_temporal_attr DELETE /temporal/entities/{entityId}/attrs/{attrId}
TemporalApi remove_entity_temporal_attr_instance DELETE /temporal/entities/{entityId}/attrs/{attrId}/{instanceId}
TemporalApi remove_entity_temporal_by_id DELETE /temporal/entities/{entityId}
TemporalApi retrieve_entity_temporal_by_id GET /temporal/entities/{entityId}
TemporalEvolutionApi add_temporal_entity_attrs POST /temporal/entities/{entityId}/attrs/
TemporalEvolutionApi create_update_entity_temporal POST /temporal/entities/
TemporalEvolutionApi modify_entity_temporal_attr_instance PATCH /temporal/entities/{entityId}/attrs/{attrId}/{instanceId}
TemporalEvolutionApi query_temporal_entities GET /temporal/entities/
TemporalEvolutionApi remove_entity_temporal_attr DELETE /temporal/entities/{entityId}/attrs/{attrId}
TemporalEvolutionApi remove_entity_temporal_attr_instance DELETE /temporal/entities/{entityId}/attrs/{attrId}/{instanceId}
TemporalEvolutionApi remove_entity_temporal_by_id DELETE /temporal/entities/{entityId}
TemporalEvolutionApi retrieve_entity_temporal_by_id GET /temporal/entities/{entityId}

Documentation For Models

Documentation For Authorization

All endpoints do not require authorization.

Author

NGSI-LD@etsi.org NGSI-LD@etsi.org NGSI-LD@etsi.org NGSI-LD@etsi.org NGSI-LD@etsi.org NGSI-LD@etsi.org NGSI-LD@etsi.org NGSI-LD@etsi.org NGSI-LD@etsi.org NGSI-LD@etsi.org

Notes for Large OpenAPI documents

If the OpenAPI document is large, imports in ngsi_ld_client.apis and ngsi_ld_client.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:

Solution 1: Use specific imports for apis and models like:

  • from ngsi_ld_client.api.default_api import DefaultApi
  • from ngsi_ld_client.model.pet import Pet

Solution 1: Before importing the package, adjust the maximum recursion limit as shown below:

import sys
sys.setrecursionlimit(1500)
import ngsi_ld_client
from ngsi_ld_client.apis import *
from ngsi_ld_client.models import *

About

A Python-based NGSI-LD API client generated from its OpenAPI specification.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages