Problem setting relation by ID

I have this call which is being fired and the user-notification-key entry is being created with the subscription field correct. Its supposed to be adding a relation to a user by its ID. There exists a user with ID 1. ``` const subscriptionSaved = await $fetch(
http://localhost:1337/api/user-notification-keys”,

      {
        method: "POST",
        body: {
          data: {
            subscription: pushSubscription,
            // users_permissions_user: this.$auth.user.id,
            users_permissions_user: 1,
          },
        },
      },
    )```

What’s the issue here?

This topic has been created from a Discord post (1222519249285812305) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord

You need the find permission to be able to set relations but you’ll also want a route policy to properly lock down the actual find api route you enable.

Ok that worked for the above, but I’m trying to do something similar in an entityservice.

Create an Entry with a relation to a User. I need to change permissions to enable entityservice requests? I have enabled find on both the Entry Collection in question and User and its still not being set.

This is within a cron-job so should be happening serverside and therefore requires no permission to be set

    data: {
      title: data.title,
      body: data.options.body,
      metadata: data.options.metadata,
      users_permissions_users: 1, 
      sent: sent
    }
  })```

ok fixed it. this users_permissions_users shouldnt be pluralised

if you are using the entityService you’ll want to use the UID

you can find those with the command yarn strapi content-types:list