Play By iDev

API DOCS v1.1

Documentation for the API of iDev Games HTML5 Game Platform

Saving Data


Introduction

When it comes to a database. Its primary purpose is to allow you to save data into it and to then retrieve that data. As we need data to be able to retrieve it you should run through this section first.

So what we will be doing in this section is sending data to an end point allowing the data to be saved as a new row in the database.

For you to be able to do this you will need to setup a table and add some columns to that table winthin gameDB.


Creating a New Row

data/add

This endpoint will allow you to save data as a row to a table.

Parameters

Parameters to pass with your request.

You will need to specify which table you would like to save to. This requires that the table is set to a user edited table in the table settings within Game DB (The table name will be blue if set correctly instead of white) as only user edited tables are allowed to be saved to through the API. This means you will need to be logged in as a user to make a request. You will have to specifiy the columns you want to fill. Any columns within the table not specified will be saved with null by default.

Specify the table name that you would like to post the data to. The column parameter name must be the same as your column's name equal to the value you would like to set, E.g name=John.

Responses

These are the responses you can expect to receive depending on the outcome. Success Unauthorized No table specified No table found

Example

See how in this javascript example.

In the below example you must first make a table called "exampleTable" with a linked column called "exampleColumn" and "exampleColumn2" within Game DB.




Editing an Existing Row

data/edit

This endpoint will allow you to edit a rows value for a specific column.

Parameters

Parameters to pass with your request.

You will need to specify which table you would like to edit, which column and which row by id. The row being edited must belong to the user that your logged in as.

Specify the table name that you would like to edit the data of. Specify the column name that you would like to edit the value of. Specify the row id that you would like to edit. Specify the value to change to.

Responses

These are the responses you can expect to receive depending on the outcome. Success Unauthorized Row either does not exist or does not belong to this user Row not specified Column not found Column not specified Table not found No table or value specified

Example

See how in this javascript example.

In this example I'm expecting for you to have run through the last example. Check Game DB for the row ID and let's attempt to change the value of column "columnValue2".




Removing a Row

data/remove

This endpoint will allow you to remove a row for a user.

Parameters

Parameters to pass with your request.

You will need to specify which table you would like to edit and which row by id. The row being edited must belong to the user that your logged in as.

Specify the table name that you would like to edit the data of. Specify the row id that you would like to edit.

Responses

These are the responses you can expect to receive depending on the outcome. Success Unauthorized Row either does not exist or does not belong to this user Row not specified Table not found No table specified

Example

See how in this javascript example.

In this example I'm expecting for you to have run through the new row example. Check Game DB for the row ID and let's attempt to delete this row.




RETRIEVING DATA >

Back to top