cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Making HTTP requests with PostText, username/password fields

ptc-6607495
1-Newbie

Making HTTP requests with PostText, username/password fields

I am attempting to make OAuth Request/Response calls using PostText (need to send content) but am unable to get a valid authentication.  There is the username and password parameters, but these don't seem to be translating into the needed format.


I need my user authentication to be passed in the format of "username:password" and have tried various combinations with the parameter fields.  


As an example, using this with curl, I would pass the authentication as part of the -u parameter as "username:password"


Any help or pointers would be appreciated.



3 REPLIES 3

Is the username/password fields not submitted as HTTP Authentication?

Why not creating Application Key for user you want and use it like this:


'

<a rel="nofollow noreferrer" target="_blank" href="http://www.google.com/url?q=http%3A%2F%2F46.242.130.58%3A8080%2FThingworx%2FThings%2FBaseStation1%2FServices%2FStoreValues%3Fmethod%3Dpost%26appKey%3D04bcb63f-3030-4813-a83f-0f92f735901e%27&amp;sa=D&amp;sntz=1&amp;usg=AFQjCNFE9EEAM3qOPDnkFRh4BP3b4rCWlg" class="Xx" dir="ltr" style="unicode-bidi: -webkit-isolate; font-family: arial, sans-serif; font-size: 13px;">http://123.456.789.012:8123/Thingworx/Things/TrainStation/Services/UniqueServiceName?method=post&amp;appKey=07xxxx8e-6060-xxxx-xxxx-0axxxx9105e'</a>


Application Key will work as authentication.



var paramsPost = {
url: encodeURI("http://localhost:8086/write?db=xxxx"),
content: "DB,emplacement=Quai\ du\ commerce x="+x+",x="+x
contentType: "application/x-www-form-urlencoded" /* STRING */
};
//// result: STRING
var result = Resources["ContentLoaderFunctions"].PostText(paramsPost);

 

I have a problem with space not being escaped in my param emplacement. 

Can you help me please.

Announcements


Top Tags