Skip to content

besterjaco/sigfoxapi

Repository files navigation

sigfox-api-client

API overview Sigfox API is used to integrate with the Sigfox platform. The API uses the HTTP protocol, following the REST principles (POST, GET, DELETE, PUT requests). The API endpoints accept and return data in the JSON format, with the corresponding "application/json" content type header. The Sigfox API access differs for every API User based on their profile. If you already have a Sigfox account, you can retrieve the API Documentation customized for your API User directly in json or yaml format. The “how to” procedure is detailed in the API Documentation article. The PUT request is the only request used to edit an existing entity. You don't need to specify each value. If a property is not present in the request, it won't be processed and updated. To remove an optional property, it must be filled in the request with the explicit value NULL. If a property has no value, it won't appear in the result of a GET request. # Authentication and security Sigfox API is only accessible using HTTPS, and all API endpoints require authentication credentials (API user login and password). An API User is associated to a group with given profiles. You can view and manage your API User in the Sigfox Portal. If you need an API User, follow the API credential creation procedure. Your API User must remain private. Should the API credentials be compromised, new ones can be generated at any moment, invalidating the previous ones. CORS and JSONP are intentionally unsupported. CORS and JSONP JavaScript techniques tends to expose your credentials to your users. If you really need to call Sigfox API from JavaScript in the browser, you must set a reverse proxy on your website. Be careful not to use proxy for all requests to Sigfox OSS but to only select the relevant ones. # Usage limits All Sigfox API endpoints are using the same underlying technology that powers the core Sigfox Platform. For Cloud efficiency and security reasons, Sigfox is moving a step forward on API rate limiting, by setting upper bounds for some API endpoints. Please note that a new HTTP response will be returned in case of rate exceeded : “HTTP 429: too many requests”. For more information check API Rate limiting policy. Sigfox reserves the right to modify these limits without notice. # Versioning Sigfox API supports versioning of its endpoints through a version suffix in the endpoint URL. This suffix has the following format: "vX", where X is the version number. For example: v2/device. All requests must include the version suffix in the endpoint URL. Any new backwards-incompatible change will be released in a new version. Read the API versioning management to learn more about it. # Paging Some API requests will return a list of data. If the list is longer than the set limit, the items will be retrieved via multiple requests. The paging section in the response will specify a URL for the next request. Keep in mind rate limiting policy to manage your requests. You can use the limit parameter to limit the number of items to be returned, between 1 and 100 (default). The offset parameter is used to specify a number of items to skip. # Errors Sigfox API uses conventional HTTP response codes to indicate the success or failure of an API request. Codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (e.g. a required parameter missing, a resource was not found, etc.). Often the response will also include a message explaining the error. Codes in the 5xx range indicate an error with servers. For more information please refer to the Response code article.

This Python package is automatically generated by the Swagger Codegen project:

  • API version: 2.0
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegen For more information, please visit https://support.sigfox.com

Requirements.

Python 2.7 and 3.4+

Installation & Usage

pip install

If the python package is hosted on Github, you can install directly from Github

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 sigfox_api_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 sigfox_api_client

Getting Started

Please follow the installation procedure and then run the following:

from __future__ import print_function
import time
import sigfox_api_client
from sigfox_api_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basicAuth
configuration = sigfox_api_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = sigfox_api_client.ApiUsersApi(sigfox_api_client.ApiClient(configuration))
body = sigfox_api_client.ProfileIds() # ProfileIds | The API profile to update
id = 'id_example' # str | The API user identifier

try:
    # Associate profiles to an API user.
    api_instance.add_profile_to_api_user(body, id)
except ApiException as e:
    print("Exception when calling ApiUsersApi->add_profile_to_api_user: %s\n" % e)
# Configure HTTP basic authorization: basicAuth
configuration = sigfox_api_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = sigfox_api_client.ApiUsersApi(sigfox_api_client.ApiClient(configuration))
body = sigfox_api_client.ApiUserCreation() # ApiUserCreation | 

