# Self-hosted : I can't get a table record

**URL:** <https://community.nocodb.com/t/self-hosted-i-cant-get-a-table-record/1311>\
**Category:** APIs\
**Created:** [August 23, 2024, 1:17pm UTC](https://community.nocodb.com/t/self-hosted-i-cant-get-a-table-record/1311 "2024-08-23T13:17:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![elect](https://avatars.discourse-cdn.com/v4/letter/e/e480ec/32.png) [@elect](https://community.nocodb.com/u/elect)\
**Post date:** [August 23, 2024, 1:17pm UTC](https://community.nocodb.com/t/self-hosted-i-cant-get-a-table-record/1311/1 "2024-08-23T13:17:32Z")

</div>

I’m trying to update a single field in a record within a table

I create the base, then the columns metadata, with the following primary key

```auto
            "column_name": "Primary Key",
            "title": "Primary Key",
            "uidt": "ID",
            "dt": "int",
            "un": False,
            "pk": True # primary key

```

then I create the table and create the record from some data, using `0` as primary key

Finally, I want to read the record I just created

```auto
    def read_table_record(self, primary_key: int) -> dict:
        url = f"{self.host}/api/v2/tables/{self.tableid}/records/{primary_key}"
        return self.session.get(url).json()

```

But I do get the following:

> {‘error’: ‘RECORD\_NOT\_FOUND’, ‘message’: “Record ‘unknown’ not found”}

Why?

Ps: I double checked, the url resolves properly

---

<div class="post-metadata">

**Author:** ![dstala](https://avatars.discourse-cdn.com/v4/letter/d/f04885/32.png) [@dstala](https://community.nocodb.com/u/dstala)\
**Post date:** [August 23, 2024, 4:39pm UTC](https://community.nocodb.com/t/self-hosted-i-cant-get-a-table-record/1311/2 "2024-08-23T16:39:44Z")

</div>

Could you please confirm if the record was successfully created? Are you able to see created record with ID set to 0 on the NocoDB UI?

* * *

I was able to create a table with specified configuration. And insert a record with ID set to 0 & retrieve it using read record API

---

<div class="post-metadata">

**Author:** ![dstala](https://avatars.discourse-cdn.com/v4/letter/d/f04885/32.png) [@dstala](https://community.nocodb.com/u/dstala)\
**Post date:** [August 23, 2024, 4:51pm UTC](https://community.nocodb.com/t/self-hosted-i-cant-get-a-table-record/1311/3 "2024-08-23T16:51:42Z")

</div>

Can you help us with your base information? I had tried it out in cloud (PG as root DB). You can copy your base info from [here](https://docs.nocodb.com/faqs/#how-to-check-my-project-info-)

---

<div class="post-metadata">

**Author:** ![pranavxc](https://avatars.discourse-cdn.com/v4/letter/p/53a042/32.png) [@pranavxc](https://community.nocodb.com/u/pranavxc)\
**Post date:** [August 24, 2024, 9:25pm UTC](https://community.nocodb.com/t/self-hosted-i-cant-get-a-table-record/1311/4 "2024-08-24T21:25:04Z")

</div>

> [@elect](#):
>
> {‘error’: ‘RECORD\_NOT\_FOUND’, ‘message’: “Record ‘unknown’ not found”}

I tried couple of scenarios and not able to reproduce the issue. And from error it looks like the is id getting passed as **`unknown`** so double check the is passing and try with hardcoded id value.

If you are still facing issue with id value `0` then share the table details and database information. And possibly share a sample curl request or code without any dynamic part.

---

<div class="post-metadata">

**Author:** ![elect](https://avatars.discourse-cdn.com/v4/letter/e/e480ec/32.png) [@elect](https://community.nocodb.com/u/elect)\
**Post date:** [August 26, 2024, 8:19pm UTC](https://community.nocodb.com/t/self-hosted-i-cant-get-a-table-record/1311/5 "2024-08-26T20:19:55Z")

</div>

I don’t know what happened, but now `read_table_record` works flawless

However now I’ve got the same issue trying to update the given record (`pk = 0`)

```auto
        record = self.read_table_record(pk)
        if 'CreatedAt' in record:
            del record['CreatedAt']
        if 'UpdatedAt' in record:
            del record['UpdatedAt']
        if key == 'Primary Key':
            raise ValueError("Primary Key is not overridable")
        record[key] = value
        res = self.update(record)

```

where

```auto
    def update(self, data):
        url = f"{self.host}/api/v2/tables/{self.tableid}/records"
        res = self.session.patch(url, json=data).json()
        return res

```

 ![Screenshot from 2024-08-26 22-11-46](https://canada1.discourse-cdn.com/flex011/uploads/nocodb/original/1X/d5b05e765ca56ef29cb024da488de8e1f1ad14ca.png)

Url looks fine, data as well, primary key is there, I just changed one single field value

Base info:

Node: **v18.5.0**  
Arch: **x64**  
Platform: **linux**  
Docker: **false**  
RootDB: **pg**  
PackageVersion: **0.255.0**

---

<div class="post-metadata">

**Author:** ![elect](https://avatars.discourse-cdn.com/v4/letter/e/e480ec/32.png) [@elect](https://community.nocodb.com/u/elect)\
**Post date:** [August 27, 2024, 11:41am UTC](https://community.nocodb.com/t/self-hosted-i-cant-get-a-table-record/1311/6 "2024-08-27T11:41:52Z")

</div>

Changed to `data=data` in `update` and now I get

> {‘error’: ‘RECORD\_NOT\_FOUND’, ‘message’: “Record ‘0\_\_\_[object Object]’ not found”}

---

<div class="post-metadata">

**Author:** ![pranavxc](https://avatars.discourse-cdn.com/v4/letter/p/53a042/32.png) [@pranavxc](https://community.nocodb.com/u/pranavxc)\
**Post date:** [August 27, 2024, 11:44am UTC](https://community.nocodb.com/t/self-hosted-i-cant-get-a-table-record/1311/7 "2024-08-27T11:44:37Z")

</div>

We found the bug related update api and made a fix in following PR - [Nc fix: Miscellaneous bugs by pranavxc · Pull Request #9348 · nocodb/nocodb · GitHub](https://github.com/nocodb/nocodb/pull/9348)

You can try following pr build to verify the fix.

> docker run -d -p 8888:8080 nocodb/nocodb-timely:0.255.0-pr-9348-20240827-1012
