RESTful Engine V2 Python Client Reference

This article describes how to get the Windward RESTful V2 Python Client installed, as well as a list of all methods and models defined in the client.

NOTE: You must use Python 3.8.6 (64bit) for this client to run on your machine. You can get that here.

Setting up the Client

To see a sample application using the Windward RESTful V2 Python Client, please refer to our sample python application github page. Make sure to read the brief README.

To set up the client, run the following command in the command prompt:

pip install windwardrestapi==20.2.0.501

Then in your project, include this line:

from windwardrestapi.Api import WindwardClient as Client

Then to initialize the client:

client = Client.WindwardClient("[RESTful URL]")

Now, the client is setup and you can call the different methods associated with it.

Client Models

This section will go over the relevant models associated with the client that you will use.

To import the models into your project, use:

from windwardrestapi.Model import {MODEL NAME}

Template:

To import model:

from windwardrestapi.Model import Template

These are the parameters for the Template object constructor

:param callback : If set, this url will be called with a POST when a job completes. If the text "{guid}" is in the url, that text will
be replaced with the Guid for the callback.
:type str

:param outputFormat : The desired output file type (set using the Template.outputFormatEnum())
:type str

:param data : The file path for your template (the client will encode to base64) (only use if connectionString is None)
:type str : string representation of the file path

:param connectionString : The connection string to your template file (only use if data is None)
:type str

:param format : The format of the template to be processed (if left empty it will auto populate)
:type str

:param properties : Windward properties for this report. These override any properties set in the configuration file on the server side.
:type List[Property] : A list of Property objects

:param parameters : A set of input parameters for this report. The parameters are global and shared among all data sources.
:type List[Parameter] : A list of Property objects

:param datasources : The datasources to apply to the template. The datasources are applied simultaneously.
:type List[Datasource] : A list of Datasource objects

:param tag : A tag you want to assign to the template. 
This is passed in to the repository job handlers and is set in the final generated Report object
:type str

:param trackImports : Return all imports with the generated document
:type bool

:param trackErrors : Enable or disable the error handling and verify functionality.
:type bool

:param mainPrinter : If you are using printer output use to specify main printer. Printer must be recognized by Network
:type str

:param firstPagePrinter : Set first page printer if main printer is already set
:type str

:param printerJobName : Assign the print job a name
:type str

:param printCopies : Set number of copies the print job should print
:type str

:param printDuplex : Selects the printers duplex mode
:type str

When constructing the template object, explicitly set the input parameters, ie:

testTemplate = Template.Template(data=file, outputFormat=Template.outputFormatEnum.DOCX, datasources=testXmlDS, parameters=testParam)

Only set the input parameters that apply to your report. You must have either the data input parameter or the connectionString input parameter set.

XML 1.0 Data Source:

To import model:

from windwardrestapi.Model import Xml_10DataSource

These are the input parameters for the XML 1.0 data source constructor:

:param name : The datasource name that maps to the datasource attribute in tags
:type str

:param connectionString : The connection string to the XML1 data (only use if data is None)
:type str

:param data : The file path to the XML1 data file (only use if connectionString is None)
:type str : the file path to the XML1 data file as a string

:param schemaConnectionString : The connection string to the XSD file. None if no schema
:type str

This is how you insatiate the object:

testXmlDS = Xml_10DataSource.Xml_10DataSource(name="MANF_DATA_2009", data=data)

SQL Data Source:

To import model:

from windwardrestapi.Model import SqlDataSource

These are the input parameters for the SQL data source constructor:

:param name : The datasource name that maps to the datasource attribute in tags
:type str

:param className : The ADO.NET connector classname
:type str

:param connectionString : The connection string to the SQL data
:type str

This is how you insatiate the object:

testSqlDS = SqlDataSource.SqlDataSource(name= "", ...)

Salesforce OAuth Data Source:

To import model:

from windwardrestapi.Model import SalesforceOAuthDataSource

These are the input parameters for the SalesforceOauth data source constructor:

:param name : The datasource name that maps to the datasource attribute in tags
:type str

:param connectionString : The connection string to the SalesforceOAuth data
:type str

This is how you insatiate the object:

testSalesforceOAuthDS = SalesforceOAuthDataSource.SalesforceOAuthDataSource(name= "", connectionString = "")

Salesforce Data Source:

To import model:

from windwardrestapi.Model import SalesforceDataSource

These are the input parameters for the Salesforce data source constructor:

:param name : The datasource name that maps to the datasource attribute in tags
:type str

:param connectionString : The connection string to the Salesforce data
:type str

This is how you insatiate the object:

testSalesforceDS = SalesforceDataSource.SalesforceDataSource(name= "", connectionString = "")

OData Source:

To import model:

from windwardrestapi.Model import ODataDataSource

These are the input parameters for the OData data source constructor:

:param name : The datasource name that maps to the datasource attribute in tags
:type str

:param connectionString : The connection string to the OData data
:type str

This is how you insatiate the object:

testODataDS = ODataDataSource.ODataDataSource(name= "", connectionString = "")

JSON Data Source:

To import model:

from windwardrestapi.Model import JsonDataSource

These are the input parameters for the JSON data source constructor:

:param name : The datasource name that maps to the datasource attribute in tags
:type str

:param connectionString : The connection string to the JSON data file (only use if data is None)
:type str

:param data : The file path to the JSON data file (only use if connectionString is None)
:type str : the file path to the JSON data file as a string

This is how you insatiate the object:

testJsonDS = JsonDataSource.JsonDataSource(name= "", ...)

Parameter:

If your template has parameters, this is the model to use. To import model:

from windwardrestapi.Model import Parameter

These are the input parameters for the Parameter constructor:

:param name : The name of the property
:type str

:param wrappedValue : The value of the property. You can pass any primitive, null, a DateTime, or DateTimeOffset. You cannot pass lists or arrays
:type ParameterValue

(Parameter value explained next)

The template object takes in a List[Parameter], so if you have multiple, append them to an array and pass them in that way.

This is how you insatiate one parameter:

testParam = Parameter.Parameter(name="varName1", wrappedValue= ParameterValue.ParameterValue(paramType ="[the type of the parameter]", rawValue = "[the actual value of the param]"))

You could also just construct the ParameterValue object outside of this line and then include it:

testParamValue = ParameterValue.ParameterValue(paramType = "[the type of the parameter]", rawValue = "[the actual value of the param]")

testParam = Parameter.Parameter(name="varName1",testParamValue)

Parameter Value:

If your template has parameters,  use this model for the wrappedValue in the Parameter constructor. To import model:

from windwardrestapi.Model import ParameterValue

These are the input parameters for the ParameterValue constructor:

:param paramType: The data type of the Parameter
:type str

:param rawValue: The value of the Parameter
:type ParameterValue

This is how you insatiate the object:

testParamValue = ParameterValue.ParameterValue(paramType = "[the type of the parameter]", rawValue = "[the actual value of the param]")

testParam = Parameter.Parameter(name="varName1",testParamValue)

0 Comments

Add your comment

E-Mail me when someone replies to this comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.