Skip to content

BlueRainSoftware/id4i-api_client-javascript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ID4i API Client Library - Javascript

This library allows developers to interact with the http://id4i.de HTTP API. Typically you won't have to build it yourselves, you can just pull in the dependency from http://npmjs.org (soon, anyway).

Feel free to look at the sources and the documentation contained in this repository.

For additional information, please refer to

  • API version: 1.0.0

  • Package version: 1.0.0

  • Build package: io.swagger.codegen.languages.JavascriptClientCodegen

    For more information, please visit http://bluerain.de

Installation

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install id4i_api --save
Local development

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 id4i_api from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

You should now be able to require('id4i_api') in javascript files from the directory you ran the last command above from.

git

You can install the javascript client library directly from the repository

npm install https://github.com/BlueRainSoftware/id4i-api_client-javascript#master --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file, that's to say your javascript file where you actually use this library):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

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
        }
    } ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

var Id4iApi = require('id4i_api');

        var defaultClient = Id4iApi.ApiClient.instance;
    
            // Configure API key authorization: Authorization
            var Authorization = defaultClient.authentications['Authorization'];
        Authorization.apiKey = "YOUR API KEY"
            // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
            //Authorization.apiKeyPrefix['Authorization'] = "Token"

    var api = new Id4iApi.AccountsApi()
    
            var organizationId = "organizationId_example"; // {String} The namespace of the organization
    
            var username = "username_example"; // {String} username
    
            var changeRoleRequest = new Id4iApi.ChangeRoleRequest(); // {ChangeRoleRequest} changeRoleRequest
    

        var callback = function(error, data, response) {
        if (error) {
        console.error(error);
        } else {
    console.log('API called successfully.');
        }
        };
        api.addUserRoles(organizationId, username, changeRoleRequest, callback);

Documentation for API Endpoints

All URIs are relative to https://backend.id4i.de

