This SDK is automatically generated by the Swagger Codegen project:
- API version: v2 RC-2018.04 (available here)
- Package version: 0.2.0
- Build package: io.swagger.codegen.languages.JavascriptClientCodegen
For Node.js
The library is available at npmjs.
To install it via npmjs:
npm install ngsi_v2 --save
To use the library locally without publishing to a remote npm registry, first install the dependencies by changing
into the directory containing package.json
(and this README). Let's call this JAVASCRIPT_CLIENT_DIR
. Then run:
npm install
Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR
:
npm link
Finally, switch to the directory you want to use your ngsi_v2 from, and run:
npm link /path/to/<JAVASCRIPT_CLIENT_DIR>
You should now be able to require('ngsi_v2')
in javascript files from the directory you ran the last
command above from.
If you fork and customise the library, in a git repository, e.g. https://github.com/smartsdk/ngsi-sdk-javascript.git then install it via:
npm install https://github.com/smartsdk/ngsi-sdk-javascript.git --save
The library also works in the browser environment via npm and browserify. The latest compiled version of the javascript library is available at https://smartsdk.github.io/ngsi-sdk-javascript/js/ngsi.js
To embed it in your HTML code:
<script src="https://smartsdk.github.io/ngsi-sdk-javascript/js/ngsi.js"></script>
In case of changes to the code, after following the above steps with Node.js and installing browserify with npm install -g browserify
, perform the following:
browserify js/main.js --require superagent --exports require -o js/ngsi.js
Then include ngsi.js in the HTML pages.
Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:
module: {
rules: [
{
parser: {
amd: false
}
}
]
}
Please follow the installation instruction and execute the following JS code:
var NgsiV2 = require('ngsi_v2');
var defaultClient = NgsiV2.ApiClient.instance;
// Configure API key authorization: fiware_token
var fiware_token = defaultClient.authentications['fiware_token'];
fiware_token.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//fiware_token.apiKeyPrefix['X-Auth-Token'] = "Token"
var api = new NgsiV2.APIEntryPointApi()
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.retrieveAPIResources(callback);
All URIs are relative to https://orion.lab.fiware.org:1026/v2
Class | Method | HTTP request | Description |
---|---|---|---|
NgsiV2.APIEntryPointApi | retrieveAPIResources | GET / | |
NgsiV2.AttributeValueApi | getAttributeValue | GET /entities/{entityId}/attrs/{attrName}/value | |
NgsiV2.AttributeValueApi | updateAttributeValue | PUT /entities/{entityId}/attrs/{attrName}/value | |
NgsiV2.AttributesApi | getAttributeData | GET /entities/{entityId}/attrs/{attrName} | |
NgsiV2.AttributesApi | removeASingleAttribute | DELETE /entities/{entityId}/attrs/{attrName} | |
NgsiV2.AttributesApi | updateAttributeData | PUT /entities/{entityId}/attrs/{attrName} | |
NgsiV2.BatchOperationsApi | notify | POST /op/notify | |
NgsiV2.BatchOperationsApi | query | POST /op/query | |
NgsiV2.BatchOperationsApi | update | POST /op/update | |
NgsiV2.EntitiesApi | createEntity | POST /entities | |
NgsiV2.EntitiesApi | listEntities | GET /entities | |
NgsiV2.EntitiesApi | removeEntity | DELETE /entities/{entityId} | |
NgsiV2.EntitiesApi | replaceAllEntityAttributes | PUT /entities/{entityId}/attrs | |
NgsiV2.EntitiesApi | retrieveEntity | GET /entities/{entityId} | |
NgsiV2.EntitiesApi | retrieveEntityAttributes | GET /entities/{entityId}/attrs | |
NgsiV2.EntitiesApi | updateExistingEntityAttributes | PATCH /entities/{entityId}/attrs | |
NgsiV2.EntitiesApi | updateOrAppendEntityAttributes | POST /entities/{entityId}/attrs | |
NgsiV2.RegistrationsApi | createRegistrations | POST /registrations | |
NgsiV2.RegistrationsApi | deleteRegistration | DELETE /registrations/{registrationId} | |
NgsiV2.RegistrationsApi | retrieveRegistration | GET /registrations/{registrationId} | |
NgsiV2.RegistrationsApi | retrieveRegistrations | GET /registrations | |
NgsiV2.RegistrationsApi | updateRegistration | PATCH /registrations/{registrationId} | |
NgsiV2.SubscriptionsApi | createANewSubscription | POST /subscriptions | |
NgsiV2.SubscriptionsApi | deleteSubscription | DELETE /subscriptions/{subscriptionId} | |
NgsiV2.SubscriptionsApi | retrieveSubscription | GET /subscriptions/{subscriptionId} | |
NgsiV2.SubscriptionsApi | retrieveSubscriptions | GET /subscriptions | |
NgsiV2.SubscriptionsApi | updateSubscription | PATCH /subscriptions/{subscriptionId} | |
NgsiV2.TypesApi | retrieveEntityType | GET /types/{entityType} | |
NgsiV2.TypesApi | retrieveEntityTypes | GET /types/ |
- NgsiV2.APIEntryPoint
- NgsiV2.Attribute
- NgsiV2.AttributeValue
- NgsiV2.BatchOperation
- NgsiV2.DataProvided
- NgsiV2.DataProvidedExpression
- NgsiV2.Entity
- NgsiV2.EntityType
- NgsiV2.ErrorResponse
- NgsiV2.OpqueryExpression
- NgsiV2.Provider
- NgsiV2.Query
- NgsiV2.QueryPattern
- NgsiV2.Registration
- NgsiV2.RegistrationResponse
- NgsiV2.RegistrationResponseForwardingInformation
- NgsiV2.Subscription
- NgsiV2.SubscriptionNotification
- NgsiV2.SubscriptionNotificationHttp
- NgsiV2.SubscriptionNotificationHttpCustom
- NgsiV2.SubscriptionSubject
- NgsiV2.SubscriptionSubjectConditions
- NgsiV2.UpdateSubscriptionResponse
- Type: API key
- API key parameter name: X-Auth-Token
- Location: HTTP header