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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

sigfox downlink

pjoly
12-Amethyst

sigfox downlink

I am using Sigfox extension and it works fine for uplink.

I have read in documentation that downlink is not supported I don't really understand why :

I am using it simply outside Thingworx just by answering using a JSON message with the device ID and payload to send to sigfox when receiving a GET callback

(cgi-bin / python script)

exemple :{"FFFFF":{"downlinkData":"4142434441424344"}}

I am trying to use the "setDownlinkMessage" without success

I don't know what to put in "message" and "thingName" input, I tried many things but always (invalid payload in Sigfox logs)

Thanks for help

Pascal

ACCEPTED SOLUTION

Accepted Solutions
pjoly
12-Amethyst
(To:pjoly)

solution given by support and working for me :

What is needed is to get results formatted as JSON. Two things are needed to make that happen:

  1. The service invoked needs to have the return basetype set as JSON.
  2. When you do the REST request (POST) to invoke the service you need to include the header: Accept: application/json. This can be included as a HTTP header or as an url parameter.

So, when you configure the downlink in Sigfox, you need to include this Accept=application/json in your url parameter.

Also, you may have to enable disable Filter Content-Type under PlatformSubsystem in TWX.

View solution in original post

5 REPLIES 5
pjoly
12-Amethyst
(To:pjoly)

In order to investigate, I have uploaded the extension into Eclipse java.

I cannot find any java code, just xml structures in the extension.

My question :

where can I find the code associated to  the POST request send by SIGFOX in order to put the right json message in the answer ?

https://myserver/Thingworx/Things/Sigfox.CallbackInterface/Services/CallbackDataBatch?appKey=mykey&batch={batch}

Thanks

pjoly
12-Amethyst
(To:pjoly)

hello

nobody is using Sigfox with thingworx who could help me to fix this downlink issue or should I re-developp a new one ??

Is this extension developped by Sigfox or by Thingworx ?

Thanks

Do1
10-Marble
10-Marble
(To:pjoly)

Have you perhaps found a solution yet?

pjoly
12-Amethyst
(To:Do1)

hello

still no solution !!

it works fine using a python script but not from Thingworx when I'm trying to return the downlink message

Sigfox API is requesting a Json to be returned when the POST procedure is executed:

{

  "device_id" : { "downlinkData" : "deadbeefcafebabe"}

}

the problem is that when using "result" in Thingworx API I cannot return this simple json

var downlink  = '{ "' + device + '" : { "downlinkData" : "' + "deadbeefcafebabe" + '" }}'

var result=  JSON.parse(downlink);

I tested with postman

my python script :

raw

{"F0A62":{"downlinkData":"4142434441424344"}}

Content-Type: text/html; charset=utf-8

<head>

</head>

<body>

OK

</body>

pretty

{

    "F0A62": {

        "downlinkData": "4142434441424344"

    }

}

Thingworx return using result :

<HTML><HEAD><TITLE>ThingWorx&#x3a; Thing com.thingworx.things.ConfiguredThing&#x40;4ab6f80c &#x3a; Response From Execution Of CallbackData</TITLE><LINK rel='Stylesheet' href='/Thingworx/css/thingworxapi.css' type='text/css'></LINK><META http-equiv='Content-Type' content='text/html'></META><META http-equiv='cache-control' content='no-cache, no-store'></META><META http-equiv='expires' content='-1'></META><META http-equiv='pragma' content='no-cache, no-store'></META></HEAD><BODY><IMG SRC="/Thingworx/images/ThingworxLogo.png"/><BR/><H1>CallbackData</H1><TABLE><TR><TH>result</TH></TR><TR><TD>&#x7b;&quot;F0A62&quot;&#x3a;&#x7b;&quot;downlinkData&quot;&#x3a;&quot;deadbeefcafebabe&quot;&#x7d;&#x7d;</TD></TR></TABLE></BODY></HTML>

pretty

<HTML>

    <HEAD>

        <TITLE>ThingWorx&#x3a; Thing com.thingworx.things.ConfiguredThing&#x40;4ab6f80c &#x3a; Response From Execution Of CallbackData</TITLE>

        <LINK rel='Stylesheet' href='/Thingworx/css/thingworxapi.css' type='text/css'></LINK>

        <META http-equiv='Content-Type' content='text/html'></META>

        <META http-equiv='cache-control' content='no-cache, no-store'></META>

        <META http-equiv='expires' content='-1'></META>

        <META http-equiv='pragma' content='no-cache, no-store'></META>

    </HEAD>

    <BODY>

        <IMG SRC="/Thingworx/images/ThingworxLogo.png"/>

        <BR/>

        <H1>CallbackData</H1>

        <TABLE>

            <TR>

                <TH>result</TH>

            </TR>

            <TR>

                <TD>&#x7b;&quot;F0A62&quot;&#x3a;&#x7b;&quot;downlinkData&quot;&#x3a;&quot;deadbeefcafebabe&quot;&#x7d;&#x7d;</TD>

            </TR>

        </TABLE>

    </BODY>

</HTML>

of course this is not well interpreted by Sigfox ....

pjoly
12-Amethyst
(To:pjoly)

solution given by support and working for me :

What is needed is to get results formatted as JSON. Two things are needed to make that happen:

  1. The service invoked needs to have the return basetype set as JSON.
  2. When you do the REST request (POST) to invoke the service you need to include the header: Accept: application/json. This can be included as a HTTP header or as an url parameter.

So, when you configure the downlink in Sigfox, you need to include this Accept=application/json in your url parameter.

Also, you may have to enable disable Filter Content-Type under PlatformSubsystem in TWX.

Announcements


Top Tags