Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

458
Views
No relational fields in response Strapi v4

I have a problem where none of the relational fields are present in the responses after fetching my data. When I look to the schema of one of my schemas with a relation, I see that the relational fields are present in the attributes object. But still I only get the non-relational fields in my response.

This is one of my schemas

{
  "kind": "collectionType",
  "collectionName": "activities",
  "info": {
    "singularName": "activity",
    "pluralName": "activities",
    "displayName": "activity"
  },
  "options": {
    "draftAndPublish": true
  },
  "pluginOptions": {},
  "attributes": {
    "name": {
      "type": "string"
    },
    "date": {
      "type": "date"
    },
    "subcategory": {
      "type": "relation",
      "relation": "oneToOne",
      "target": "api::subcategory.subcategory"
    },
    "members": {
      "type": "relation",
      "relation": "manyToMany",
      "target": "api::member.member",
      "inversedBy": "activities"
    }
  }
}
about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

In Strapi v4 relations are not populated when fetching entries by default.

Explaination:

Queries can accept a populate parameter to explicitly define which fields to populate, with the following syntax:

GET /api/:pluralApiId?populate=field1,field2

Example request: Get books and populate relations with the author's name and address

GET /api/books?populate=author.name,author.address

For convenience, the * wildcard can be used to populate all first-level relations:

Example request: Get all books and populate all their first-level relations

GET /api/books?populate=*

Example request: Get all books and populate with authors and all their relations

GET /api/books?populate[author]=*

Note: Only first-level relations are populated with populate=*. Use the LHS bracket syntax (i.e. [populate]=*) to populate deeper:

Example request: Get all relations nested inside a "navigation" component in the "global" single type

GET /api/global?populate[navigation][populate]=*

Solution:

Change your API url to one of the following and you should be able to see the related fields populated in the response.

GET /api/activities?populate=subcategory,members

OR

GET /api/activities?populate=*

Reference:

  • Relations Population
about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!