Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
NOTE: Even though I have tried on ODataConnector and SwaggerConnector, these steps below should be working for all the Thingworx Integration Connectors viz. GenericConnector, HTTPConnector, ODataConnector, SAPODataConnector, SwaggerConnector, WindchillSwaggerConnector.
This document guides you to add a custom header in any Thingworx Integration connector.
Step 1. Create a Datashape say "CustomHeadersDataShape" and add a string field with Name the same as the header name you want to add. In this case, I want to add a header called "Prefer" so it will look something like
Step 2: Go to the Integration Connector which you want to add this custom header. Navigate to "Services". Under the "Inherited Services", edit/overwrite the "GetCustomHeaderParameters" service by clicking on the edit (pencil) icon.
Step 3: In the JavaScript Code sniped section add below code snipped
var params = {
infoTableName : "InfoTable",
dataShapeName : "CustomHeadersDataShape"
};
var result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);
var preferValue = "odata.maxpagesize=50";
var newRow = {"Prefer" : preferValue };
result.AddRow(newRow);
Step 4: Save the service and execute "GetCustomHeaderParameters". You should see something like
Now your custom header "Prefer: odata.maxpagesize=50" is set. further execution of your connector services will consider this header until it is reset.
Hi. How to find Thingworx Integration connector ? I didnt found anywhere. How can create datashape ? thanks for answers.