Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Hello, recently I use PostMultipart, and these's chinese character in my partsToSend
so I set the headers like this:
var params = {
proxyScheme: undefined /* STRING */,
headers: {"Content-type":"multipart/form-data; charset=UTF-8"} /* JSON */,
ignoreSSLErrors: undefined /* BOOLEAN */,
useNTLM: undefined /* BOOLEAN */,
partsToSend: formData /* INFOTABLE */,
workstation: undefined /* STRING */,
useProxy: undefined /* BOOLEAN */,
repository: undefined /* STRING */,
proxyHost: undefined /* STRING */,
url: url /* STRING */,
};
// result: JSON
var result = Resources["ContentLoaderFunctions"].PostMultipart(params);
Here I print out the content which api server received:
Red: If I remove the content of headers, every chinese character will become to "?"
Orange: There's no problem as I use Postman to test the api
Green: the content which api server received will become to nothing as setting the headers
I also try to set headers: {"Content-type":"charset=Big5"} but the result is the same as UTF-8
anyone can help me?
thanks a lot!
Hi @RC_8716579
What version of ThingWorx are you running? Can you provide more detail around your use case? What are you sending it to?
Regards.
--Sharon
The version of Thingworx is 8.4.
In the detail, I write the RESTful API by golang and test it by postman, it seems work normally.
And I want Thingworx to get the data from the API by POST method.
Is it not ok to use form-data ?
Hi @RC_8716579
Do you get any results for non-chinese characters or is it always blank?
Can you clarify what the target and source servers are?
We're going to test this under a recent release as ThingWorx 8.4 is no longer supported.
Regards.
--Sharon
Hi Slangley,
Sorry for the late reply.
We always get the "?" characters while using the "PostMultipart" function to post form-data to our owned APIs.
Our APIs server is just run by simple GET/POST HTTP methods for RESTful services.
Recently we solved this problem by using the "PostJSON" function, it's weird it works with a different function but the same body and server.
Hope that we can find out the problem with the "PostMultipart" function, thank you.
Hi @RC_8716579.
Glad you found a workaround. Is it possible you were working with JSON instead of an infotable? Can you provide the code you used for generating the infotable?
Regards.
--Sharon