Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

506
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda