Skip to content

API_Delete

Andre Pawlowski edited this page Jun 7, 2019 · 1 revision

API: Delete

In this document the API to delete GPS data from the server is explained. If you host the server yourself, it is reachable via the delete.php file. If you are using the ChasR service, it is reachable via https://alertr.de/chasr/delete.php.

Table of Contents

Authentication

Each API request requires you to authenticate yourself. The authentication can be done in two ways: send user credentials as HTTP POST parameter or send the session ID with your cookie.

When sending the user credentials as HTTP POST parameter, they have to be provided as the variables user and password. An example looks like the following:

HTTP POST data:
user=MyUsername&password=MySecretPassword

After authenticating via HTTP POST parameter, the server will send you a session ID in a cookie. With the help of this session ID, you can now authenticate without user credentials by just providing the session ID in your cookie.

However, if you do not want to authenticate with the session ID, you can always resort to providing the user credentials via HTTP POST parameter.

Delete Device

This request will delete all stored GPS data for the given device for your user.

This API request needs to also provide an authentication of yourself. How you can authenticate yourself is described in the Authentication section.

The request contains the following HTTP GET parameters:

  • mode has to be provided with the value device in order to delete GPS positions stored for the device for the authenticated user.

  • device has to be provided with the name of the device the GPS data is deleted for.

The response will be provided in JSON format. The code field gives the error code of the request. The different error codes are explained on the Error Codes page.

An example request and response to delete the GPS positions for the device MyOwnDeviceName looks like the following:

Request:
https://alertr.de/chasr/delete.php?mode=device&device=MyOwnDeviceName

Response:
{
    "Code": 0
}

Delete GPS Data

This request will delete one specific stored GPS position for the given device for your user.

This API request needs to also provide an authentication of yourself. How you can authenticate yourself is described in the Authentication section.

The request contains the following HTTP GET parameters:

  • mode has to be provided with the value position in order to delete the specific GPS position stored for the device for the authenticated user.

  • device has to be provided with the name of the device the GPS data is deleted for.

  • utctime has to be provided with the exact UNIX timestamp of the GPS position to be deleted.

The response will be provided in JSON format. The code field gives the error code of the request. The different error codes are explained on the Error Codes page.

An example request and response to delete the GPS position at 5th of May 2018 20:00:00 for the device MyOwnDeviceName looks like the following:

Request:
https://alertr.de/chasr/delete.php?mode=position&device=MyOwnDeviceName&utctime=1525550400

Response:
{
    "Code": 0
}
Clone this wiki locally