try:
    # Create an API user
    api_response = api_instance.create_api_user(body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiUsersApi->create_api_user: %s\n" % e)
# Configure HTTP basic authorization: basicAuth
configuration = sigfox_api_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = sigfox_api_client.ApiUsersApi(sigfox_api_client.ApiClient(configuration))
id = 'id_example' # str | The API user identifier

try:
    # Delete an API user
    api_instance.delete_api_user(id)
except ApiException as e:
    print("Exception when calling ApiUsersApi->delete_api_user: %s\n" % e)
# Configure HTTP basic authorization: basicAuth
configuration = sigfox_api_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = sigfox_api_client.ApiUsersApi(sigfox_api_client.ApiClient(configuration))
id = 'id_example' # str | The API user identifier
profile_id = 'profile_id_example' # str | The profile identifier

try:
    # Delete a profile to a given API user.
    api_instance.delete_profile_of_api_user(id, profile_id)
except ApiException as e:
    print("Exception when calling ApiUsersApi->delete_profile_of_api_user: %s\n" % e)
# Configure HTTP basic authorization: basicAuth
configuration = sigfox_api_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = sigfox_api_client.ApiUsersApi(sigfox_api_client.ApiClient(configuration))
id = 'id_example' # str | The API user identifier
fields = 'fields_example' # str | Defines the other available fields to be returned in the response.  (optional)

try:
    # Retrieve information about an API user
    api_response = api_instance.get_api_user(id, fields=fields)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiUsersApi->get_api_user: %s\n" % e)
# Configure HTTP basic authorization: basicAuth
configuration = sigfox_api_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = sigfox_api_client.ApiUsersApi(sigfox_api_client.ApiClient(configuration))
fields = 'fields_example' # str | Defines the other available fields to be returned in the response.  (optional)
profile_id = 'profile_id_example' # str | Searches for API users with the given profile (optional)
group_ids = ['group_ids_example'] # list[str] | Searches for API users who are attached to the given groups (optional)
limit = 56 # int | Defines the maximum number of items to return (optional)
offset = 56 # int | Defines the number of items to skip (optional)

try:
    # Retrieve a list of API users
    api_response = api_instance.list_api_users(fields=fields, profile_id=profile_id, group_ids=group_ids, limit=limit, offset=offset)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiUsersApi->list_api_users: %s\n" % e)
# Configure HTTP basic authorization: basicAuth
configuration = sigfox_api_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = sigfox_api_client.ApiUsersApi(sigfox_api_client.ApiClient(configuration))
id = 'id_example' # str | The API user identifier

try:
    # Generate a new password for an API user
    api_response = api_instance.renew_credential(id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ApiUsersApi->renew_credential: %s\n" % e)
# Configure HTTP basic authorization: basicAuth
configuration = sigfox_api_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = sigfox_api_client.ApiUsersApi(sigfox_api_client.ApiClient(configuration))
body = sigfox_api_client.ApiUserEdition() # ApiUserEdition | The information to update
id = 'id_example' # str | The API user identifier

try:
    # Update an API user
    api_instance.update_api_user(body, id)
except ApiException as e:
    print("Exception when calling ApiUsersApi->update_api_user: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://api.sigfox.com/v2

Class Method HTTP request Description
ApiUsersApi add_profile_to_api_user PUT /api-users/{id}/profiles Associate profiles to an API user.
ApiUsersApi create_api_user POST /api-users/ Create an API user
ApiUsersApi delete_api_user DELETE /api-users/{id} Delete an API user
ApiUsersApi delete_profile_of_api_user DELETE /api-users/{id}/profiles/{profileId} Delete a profile to a given API user.
ApiUsersApi get_api_user GET /api-users/{id} Retrieve information about an API user
ApiUsersApi list_api_users GET /api-users/ Retrieve a list of API users
ApiUsersApi renew_credential PUT /api-users/{id}/renew-credential Generate a new password for an API user
ApiUsersApi update_api_user PUT /api-users/{id} Update an API user
ContractInfosApi contract_bulk_restart POST /contract-infos/{id}/bulk/restart Create a job to restart the devices associated to a contract
ContractInfosApi device_list GET /contract-infos/{id}/devices Retrieve the list of devices having a token on the specified contract
ContractInfosApi get_contract_bulk_restart_job GET /contract-infos/bulk/restart/{jobId} Retrieve a contract async job status for restart action
ContractInfosApi get_contract_info GET /contract-infos/{id} Retrieve information about a contract
ContractInfosApi list_contract_infos GET /contract-infos/ Retrieve a list of contracts
CoveragesApi coverages_global_predictions_get GET /coverages/global/predictions Retrieve coverage predictions for any location.
CoveragesApi coverages_global_predictions_post POST /coverages/global/predictions Retrieve coverage predictions for any batch of locations
CoveragesApi coverages_operators_redundancy_get GET /coverages/operators/redundancy Retrieve coverage redundancy for an operator.
DeviceTypesApi create_callback POST /device-types/{id}/callbacks Create a callback
DeviceTypesApi create_device_type POST /device-types/ Create a device type
DeviceTypesApi delete_callback DELETE /device-types/{id}/callbacks/{callbackId} Delete a callback
DeviceTypesApi device_type_bulk_restart POST /device-types/{id}/bulk/restart Restart the devices of a device type
DeviceTypesApi device_types_delete DELETE /device-types/{id} Delete a device type
DeviceTypesApi device_types_seq_number_disengage PUT /device-types/{id}/disengage Disengage sequence number check for the next message
DeviceTypesApi enable_callback PUT /device-types/{id}/callbacks/{callbackId}/enable Enable or disable a callback
DeviceTypesApi enable_downlink_callback PUT /device-types/{id}/callbacks/{callbackId}/downlink Selects a downlink callback
DeviceTypesApi get_callback_messages_error_list_for_device_type GET /device-types/{id}/callbacks-not-delivered Retrieve a list of callback errors
DeviceTypesApi get_device_messages_list_for_device_type GET /device-types/{id}/messages Retrieve a list of messages
DeviceTypesApi get_device_type GET /device-types/{id} Retrieve information about a device type
DeviceTypesApi get_device_type_bulk_restart_job GET /device-types/bulk/restart/{jobId} Retrieve the device type async job status for restart action
DeviceTypesApi list_callbacks GET /device-types/{id}/callbacks Retrieve a list of callbacks
DeviceTypesApi list_device_types GET /device-types/ Retrieve a list of device types
DeviceTypesApi update_callback PUT /device-types/{id}/callbacks/{callbackId} Update a callback
DeviceTypesApi update_device_type PUT /device-types/{id} Update a device type
DevicesApi create_bulk_device POST /devices/bulk Create multiple devices
DevicesApi create_device POST /devices/ Create a device
DevicesApi delete_device DELETE /devices/{id} Delete a device
DevicesApi device_bulk_edit_async PUT /devices/bulk Update multiple devices
DevicesApi device_bulk_transfer POST /devices/bulk/transfer Transfer multiple devices to another device type
DevicesApi device_bulk_unsubscribe POST /devices/bulk/unsubscribe Unsubscribe multiple devices
DevicesApi device_seq_number_disengage POST /devices/{id}/disengage Disengage sequence number check for the next message
DevicesApi devices_bulk_replace POST /devices/bulk/replace Replace multiple devices
DevicesApi devices_bulk_restart POST /devices/bulk/restart Restart multiple devices
DevicesApi devices_bulk_resume POST /devices/bulk/resume Resume multiple devices
DevicesApi devices_bulk_suspend POST /devices/bulk/suspend Suspend multiple devices
DevicesApi devices_id_consumption_year_get GET /devices/{id}/consumption/{year} Retrieve a device's consumption for a year
DevicesApi devices_id_consumption_year_month_get GET /devices/{id}/consumption/{year}/{month} Get a Device's consumption for a given month
DevicesApi devices_id_messages_metric_get GET /devices/{id}/messages/metric Retreive the number of messages
DevicesApi get_bulk_job_for_device GET /devices/bulk/{jobId} Retrieve the status of a job
DevicesApi get_bulk_restart_job GET /devices/bulk/restart/{jobId} Retrieve the async job status for a restart action.
DevicesApi get_bulk_resume_job GET /devices/bulk/resume/{jobId} Retrieve the status of a resume job
DevicesApi get_bulk_suspend_job GET /devices/bulk/suspend/{jobId} Retrieve the status of a suspend job
DevicesApi get_callback_messages_error_list_for_device GET /devices/{id}/callbacks-not-delivered Retrieve a list of undelivered callbacks
DevicesApi get_device GET /devices/{id} Retrieve information about a device
DevicesApi get_device_locations_list GET /devices/{id}/locations Retrieve the locations of a device
DevicesApi get_device_messages_list_for_device GET /devices/{id}/messages Retrieve a list of messages
DevicesApi get_device_unsubscribe_job GET /devices/bulk/unsubscribe/{jobId} Retrieve the async job status for an unsubscribe action.
DevicesApi get_modem_certificate_info GET /devices/{id}/certificate/modem Retrieve the modem certificate associated with a device
DevicesApi get_product_certificate_info GET /devices/{id}/certificate/product Retrieve the product certificate associated with a device
DevicesApi get_product_certificate_info_with_pac GET /devices/{id}/product-certificate Retrieve the product certificate associated with a device ID and PAC
DevicesApi list_devices GET /devices/ Retrieve a list of devices
DevicesApi unsubscribe PUT /devices/{id}/unsubscribe Unsubscribe a device
DevicesApi update_device PUT /devices/{id} Update a device
GroupsApi create_group POST /groups/ Create a group
GroupsApi delete_group DELETE /groups/{id} Delete a group
GroupsApi get_callback_messages_error_list_for_group GET /groups/{id}/callbacks-not-delivered Retrieve a list of undelivered callbacks
GroupsApi get_group GET /groups/{id} Retrieve information about a group
GroupsApi list_geolocation_payload GET /groups/{id}/geoloc-payloads Retrieve a list of geolocation payload
GroupsApi list_groups GET /groups/ Retrieve a list of groups according to visibility permissions and request filters.
GroupsApi update_group PUT /groups/{id} Update a group
ProfilesApi listprofiles GET /profiles/ Retrieve a list of profiles
TilesApi kmz_create_monarch POST /tiles/monarch/kmz Compute Sigfox Monarch coverage in order to allow export as kmz file
TilesApi kmz_create_public_operator POST /tiles/public-operator/{groupId}/kmz Compute Sigfox Public operator public coverage in order to allow export as kmz file
TilesApi kmz_file_monarch GET /tiles/monarch/kmz/{jobId}/tiles.kmz Retrieve Sigfox Monarch coverage kmz file
TilesApi kmz_file_public_coverage GET /tiles/public-coverage/kmz/tiles.kmz Retrieve Sigfox public coverage kmz file
TilesApi kmz_file_public_operator GET /tiles/public-operator/{groupId}/kmz/{jobId}/tiles.kmz Retrieve Sigfox public Operator coverage kmz file
TilesApi kmz_status_monarch GET /tiles/monarch/kmz/{jobId} Retrieve Sigfox Monarch coverage kmz computed job results
TilesApi kmz_status_public_operator GET /tiles/public-operator/{groupId}/kmz/{jobId} Retrieve Sigfox public Operator coverage kmz computed job results
TilesApi tiles_monarch_get GET /tiles/monarch Retrieve the information needed to display Sigfox Monarch service coverage.
TilesApi tiles_public_coverage_get GET /tiles/public-coverage Retrieve the information needed to display Sigfox public coverage.
UsersApi add_user_roles PUT /users/{id}/profiles add user roles to a user
UsersApi create_user POST /users/ Create a user
UsersApi delete_user DELETE /users/{id} Delete a user
UsersApi delete_user_role DELETE /users/{id}/profiles/{profileId} Delete profiles or a given profile associated to the groupId
UsersApi get_user GET /users/{id} Retrieve information about a user
UsersApi list_users GET /users/ Retrieve a list of users according to visibility permissions and request filters
UsersApi update_user PUT /users/{id} Update a user

Documentation For Models

Documentation For Authorization

basicAuth

  • Type: HTTP basic authentication

Author

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published