Hi Folks,
I have a requirement to download the files of Windchill objects into Thingworx repository. I am getting the Link of files inside Thingworx using Odata Connectors. I am able to generate the file in Repository but when I try to open the file getting error "Failed to load PDF document."
Below is the code I am using :
Solved! Go to Solution.
Hello VV,
You should be getting the CSRF_NONCE token first and then pass it to subsequent calls - see example bellow:
let ParamA = {
url: Windchill_URL + "/servlet/odata/v3/PTC/GetCSRFToken()",
...
};
const NONCE_VALUE = Resources["ContentLoaderFunctions"].GetJSON(ParamA);
...
let ParamB = {
...
headers: {
...
CSRF_NONCE: NONCE_VALUE
}
};
result = Resources["ContentLoaderFunctions"].PostJSON(ParamB);If you still get some error it would be helpful if you provide ThingWorx/WC log snippets.
Hello VV,
You should be getting the CSRF_NONCE token first and then pass it to subsequent calls - see example bellow:
let ParamA = {
url: Windchill_URL + "/servlet/odata/v3/PTC/GetCSRFToken()",
...
};
const NONCE_VALUE = Resources["ContentLoaderFunctions"].GetJSON(ParamA);
...
let ParamB = {
...
headers: {
...
CSRF_NONCE: NONCE_VALUE
}
};
result = Resources["ContentLoaderFunctions"].PostJSON(ParamB);If you still get some error it would be helpful if you provide ThingWorx/WC log snippets.
Yes Using the Nonce token I fetch the objects then bearer token I download the file in repository. Thank you so much.
Hi @VV_14105315
Was the response you received helpful? If you still have questions, please let us know. Otherwise, please mark the response as the Accepted Solution for the benefit of others in the community.
Regards.
--Sharon
