# HTTP requests

> Using the HTTP/HTTPS Api The HTTP API allows you to send and receive requests from any service or DIY Smart Project to iotBind platform.When issuing a HTTP request, your request must be signed with Device API secret key , and include the request parameters and using the HTTP methods GET OR POST.the base URL for API version 1.0 &nbsp;is : http://api.iotbind.com/v1/&nbsp;&nbsp;

> To generate a API key , click on the key icon After adding the device And Click on the refresh icon To generate a new key Any time.

> URL API : http://api.iotbind.com/v1/tank.php

| Parameter | Value | Description |
| --- | --- | --- |
| method | "POST" or "GET"&nbsp; | For How you want to send data ,Only Value "post" or "get"Always use it&nbsp; |
| uid | Device UniqueID | Always use it |
| key | Encrypted key | Device API secret keyAlways use it&nbsp; |
| cmd | One of these:"on""off""get""ping" | only use one of these commands when you send a requests to iotbind"on" If you want to send on Command to Device Switch"off" If you want to send off Command to Device Switch"get" If you want get all device data frome iotBind platform"ping" If you want send ping Command to iotBind platform to learn that the device is connected |
| level | numbers | Use it only for update Tank level |
| temperature | numbers | (optional) Use it only for update Tank temperature |

Example: if you need to update Tank level and temperature and send "on" Command to Switch integrated with device by URL link "GET method":http://api.iotbind.com/v1/tank.php?method=get&amp;key={DeviceKay}&amp;uid={UniqueID}&amp;cmd=on&amp;level={numbers}&amp;temperature={numbers}

replace:{DeviceKay} = API Device Kay{UniqueID} = Device UniqueID{numbers} = any Data you need

Output json Data :

&nbsp;&nbsp;

```json
{"MESSAGE":"UPDATED"}
```

* temperature and switch Command (cmd= on or off) is an optional if you need to update temperature or switch status if the switch integrated with the device

Example: if you need to get tank data by "GET method":http://api.iotbind.com/v1/tank.php?method=get&amp;key={DeviceKay}&amp;uid={UniqueID}&amp;cmd=get&nbsp;&nbsp;

replace:{DeviceKay} = API Device Kay{UniqueID} = Device UniqueID

Output json Data :&nbsp;&nbsp;

```json
{
    "uid": "UniqueID",
    "name": "DeviceName",
    "type": "Water Level",
    "cmd": "on",
    "level": "67",
    "level_unit": "%",
    "temperature": "21",
    "temperature_unit": "C"
}
```

Example: if you need to update Tank level and temperature and send "off" Command to Switch integrated with device by URL link "POST method":http://api.iotbind.com/v1/tank.php

Send POST data with request:

method=postuid=UniqueIDkey=DeviceKaycmd=offlevel=numberstemperature=numbers

Output json Data :

&nbsp;&nbsp;

```json
{"MESSAGE":"UPDATED"}
```

* temperature and switch Command (cmd= on or off) is an optional if you need to update temperature or switch status if the switch integrated with the device&nbsp;&nbsp;

Example: if you need to get Tank level data by "POST method:http://api.iotbind.com/v1/tank.php

Send POST data with request:method=postuid=UniqueIDkey=DeviceKaycmd=get

Output json Data :

&nbsp;&nbsp;

```json
{
   "uid": "UniqueID",
   "name": "DeviceName",
   "type": "Water Level",
   "cmd": "on",
   "level": "67",
   "level_unit": "%",
   "temperature": "21",
   "temperature_unit": "C"
}
```

If you want send "ping" Command to iotBind platform to learn that the device is connected by URL link "POST method":http://api.iotbind.com/v1/tank.php

Send POST data with request:method=postuid=UniqueIDkey=DeviceKaycmd=ping

Output json Data :&nbsp;&nbsp;

```json
{"MESSAGE":"PING OK"}
```

If you want send "ping" Command to iotBind platform to learn that the device is connected by URL link "GET method":http://api.iotbind.com/v1/tank.php?method=get&amp;key={DeviceKay}&amp;uid={UniqueID}&amp;cmd=ping

replace:{DeviceKay} = API Device Kay{UniqueID} = Device UniqueID

Output json Data :

&nbsp;&nbsp;

```json
{"MESSAGE":"PING OK"}
```

