Photon using parse.com dashboard

Hi all

do you know if its possible to use the Photon with parse.com dashboard? They give a SDK for Arduino Yun and what they call “Linux Embedded C” and “RTOS embedded C”…but don’t know if we are able to use it for photon ?

if yes do you have a kind of tutorial or some tips to begin sending sensor data from the photon to their dashboard ?

thanks in advance for your helpful help.

Heya @perco,

Looks like most of the Parse requests are heavily wrapped in their SDKs and classes. If we could see a raw API reference, I’m guessing it’d be a simple https request to do something like, store data, which you could do easily with something like a webhook.

I hope that helps!

Thanks,
David

Hi everyone,

I am trying to work with Parse, and I have tried to do POST/GET requests with the httpclient and the httpsclient library but it just failed all the time, and I didn’t get why.
If someone here can help me please :smile:

Thanks in advance Particlers :wink:

Hi @Maxime,

Can you gather errors from the http / https library in the serial terminal? Or can you try making your request with a tool like curl first to make sure your request is properly formatted?

Thanks!
David

hmm, I’m guessing maybe you’re calling client.stop too soon? Can you try to receive the response for a time before closing the http client? (Specifically the last one at the end of the loop)

Thanks!
David

Nothing changes even without the client.stop();
And I forgot to said that I got a Hard Fault (1 red flash after the 9).

Using 2048 bit RSA private key
Keys Loaded
New Session key!: 
free memory: 38596
matrixSslNewClientSession:1
free memory 3: 38596
Bytes sent Successfully?!: 90
matrixSslSentData: 0
Sent Successfully?!, everything good
matrixSslGetReadbuf: 6000
HttpClient>	Done before full len 
0
HttpClient>	Done before full len 
0
HttpClient>	Done before full len 
0
HttpClient>	Done before full len 
0
HttpClient>	Done before full len 
0
HttpClient>	Done before full len 
0
HttpClient>	Done before full len 
0
HttpClient>	Done before full len 
7
Received: 7
matrixSslReceivedData: Tx: 7 Len: 2 rc: 6
Fatal alert: %d, closing connection.
FAIL: No HTTP Response
free memory: 38596
matrixSslNewClientSession:-10
New Client Session Failed: Exit

Thanks for your help btw :smile:

Hmm, happy to try and help anyway :slight_smile:

I haven’t played around with the https client lib yet, maybe there this is some kind of SSL key or something this client can’t support. Maybe someone who’s used the lib can chime in and help?

Thanks,
David

Have you heard about another way of using parse cloud ? :smile:

Thanks,
Maxime

Hi @Maxime,

You could always setup a webhook! :slight_smile:

https://docs.particle.io/guide/tools-and-features/webhooks/

Thanks,
David

I’ll have a look at webhooks, thanks @Dave :smile:

Hey @Dave,

I want to use Parse to store some data from a few sensors connected to the photon and then read them from a mobile app. Is a webhook appropriate to this kind of thing ?

In my opinion, webhooks are for the reverse thing, isn’t it ? For sending something to the photon, isn’t it ?

Maxime

Hi @Maxime,

Webhooks can easily do both! They let you trigger a web request to another server on the internet, sending custom data, or retrieving something interesting. Sending data to another service is a great example of how to use a webhook. :smile:

Thanks!
David

1 Like

Hi @Dave,

I’m pretty sure I’m not that far to what I want to do, but I still have some trouble.

I’m trying to do something like this :

  sprintf(publishString, "{ \"test\": %s, \"temp_int_str\": %s, \"temp_ext_str\": %s}", test, temp_int_str, temp_ext_str);

In parse, I have a few columns : test, temp_ext_str and temp_int_str as strings.
In my code, I have those variables :

char test[] = "this is a test";
char temp_ext_str[] = "42";
char temp_int_str[] = "21";

But my parse database is still empty and I don’t get why

How should I do my json file ?
I have something like this :

{
    "eventName": "post_parse",
    "url": "https://api.parse.com/1/classes/Flotty/",
    "requestType": "POST",
    "headers": {
        "X-Parse-Application-Id": "MYAPPID",
        "X-Parse-REST-API-Key": "MYRESTAPIKEY",
        "Content-Type": "application/json"
    },
    "json": {
        "test": "{{test}}",
        "temp_int_str": "{{temp_int_str}}",
        "temp_ext_str": "{{temp_ext_str}}"
    },
    "mydevices": true
}

Btw, can I send a int to parse through the webhook ?

EDIT : I found it, too many “{” in the json file :smile:
But still nothing for the int

EDIT : Forgot the previous edit, it didn’t worked :frowning:

1 Like

Hi @Maxime,

Formatting INT’s in the json payload of a webhook request is still a bit tricky, something I need to fix. Try adding "nodefaults": true, in case parse is sensitive to extra params. Also watch your event feed in the dashboard, or with the CLI to spot any error messages coming back from the request.

Thanks!
David

With "nodefaults": true I have something like this

{"code":111,"error":"invalid type for key temp_ext, expected number, but got string"}

And without those int’s, here is what I have after publishing as name and as data:

hook-response/post_parse/0
{"createdAt":"2015-10-13T16:38:36.779Z","objectId":"hFNGIPEmA2"}

EDIT:

If I type something like this Particle.publish("post_parse", "{\"test\":\"This is a test\"}", 60, PRIVATE); it works pretty well, but if I’m using a string with sprintf, it didn’t.

EDIT 2:
I finaly succed in publishing the strings, but for the Int’s, it’s still WIP :smile:

1 Like