=== JavaScript SDK Reference ==== Getting Started Inside the `clients/javascript` directory of the installation is an SDK for browser or node-based JavaScript applications. The `build/helix-web-services-client.js` file is a "browserfied" distribution that exposes our core `helix_web_services_client` object. You can use this or include the project code as a node dependency, and use browserify to rebuild your own javaScript distribution. The examples below do not indicate how your code includes the client project. You start by creating an `ApiClient` instance, with the server's URL for access. Typically, you will sign into the server as a particular user for that user's token, then continue. Most api methods are accessed via the `DefaultApi` handle from the `ApiClient.createDefaultApi` method. Models are typically accessed via the `helix_web_services_client.models` handle. Most methods take a callback using the convention of having the first callback parameter be an error object. [source,javascript] .... var apiClient = new helix_web_services_client.ApiClient('https://mycompany.example.com'); var api = apiClient.createDefaultApi(); var loginRequest = new helix_web_services_client.models.LoginRequest({ user: 'myuser', password: 'mypassword' }); api.loginPost(loginRequest, function(err, loginResponse) { if (err) { console.log("server error status", err.status); return; } // Associate the login ticket with the apiClient. apiClient.apiKey = loginRepsonse.ticket; // At this point, our client instance is ready to make authenticated methods. }); .... ==== helix_web_services_client.ApiClient Reference ===== ApiClient properties .Properties [cols="3*", options="header"] |=== | Name | Type | Description | `url` | String | The base URL to the server | `basePath` | String | Path we prepend to most requests, defaults to `/api/[VERSION]`. | `timeout` | Number | If non-zero, the time (in ms) we configure for our client connections. Defaults to 1 minute. |=== [[javascript-api-client-constructor]] ===== ApiClient constructor Create a new ApiClient instance, configured to connect to your host. .Method Signature [source, javascript] .... new ApiClient(url); .... .Parameters [cols="4*", options="header"] |=== | Name | Type | Description | Required | `url` | String | The URL of your Helix Web Services instance, e.g., `https://mycompany.example.com` | false (you will need to set the `url` property before using) |=== [[javascript-api-client-create-default-api]] ===== ApiClient.prototype.createDefaultApi Creates a handle to the `DefaultApi` instance that provides most stable methods. .Method Signature [source, javascript] .... DefaultApi apiClient.createDefaultApi() .... .Returns [cols="2*", options="header"] |=== | Type | Description | `DefaultApi` | See also: <<javascript-default-api>> |=== [[javascript-api-client-create-alpha-api]] ===== ApiClient.prototype.createDefaultApi Creates a handle to the `AlphaApi` instance that provides new and unstable methods. .Method Signature [source, javascript] .... DefaultApi apiClient.createAlphaApi() .... .Returns [cols="2*", options="header"] |=== | Type | Description | `DefaultApi` | See also: <<javascript-alpha-api>> |=== [[javascript-default-api]] ==== DefaultApi Reference INFO: The `DefaultApi` class is not instantiated directly, but accessed via <<javascript-api-client-create-default-api>> include::../js-default.adoc[] [[javascript-alpha-api]] ==== AlphaApi Reference INFO: The `AlphaApi` class is not instantiated directly, but accessed via <<javascript-api-client-create-alpha-api>> include::../js-alpha.adoc[] ==== helix_web_services_client.models Reference include::../javascript-models.adoc[]
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 19065 | tjuricek |
Revised Javascript Client SDK documentation to meet the new API, with fixes. Added a couple of basic tests, and added archival of the different testng XML output. The main major fix is to handle array output better. |
||
#1 | 19012 | tjuricek | Revised Java client SDK, added ApiClient reference, restructured documentation. |