#Api Access to Custom View Data

1 messages · Page 1 of 1 (latest)

crimson python
#

I am trying to use an alternative system for Campaigns. I am not sure if twenty will have solution for Campaigns (mass email solution etc.).

So my idea was to get the view data outside of a custom list Or to get all people and reconstruct the filtering.

What did i check:

I can create a custom view in people page and i can find the view in the api.

I can not get the records.

I did find that based on viewName and the view api the viewId.
i can find the filters applied.
Then in the filters i can see that a filter applied to a field (specific fieldmetadataId) should contain a value (and i see the value also) but i do not know the name of the field in the api. Also in the api for the viewFields you have the same metadataId but you do not have a name.
So i can not get All people and find the fields that i need to apply the filters.
Any idea?

balmy plinth
#

From what I see, neither GraphQL nor REST API expose the name of fields so until someone exposes it in code, there's no way to find out which field is which only from API

balmy plinth
#

But you can do it indirect way, since Twenty renders tables with fields using fieldMetadataId, you can get view's all fields with this query in GraphQL and looking up directly in React components of table with Chrome extension, you can match given fieldMetadataId with field's name

query MyQuery {
  getCoreViews {
    id
    name
    viewFields {
      fieldMetadataId
      id
    }
  }
}
#

Annoying way I admit but that's the only way I can think of

#

And about solutions for campaigns, Twenty will have them in the future

crimson python
#

so if i do only a direct native query in the db i can get the info. But trying to do this with n8n means that i need to connect also to db. Am i correct?

balmy plinth
#

Don't think so since table "viewField" doesn't contain the name of field

crimson python
#

but in the database there is also no field name in the viewfield table.

#

exactly this means that i did not understand your proposal

#

is the name in your query the view name? this is ok i know this and i can get the fields with the metadataID and i know for each metadata field the filter and each value

#

i do not know when i get all people which fieldmetadataID belongs to each column in the query from the API to connect them

balmy plinth
crimson python
#

then it is not enough. how the field name is store if it is not in the db directly

balmy plinth
#

Field name is stored in database in core."fieldMetadata", to fetch it from API you can do it with metadata API using /fields (this contains names of fields) and /viewFields (this contains info which fields are in which views)

crimson python
#

then i can do a query also from there to get the data

#

or i can make a view in db but it will be probably broken in next update

balmy plinth
#

You can do query to get data but I'd say creating view via API is safer

crimson python
#

/fields does not exist in api from what i see. i am watching the api page

balmy plinth
#

There is

crimson python
balmy plinth
#

You have to switch to metadata, not core API

crimson python
#

aaa ok

#

i was searching for object and field

#

and i could not find them

#

let me check

balmy plinth
#

There was a migration from core to metadata some time ago

crimson python
#

So i need to get from CORE { view, view filter, view fields } and then from Metadata { fields , objects }

balmy plinth
#

I think you can get all of them from metadata

crimson python
#

the view and view filter and viewfields in metadata are empty

balmy plinth
#

They shouldn't be empty, which version are you selfhosting?

crimson python
#

let me check

#

1.3.0
2025-08-11T00:00:00.000Z

balmy plinth
#

Okay, then in your case that should work

crimson python
#

since in workspace schema and core schema the view table exists . is there any difference when the software saves the view inside the workspace and when it saves it in core?

#

i assume that since always there is a workspace then everything goes in workspace except some generic things. but can the user by his/her actions have any impact?

balmy plinth
#

Just to be safe, it's better to do it in core in your case

crimson python
#

ok i will have to do only probably fields and object get from the metadata

crimson python
#

if i am trying with graphQL can i get the views and the fields in views from core and then the names of fields from metadata in one query?

balmy plinth
#

No as you're reaching out to 2 different endpoints aka /core and /metadata