Class Method HTTP request Description
Id4iApi.AccountsApi addUserRoles POST /api/v1/organizations/{organizationId}/users/{username}/roles Add role(s) to user
Id4iApi.AccountsApi completeRegistration PUT /account/registration Complete registration
Id4iApi.AccountsApi findUserByUsername GET /api/v1/users/{username} Find by username
Id4iApi.AccountsApi findUsers GET /api/v1/users Find users
Id4iApi.AccountsApi getAllOrganizationRoles GET /api/v1/organizations/{organizationId}/roles List users and their roles
Id4iApi.AccountsApi getOrganizationsOfUser GET /api/v1/user/organizations Retrieve organizations of user
Id4iApi.AccountsApi getUserRoles GET /api/v1/organizations/{organizationId}/users/{username}/roles Get user roles by username
Id4iApi.AccountsApi getUsersOfOrganization GET /api/v1/organizations/{organizationId}/users Find users in organization
Id4iApi.AccountsApi inviteUsers POST /api/v1/organizations/{organizationId}/users/invite Invite Users
Id4iApi.AccountsApi listAllRoles GET /api/v1/roles List roles
Id4iApi.AccountsApi login POST /login
Id4iApi.AccountsApi registerUser POST /account/registration Register user
Id4iApi.AccountsApi removeUserRoles DELETE /api/v1/organizations/{organizationId}/users/{username}/roles Remove role(s) from user
Id4iApi.AccountsApi requestPasswordReset POST /account/password Request password reset
Id4iApi.AccountsApi verifyPasswordReset PUT /account/password Verify password reset
Id4iApi.AccountsApi verifyUserRegistration POST /account/verification Verify registration
Id4iApi.AliasApi addGuidAlias POST /api/v1/id4ns/{id4n}/alias/{aliasType} Add alias for GUID or Collection
Id4iApi.AliasApi getGuidAliasTypes GET /api/v1/search/guids/aliases/types List all supported alias types
Id4iApi.AliasApi getGuidAliases GET /api/v1/id4ns/{id4n}/alias Get all aliases for the given GUID or Collection.
Id4iApi.AliasApi removeGuidAlias DELETE /api/v1/id4ns/{id4n}/alias/{aliasType} Remove aliases from GUID or Collection
Id4iApi.AliasApi searchByAlias GET /api/v1/search/guids Search for GUIDs by alias
Id4iApi.ApiKeysApi addApiKeyPrivilege POST /api/v1/apikeys/{key}/privileges Add privilege
Id4iApi.ApiKeysApi addApiKeyPrivilegeForId4ns POST /api/v1/apikeys/{key}/privileges/{privilege}/id4ns Add ID4ns of a privilege
Id4iApi.ApiKeysApi createNewApiKey POST /api/v1/apikeys Create API key
Id4iApi.ApiKeysApi deleteApiKey DELETE /api/v1/apikeys/{key} Delete API key
Id4iApi.ApiKeysApi getApiKey GET /api/v1/apikeys/{key} Show API key
Id4iApi.ApiKeysApi listAllApiKeyPrivileges GET /api/v1/apikeys/privileges List all privileges
Id4iApi.ApiKeysApi listAllApiKeysOfOrganization GET /api/v1/apikeys Find API key by organization
Id4iApi.ApiKeysApi listApiKeyPrivileges GET /api/v1/apikeys/{key}/privileges List privileges
Id4iApi.ApiKeysApi listId4ns GET /api/v1/apikeys/{key}/privileges/{privilege}/id4ns ID4ns of a privilege
Id4iApi.ApiKeysApi removeApiKeyPrivilege DELETE /api/v1/apikeys/{key}/privileges Remove privilege
Id4iApi.ApiKeysApi removeApiKeyPrivilegeForId4ns DELETE /api/v1/apikeys/{key}/privileges/{privilege}/id4ns Remove id4ns of a privilege
Id4iApi.ApiKeysApi updateApiKey PUT /api/v1/apikeys/{key} Update API keys
Id4iApi.AuditingApi listOrganizationChangeLog GET /api/v1/changelog/organization/{organizationId}/ List change log entries of an organization
Id4iApi.BillingApi getPositionsForOrganization GET /api/v1/billing/{organizationId}/positions Get billing positions for a given organization
Id4iApi.BillingApi getSumForOrganization GET /api/v1/billing/{organizationId} Get billing amount of services for a given organization
Id4iApi.CollectionsApi addElementsToCollection POST /api/v1/collections/{id4n}/elements Add elements to collection
Id4iApi.CollectionsApi createCollection POST /api/v1/collections Create collection
Id4iApi.CollectionsApi deleteCollection DELETE /api/v1/collections/{id4n} Delete collection
Id4iApi.CollectionsApi deleteProperties DELETE /api/v1/id4ns/{id4n}/properties Delete ID4n properties
Id4iApi.CollectionsApi findCollection GET /api/v1/collections/{id4n} Find collection
Id4iApi.CollectionsApi getAllCollectionsOfOrganization GET /api/v1/organizations/{organizationId}/collections Get collections of organization
Id4iApi.CollectionsApi getProperties GET /api/v1/id4ns/{id4n}/properties Retrieve ID4n properties
Id4iApi.CollectionsApi listElementsOfCollection GET /api/v1/collections/{id4n}/elements List contents of the collection
Id4iApi.CollectionsApi patchProperties PATCH /api/v1/id4ns/{id4n}/properties Patch ID4n properties
Id4iApi.CollectionsApi removeElementsFromCollection DELETE /api/v1/collections/{id4n}/elements Remove elements from collection
Id4iApi.CollectionsApi updateCollection PATCH /api/v1/collections/{id4n} Update collection
Id4iApi.GuidsApi addGuidAlias POST /api/v1/id4ns/{id4n}/alias/{aliasType} Add alias for GUID or Collection
Id4iApi.GuidsApi createGuid POST /api/v1/guids Create GUID(s)
Id4iApi.GuidsApi deleteProperties DELETE /api/v1/id4ns/{id4n}/properties Delete ID4n properties
Id4iApi.GuidsApi getCollections GET /api/v1/id4ns/{id4n}/collections Retrieve collections of an ID
Id4iApi.GuidsApi getGuid GET /api/v1/guids/{id4n} Retrieve GUID information
Id4iApi.GuidsApi getGuidAliases GET /api/v1/id4ns/{id4n}/alias Get all aliases for the given GUID or Collection.
Id4iApi.GuidsApi getGuidsWithoutCollection GET /api/v1/guids/withoutCollection Retrieve GUIDs not in any collection
Id4iApi.GuidsApi getId4n GET /api/v1/id4ns/{id4n} Retrieve ID4n information
Id4iApi.GuidsApi getProperties GET /api/v1/id4ns/{id4n}/properties Retrieve ID4n properties
Id4iApi.GuidsApi importGS1Codes POST /api/v1/import/gs1 Import GS1/MAPP codes
Id4iApi.GuidsApi patchProperties PATCH /api/v1/id4ns/{id4n}/properties Patch ID4n properties
Id4iApi.GuidsApi removeGuidAlias DELETE /api/v1/id4ns/{id4n}/alias/{aliasType} Remove aliases from GUID or Collection
Id4iApi.GuidsApi updateGuid PATCH /api/v1/guids/{id4n} Change GUID information.
Id4iApi.HistoryApi addItem POST /api/v1/history/{id4n} Add history item
Id4iApi.HistoryApi filteredList GET /api/v1/history/{id4n} List history
Id4iApi.HistoryApi list GET /api/v1/history/{id4n}/{organizationId} DEPRECATED - List history
Id4iApi.HistoryApi retrieveItem GET /api/v1/history/{id4n}/{organizationId}/{sequenceId} Get history item
Id4iApi.HistoryApi updateItem PATCH /api/v1/history/{id4n}/{organizationId}/{sequenceId} Update history item
Id4iApi.HistoryApi updateItemVisibility PUT /api/v1/history/{id4n}/{organizationId}/{sequenceId}/visibility Set history item visibility
Id4iApi.ImagesApi resolveImageUsingGET GET /api/v1/public/image/{imageID} Resolve image
Id4iApi.MessagingApi enqueueCustomMessage POST /api/v1/organizations/{organizationId}/messaging/enqueueCustomMessage Enqueue a custom message
Id4iApi.MessagingApi getDefaultQueue GET /api/v1/organizations/{organizationId}/messaging
Id4iApi.MessagingApi patchDefaultQueue PATCH /api/v1/organizations/{organizationId}/messaging
Id4iApi.MetaInformationApi applicationInfo GET /api/v1/info Retrieve version information about ID4i
Id4iApi.OrganizationsApi addPartnerOrganization PUT /api/v1/organizations/{organizationId}/partner Add partner
Id4iApi.OrganizationsApi addUserRoles POST /api/v1/organizations/{organizationId}/users/{username}/roles Add role(s) to user
Id4iApi.OrganizationsApi createOrganization POST /api/v1/organizations Create organization
Id4iApi.OrganizationsApi deleteOrganization DELETE /api/v1/organizations/{organizationId} Delete organization
Id4iApi.OrganizationsApi deleteOrganizationBillingAddress DELETE /api/v1/organizations/{organizationId}/addresses/billing Remove billing address
Id4iApi.OrganizationsApi deleteOrganizationLogo DELETE /api/v1/organizations/{organizationId}/logo Delete organization logo
Id4iApi.OrganizationsApi findOrganization GET /api/v1/organizations/{organizationId} Find organization by id/namespace
Id4iApi.OrganizationsApi findOrganizationAddress GET /api/v1/organizations/{organizationId}/addresses/default Retrieve address
Id4iApi.OrganizationsApi findOrganizationBillingAddress GET /api/v1/organizations/{organizationId}/addresses/billing Retrieve billing address
Id4iApi.OrganizationsApi getAllCollectionsOfOrganization GET /api/v1/organizations/{organizationId}/collections Get collections of organization
Id4iApi.OrganizationsApi getAllOrganizationRoles GET /api/v1/organizations/{organizationId}/roles List users and their roles
Id4iApi.OrganizationsApi getOrganizationPrivileges GET /api/v1/organizations/{organizationId}/privileges List my privileges
Id4iApi.OrganizationsApi getOrganizationsOfUser GET /api/v1/user/organizations Retrieve organizations of user
Id4iApi.OrganizationsApi getPartnerOrganizations GET /api/v1/organizations/{organizationId}/partner Get partners of an organization
Id4iApi.OrganizationsApi getUserRoles GET /api/v1/organizations/{organizationId}/users/{username}/roles Get user roles by username
Id4iApi.OrganizationsApi getUsersOfOrganization GET /api/v1/organizations/{organizationId}/users Find users in organization
Id4iApi.OrganizationsApi inviteUsers POST /api/v1/organizations/{organizationId}/users/invite Invite Users
Id4iApi.OrganizationsApi listCountries GET /api/v1/countries List countries
Id4iApi.OrganizationsApi removePartnerOrganization DELETE /api/v1/organizations/{organizationId}/partner Remove partner
Id4iApi.OrganizationsApi removeUserRoles DELETE /api/v1/organizations/{organizationId}/users/{username}/roles Remove role(s) from user
Id4iApi.OrganizationsApi setOrganizationLogo POST /api/v1/organizations/{organizationId}/logo Update organization logo
Id4iApi.OrganizationsApi updateOrganization PUT /api/v1/organizations/{organizationId} Update organization
Id4iApi.OrganizationsApi updateOrganizationAddress PUT /api/v1/organizations/{organizationId}/addresses/default Store address
Id4iApi.OrganizationsApi updateOrganizationBillingAddress PUT /api/v1/organizations/{organizationId}/addresses/billing Store billing address
Id4iApi.PublicServicesApi getPublicDocument GET /api/v1/public/documents/{id4n}/{organizationId}/{fileName}/metadata Retrieve a public document (meta-data only, no content)
Id4iApi.PublicServicesApi getRoutes GET /api/v1/public/routes/{id4n} Retrieve all public routes for a GUID
Id4iApi.PublicServicesApi go GET /go/{guid} Forward
Id4iApi.PublicServicesApi listAllPublicDocuments GET /api/v1/public/documents/{id4n} List public documents
Id4iApi.PublicServicesApi listPublicHistory GET /api/v1/public/history/{id4n} Shows the public history of the given GUID
Id4iApi.PublicServicesApi readOrganizationInfo GET /api/v1/public/organizations/{organizationId} Read public organization information
Id4iApi.PublicServicesApi readPublicDocument GET /api/v1/public/documents/{id4n}/{organizationId}/{fileName} Read public document contents
Id4iApi.PublicServicesApi resolveImageUsingGET GET /api/v1/public/image/{imageID} Resolve image
Id4iApi.PublicServicesApi resolveWhoIsEntry GET /whois/{id4n} Resolve owner of id4n
Id4iApi.RoutingApi getAllRoutes GET /api/v1/routingfiles/{id4n}/routes/{type} Retrieve all routes of a GUID (or ID4N)
Id4iApi.RoutingApi getRoute GET /api/v1/routingfiles/{id4n}/route/{type} Retrieve current route of a GUID (or ID4N)
Id4iApi.RoutingApi getRoutingFile GET /api/v1/routingfiles/{id4n} Retrieve routing file
Id4iApi.RoutingApi updateRoutingFile PUT /api/v1/routingfiles/{id4n} Store routing file
Id4iApi.StorageApi createDocument POST /api/v1/documents/{id4n}/{organizationId} Create an document for an id4n
Id4iApi.StorageApi deleteDocument DELETE /api/v1/documents/{id4n}/{organizationId}/{fileName} Delete a document
Id4iApi.StorageApi getDocument GET /api/v1/documents/{id4n}/{organizationId}/{fileName}/metadata Retrieve a document (meta-data only, no content)
Id4iApi.StorageApi getPublicDocument GET /api/v1/public/documents/{id4n}/{organizationId}/{fileName}/metadata Retrieve a public document (meta-data only, no content)
Id4iApi.StorageApi listAllDocuments GET /api/v1/documents/{id4n} List documents
Id4iApi.StorageApi listAllPublicDocuments GET /api/v1/public/documents/{id4n} List public documents
Id4iApi.StorageApi listDocuments GET /api/v1/documents/{id4n}/{organizationId} List organization specific documents
Id4iApi.StorageApi putDocument PUT /api/v1/documents/{id4n}/{organizationId} Put an document for an id4n
Id4iApi.StorageApi readDocument GET /api/v1/documents/{id4n}/{organizationId}/{fileName} Read document contents
Id4iApi.StorageApi readFromMicrostorage GET /api/v1/microstorage/{id4n}/{organization} Read data from microstorage
Id4iApi.StorageApi readPublicDocument GET /api/v1/public/documents/{id4n}/{organizationId}/{fileName} Read public document contents
Id4iApi.StorageApi updateDocumentMetadata PATCH /api/v1/documents/{id4n}/{organizationId}/{fileName}/metadata Update a document
Id4iApi.StorageApi writeToMicrostorage PUT /api/v1/microstorage/{id4n}/{organization} Write data to microstorage
Id4iApi.TransferApi getSendInfo GET /api/v1/transfers/{id4n}/sendInfo Show transfer preparation information
Id4iApi.TransferApi prepare PUT /api/v1/transfers/{id4n}/sendInfo Prepare an object for transfer
Id4iApi.TransferApi receive PUT /api/v1/transfers/{id4n}/receiveInfo Transfer a GUID or collection, obtaining it (i.e. becoming the holder) and if allowed also taking ownership
Id4iApi.WhoIsApi resolveWhoIsEntry GET /whois/{id4n} Resolve owner of id4n

Documentation for Models

Documentation for Authorization

Authorization

  • Type: API key
    • API key parameter name: Authorization
    • Location: HTTP header