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

499
Views
Strapi How to link relations between collections REST API

Strapi v4, postgres.

I have two collections Sprites and Tags and I want to link those collections throught REST API when I creating a new Sprite entry. I have a simple API endpoint which is firing strapi.controller('api::sprite.sprite').create(), but I cant understand how can I specify relation to Tags. I tried many various variants but nothing not worked for me.

For example:

{
    "data": {
    "tags": [1, 2],
    }
}

As I understand right I need to specify Tag's ID, as said at documentation but its not worked for me. If I create a new entry from Content Manager and specify relation manually its works good.

Also I tried to open all permissions to Tag collection

Sprites:

{
  "kind": "collectionType",
  "collectionName": "sprites",
  "info": {
    "singularName": "sprite",
    "pluralName": "sprites",
    "displayName": "Sprite",
    "description": ""
  },
  "options": {
    "draftAndPublish": true
  },
  "pluginOptions": {},
  "attributes": {
    ...
    "tags": {
      "type": "relation",
      "relation": "manyToMany",
      "target": "api::tag.tag",
      "inversedBy": "sprites"
    }
  }
}

And Tags:

{
  "kind": "collectionType",
  "collectionName": "tags",
  "info": {
    "singularName": "tag",
    "pluralName": "tags",
    "displayName": "tag"
  },
  "options": {
    "draftAndPublish": true
  },
  "pluginOptions": {},
  "attributes": {
    "name": {
      "type": "string"
    },
    "sprites": {
      "type": "relation",
      "relation": "manyToMany",
      "target": "api::sprite.sprite",
      "inversedBy": "tags"
    }
  }
}
about 4 years ago · Juan Pablo Isaza
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!