1

Flespi PHP or ANY CURL POST - Store Latitude and Longitude of device

Тема: Flespi PHP or ANY CURL POST - Store Latitude and Longitude of device

Hi,

I am developing a Mobile App and reading current location with latitude and Longitude.

I would like to send the location details to flespi using API curl(PHP).


Please suggest with an example.

2

Flespi PHP or ANY CURL POST - Store Latitude and Longitude of device

Re: Flespi PHP or ANY CURL POST - Store Latitude and Longitude of device

Hello, you can use HTTP channel for that - https://flespi.com/protocols/http
all you need is just create a channel operated over HTTP protocol and send your request in the way like

curl -X POST -d '[{"ident":"1234","position.latitude":52,"position.longitude":48}]' 'http://gw.flespi.io:123456'

method: POST
data: json array of json objects. required field is ident string. other naming parameters may be custom (or take it from any protocol, like this is the list for Teltonika parameters - https://flespi.com/protocols/teltonika#parameters)
target: the URI of your HTTP channel

3

Flespi PHP or ANY CURL POST - Store Latitude and Longitude of device

(31/10/2018 17:05:25 отредактировано venujakku)

Re: Flespi PHP or ANY CURL POST - Store Latitude and Longitude of device

Hi Thank you Very much for Quick response.

Can you please guide to how to find ident and Chanel values

curl -X POST -d '[{"ident":"XXXXX","position.latitude":52,"position.longitude":48}]' 'http://gw.flespi.io:XXXXXXXXXXXXX'

and How to pass the authentication token.


Thank you in Advance.

Sample Image attached my channel details. But , I am unable to understand http://gw.flespi.io:XXXXXXXXXXXXX

4

Flespi PHP or ANY CURL POST - Store Latitude and Longitude of device

Re: Flespi PHP or ANY CURL POST - Store Latitude and Longitude of device

venujakku, in channel you do not need token to POST messages.

gw.flespi.io:XXX => this is URI of your channel with http protocol.

ident - any custom unique device identifier

Follow us on http://www.facebook.com/Gurtam
And take a look at new IoT backend by Gurtam.
5

Flespi PHP or ANY CURL POST - Store Latitude and Longitude of device

Re: Flespi PHP or ANY CURL POST - Store Latitude and Longitude of device

Hi,
I am using url like below
http://193.193.165.37:29983

But, Unable to connect the above url getting error message (Attached image)

I can share the https://flespi.com login and password details to resolve this issue.

6

Flespi PHP or ANY CURL POST - Store Latitude and Longitude of device

Re: Flespi PHP or ANY CURL POST - Store Latitude and Longitude of device

venujakku,
You can post messages only to channel with protocol "http".
After you create this channel you will get its uri in format 193.193.165.37:SomePort
Then you may send messages using HTTP POST request to http://193.193.165.37:SomePort

Another thing is that you are trying to send data encoded as form-data (according your last screenshot) but this is wrong.
Please send raw data in JSON array format like in baja post: [{"ident":"1234","position.latitude":52,"position.longitude":48}]

You may note that it's possible to send several messages per one HTTP POST request.

Developer
flespi team