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

Publish service data using service bus (pub/sub)

MM_9023322
14-Alexandrite

Publish service data using service bus (pub/sub)

Hi all,

 

I wanted to know how we can publish TWX service data using Azure Service bus?

 

Thank you

 

@PEHOWE @PaiChung @slangley 

7 REPLIES 7

@MM_9023322,

Have you reviewed the Knowledge Base Article: Article - CS361442 - Publishing data to an Azure Service Bus from ThingWorx Platform

 

MM_9023322
14-Alexandrite
(To:PEHOWE)

@PEHOWE,

Thank you for the response, I have gone through that article, but I am not able to understand how to establish the connectivity. I have a service(on THX) that gives me JSON output coming from the content loader, GetJSON, now how do I publish that JSON data to the Azure service bus. How to establish connectivity? Is there any example available for reference?

@MM_9023322.

 

The ThingWorx has been designed to create a REST API to the services. This will allow you to execute a REST API from outside ThingWorx and get the results of a service. As a tool to getting the parameter information correct I would recommend using POSTMAN. https://www.postman.com/

 

I have placed a list of the articles relating to the POSTMAN and REST API. 

 

Which side are you looking to start the interaction? If you are starting the interaction from ThingWorx then you can use the Content Loader Functions. The POSTMAN tool is great in that it provides a easer method of reviewing the errors which may be reported if the parameters are not correct. Once you have the parameters using POSTMAN the information can then be used to create the REST API call from ThingWorx.

If you are trying to extract information from ThingWorx, I would start with using POSTMAN to make a REST API call to ThingWorx and then transfer the information into the calling application.

Let me know where you are in the process and I will try to provide a more specific example.

 

Regards

Peter

 

 

 

 

MM_9023322
14-Alexandrite
(To:PEHOWE)

Hi @PEHOWE,

 I don't want to use any 3rd party, I want to publish my data from Thingworx to Azure Service Bus, to do so, I am making use of content loader functions in Thingworx, but I am not aware of how to put the URLs and where to put URLs on Azure service bus topic.

 

MM_9023322
14-Alexandrite
(To:MM_9023322)

Hi @PEHOWE,

I am using PutJSON, and in headers 
var headers = {
"Resource group": "Resource Group Name",
"Content-Type": "application/json",
"Accept": "application/json" ,
"RootManageSharedAccessKey" : "Access Key"
};

 

and in url using the topic  url.

For this I am getting status 400!
What I am doing wrong? What should be the header format? 

@MM_9023322

 

The tool POSTMAN is a developer tool. It is intended to allow testing and experiment with different parameter options in an environment where access to the error messages is better. 

If you are using the ThingWorx ContentLoaderFunctions you can get a list of the parameters by going to the following location in composer:

 

Browse -> System -> Resources -> ContentLoaderFunctions -> Services -> 

For example GetJSON has the following parameters:

 

The above REST API will extract a JSON result from the URL/Username/Password <etc>

 

MM_9023322
14-Alexandrite
(To:PEHOWE)

Hi @PEHOWE ,

I was using the wrong credentials for connecting with the azure service bus. Can you please help me in understanding how to generate SAS token Key using JAVA? I am referring to This. But I am totally lost how we can generate SAS token for REST API.

 

Thank you!

Top Tags