Single Record query alway return null data

Hi all,

I’m new to 8base and I’m having an issue with returning a single record query like so:

{
post(id:1) {
title
body
}
}

{
peopleType(id:1) {
name
}
}

{
“data”: {
“peopleType”: null
}
}

But I know I have data in database. Please help, anyone encounter this?

Thanks
Sophek

Hi @sophek,

How are you running these queries? Are you using 8base API Explorer?
Also, 8base has system field for ID, and it is not integer, see below

and correct query is:

{
  post(id: "ck13d8cjj03ii01mo9era6e7h") {
    title
    body
  }
}

please replace “ck13d8cjj03ii01mo9era6e7h” with your id.

Also, what are you tried to do using this query?. See below:

{
    peopleType(id:1) {
        name
    }
}

To learn more about our GraphQL API, please see documentation https://docs.8base.com/8base-console/graphql-api

I see, thanks for clarfying that. So in order to create my own ID, I would have to name it PostID or something and manange the PostID number myself, I don’t see a way to auto increment this number. Aslo to make a field filterable, it has to be a unique value?

Thanks for your help.
Sophek

Also in the doc. any unique value? when I create a field of type text, I can filter on that value, but if I make a field of type Number, I can’t even though it’s unique.

  • tableName(...) - Accepts id and any unique value as an argument to retreive a single record from the database.

Auto-generated queries

Whenever a table is added to a work space, two GraphQL query operations are auto-generated for the table. They are:

  • tableName(...) - Accepts id and any unique value as an argument to retreive a single record from the database.

  • tableNameList(...) - Accepts filter , sort , skip , after , before , first and, last to retrive a list of curated records while supporting pagination, relational-filtering, sorting, and more.

8base tables already have system unique ID’s. The field is not visible in Data Viewer by default, but you could enable it’s visibility in “selected fields”, see below

For sure you could create your own field, but there are no auto-increment.
I don’t know what your case is, but in most cases system ID field is enough.

If 8base system ID field is not enough for your needs, please share your case, and I will think about how to develop that better.

yeah. That’s system field ID I’m talking about