Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NocoDB random table identifier on V2 API Spec #7879

Closed
MoeDawood15 opened this issue Mar 16, 2024 · 4 comments
Closed

NocoDB random table identifier on V2 API Spec #7879

MoeDawood15 opened this issue Mar 16, 2024 · 4 comments

Comments

@MoeDawood15
Copy link

Hi Noco Team

Hope all is well

I have a quick question regarding the v2 API

I noticed table names are masked with a random value , is this a security feature ?

http://localhost:8080/api/v2/tables/**mgngz7s2d6igiyi**/records

Is there no way I can get data by using my actual table name instead of the random ID generated ?

http://localhost:8080/api/v2/tables/addresses/records

@dstala
Copy link
Member

dstala commented Mar 17, 2024

@MoeDawood15 Use of table name in v2 APIs is deprecated. We did notice lot of messed up routes due to complex character sets on field & table names - and hence decided to go with only ID based routes.

@dstala dstala closed this as completed Mar 17, 2024
@salim-b
Copy link
Contributor

salim-b commented Mar 19, 2024

Is there no way I can get data by using my actual table name instead of the random ID generated ?

@MoeDawood15 You can use the meta API to retrieve the mapping of table names <-> IDs.

@mystica555
Copy link

@salim-b I'm not understanding what I am reading at your link.
Can you please explain, perhaps via example of an api call, how to do what you say is possible?

@salim-b
Copy link
Contributor

salim-b commented May 2, 2024

@salim-b I'm not understanding what I am reading at your link.

You're reading the meta API documentation, specifically the section about the List Tables endpoint that allows to "List all tables in a given base". 😉

The JSON response to such an API call will include a list objects that is an array with a metadata object per table in the specified base. Every such metadata object includes i.a. the two fields id and table_name. These two should allow you to derive a table's ID from its name. 😉

An example response (for a base with a single table) looks as follows:

{
  "list": [
    {
      "id": "md_5hua2iqloqirhd",
      "source_id": "ds_jxuewivwbxeum2",
      "base_id": "p_tbhl1hnycvhe5l",
      "table_name": "nc_b84e___Sheet-1",
      "title": "Sheet-1",
      "type": "table",
      "meta": null,
      "schema": null,
      "enabled": true,
      "mm": false,
      "tags": null,
      "pinned": null,
      "deleted": null,
      "order": 1,
      "created_at": "2023-03-11T09:11:45.907Z",
      "updated_at": "2023-03-11T09:11:45.907Z"
    }
  ],
  "pageInfo": {
    "isFirstPage": true,
    "isLastPage": true,
    "page": 1,
    "pageSize": 10,
    "totalRows": 1
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants