API to write to EK-TM4C1294XL


#1

Hello,

I have successfully connected board(EK-TM4C1294XL ) code(qs_iot) with exosite.

I can control the board button ON OFF state from dashboard UI in ti.exosite.com

Now I need to develop a mobile app which can directly control the ON OFF led state on board without using ti.exosite.com UI, It would be great if you provide the API documentation and other important things I need to follow to successfully control

Regards
Lokesh


#2

Hi @Lokesh,

This documentation for Exosite’s legacy platform does exist, it is just behind a couple pages. Here is a link to it directly. Your mobile app can use your Portals user auth to talk to Portals resources. Appending to datasource data is going to be the way that you write to the state resource of the qs_iot application.

Have you had a chance to try connecting your device to Murano? The One Platform and Portals stack is our legacy platform and we are not often making updates to it. If you want the latest Exosite software, I would use Murano.

Instead of having to use the Portals API and how it thinks about resources, you could use the much more elastic Murano custom API gateway service.

Feel free to post back if you have questions – I am happy to help,
-Martin


#3

I tried to GET response form API’s but I am getting ‘Forbidden’ response

So, I tried Permission object still I am getting Forbidden response

{
“access”: ,
“oid”: {
“id”: ,
“type”:
}
}

curl 'https://ti.exosite.com/api/portals/v1/users/001ab602a40c' \
     -X PUT \
     -d '{"permissions":[{"access":"d_update","oid":{"type":"Device","id":"37be872400000000000000000000000000000000"}}]}' \
     -u 'lokesh@email.com:mypassword' \
     -i

001ab602a40c - MAC address and alias
37be872400000000000000000000000000000000 - my CIK

I don’t know where I am wrong

please help in this regard,any kind of help is appreciable


#4

@Lokesh

Whew, there are a few strange things going on in this Portals API request. Let’s focus on the three main things stand out as to why the Portals server could not make sense of this request.

 curl 'https://ti.exosite.com/api/portals/v1/users/001ab602a40c' \
     -X PUT \
     -d '{"permissions":[{"access":"d_update","oid":{"type":"Device","id":"37be872400000000000000000000000000000000"}}]}' \
     -u 'lokeshbr12@gmail.com:mypassword' \
     -i
  • You are calling a user endpoint but are passing a device identifier.
  • You are attempting to add a domain permission object to a user regarding a device.
  • Instead of using a device identifier in the request body, you are using an authentication token.

If I had to guess, my impression is that you were trying to grant yourself access to this device. Don’t worry, you won’t need to do this, because your user account probably owns this device.

Let’s start with an easier request; Let’s fetch some dataport data:

curl 'https://ti.exosite.com/api/portals/v1/data-sources/2bafb54e964aece3e1eabe784f0fdb8bb2e9385b/data' \
     -X GET \
     -u 'lokesh@email.com:mypassword' \
     -i

2bafb54e964aece3e1eabe784f0fdb8bb2e9385b is the Resource Identifier(AKA, RID.) of your junction temperature resource. An RID is just the unique name of a resource inside Exosite’s One Platform. Without proper auth, there isn’t much anyone can do with that information. Putting your user auth in the example request I made above should allow you to fetch that resource’s data.

For your reference I edited your post to obfuscate your email address and CIK. I have yet to run into people abusing the public information on this forum, but it is possible. That CIK is the master key to your device and people could do whatever they wanted to it, more details can be found in the pinned post below:

I would seriously consider re-generating a new CIK as-soon-as-possible.

You also probably don’t want people to scrape your email address on this forum.

Happy to help,
-Martin


#5

How can I know the RID of Led to make it ON and OFF also to which api I should make a call

Where can I find RID for Led1


#6

There are a number of ways to find the RID of a resource, but the best ways are through the Portals UI on the data details page or through our Command Line tool called Exoline.

Since you want to write data, you will want to use the ‘Appending to datasource data’ API I mentioned earlier.

-Martin


#7

Hello Martin,

Thank you for the reply.

curl 'https://ti.exosite.com/api/portals/v1/data-sources/95d6d81606744cc38520fc9a5d6b2d0996ab4ac5/data' \
     -X GET \
     -u 'lokesh@email.com:mypassword' \
     -i

RID for LED1 95d6d81606744cc38520fc9a5d6b2d0996ab4ac5

Above api works fine,then I tried to write 1 to LED1 by ussing below API

curl 'https://ti.exosite.com/api/portals/v1/data-sources/95d6d81606744cc38520fc9a5d6b2d0996ab4ac5/data' \
     -X POST \
     -d '1000' \
     -u 'useremail@gmail.com:userP4ssword' \
     -i

but I am getting ‘{“code”:400,“message”:“Bad Request”}’ response.

please help me in this regard.


#8

@Lokesh - are you sure that you are sending what you pasted on the forum? That append data to datasource call looks just right to me. Could one of the characters be incorrectly encoded before it is sent?