Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
Hello Community Members,
Using OData Services, I am trying to perform A Three Stage Action to upload a file into Windchill through Thingworx (9.5).
Three-Stage Upload of Attachments to a Change Issue
But after performing Upload Stage 1 Action I am stuck at Stage 2 Action.
I have successfully uploaded the HTML file through Postman but cannot perform the same action from Thingworx services.
Please let me know how to perform Upload Stage 2 Action Through Thingworx.
I am attaching sample screenshots of Postman Call for Upload Stage 2 Action:
Let me know if you have any queries.
@CarlesColl , @Velkumar , @Constantine , @pshashipreetham , @VladimirN
Any feedback, suggestion or solution for this?
Take a look at
Resources["ContentLoaderFunctions"].PostMultipart
/ Constantine
Hello @Constantine ,
Issue is this only, how to pass file in PostMultipart call.
I tried passing the file repository and path to file, it didn't worked.
I also tried passing file as Blob data in the parameter "partsToSend", but that also didn't worked.
Below is sample code that I tried in Thingworx:
// Set up the request headers
var headers = {
"CSRF_NONCE": csrfToken,
"Content-Type": "multipart/form-data; boundary=-----------------------------boundary"
};
const table = Resources["InfoTableFunctions"].CreateInfoTable();
table.AddField({
name: "Master_URL",
baseType: "STRING"
});
table.AddField({
name: "CacheDescriptor_array",
baseType: "STRING"
});
table.AddRow({
Master_URL: masterURL,
CacheDescriptor_array: cacheDescriptor
});
let params = {
proxyScheme: undefined /* STRING {"defaultValue":"http"} */ ,
headers: headers /* JSON */ ,
ignoreSSLErrors: undefined /* BOOLEAN */ ,
useNTLM: undefined /* BOOLEAN {"defaultValue":false} */ ,
partsToSend: table /* INFOTABLE */ ,
workstation: undefined /* STRING {"defaultValue":""} */ ,
useProxy: undefined /* BOOLEAN {"defaultValue":false} */ ,
repository: "FileRepository" /* STRING */ ,
proxyHost: undefined /* STRING {"defaultValue":""} */ ,
url: url /* STRING */ ,
timeout: undefined /* NUMBER {"defaultValue":60} */ ,
proxyPort: undefined /* INTEGER {"defaultValue":8080} */ ,
password: "Password" /* STRING */ ,
pathOnRepository: "/Report.html" /* STRING */ ,
domain: undefined /* STRING {"defaultValue":""} */ ,
username: "User" /* STRING */
};
// result: JSON
var result = Resources["ContentLoaderFunctions"].PostMultipart(params);