tables icon indicating copy to clipboard operation
tables copied to clipboard

[Question] Need more information about the API

Open boddedo opened this issue 1 year ago • 1 comments

Hello !

I have a question about the Documentation for the API, there is something I don't understand. The name of the app we need to install is: OCS API Viewer so, I think it's just something to only "read the API"

so, if we want to write a new information into a column of a specific table, How to do it ?

Regards.

boddedo avatar Jan 02 '25 16:01 boddedo

Writing Data to Tables API

While the OCS API Viewer is for reading the API documentation, you can use any HTTP client (like cURL, Postman, or your own code) to write data to tables.

Writing to Columns

To change the value of a column, use the example below.

❗ Note that you need to use "" around column IDs in request bodies, even though the column IDs don't have them in response bodies.

PUT {{baseUrl}}/index.php/apps/tables/api/1/rows/{{rowId}}`
  {
      "data": {
        "{{columnId}}": "String Value",
        "{{columnId}}": 42
      }
  }

Getting Column IDs

Before writing, you'll need the column IDs. Get them using either of these requests:

GET {{baseUrl}}/index.php/apps/tables/api/1/tables/{{tableId}}/scheme
GET {{baseUrl}}/index.php/apps/tables/api/1/tables/{{tableId}}/rows

The documentation with all available endpoints can be found here: https://petstore.swagger.io/?url=https://raw.githubusercontent.com/nextcloud/tables/main/openapi.json

vimoi avatar Jan 02 '25 21:01 vimoi