Skip to content

When used in a relational feild, Strapi v4 does not seem to populate it in the find rest api #30

@karlmoubarak

Description

@karlmoubarak

heyo, thanks for this great work. It's helped a lot.

I'm buillding an api for some livestream events and using assets uploaded with the mux video uploader in a relational field for each event. Event is a collection type.
Screenshot 2022-03-15 at 09 28 31

When i use the strapi rest API to findone event and populate it's 'recording' field, everything works as expected:
/api/events/dfdfg?populate[0]=messages&populate[1]=recording
( here i am replacing the findOne controller with a custom one to use slugs instead of ids. But this shouldn't affect population since params are passed on normally ).

{
	"data": {
		"id": 2,
		"title": "dfdfg",
		"slug": "dfdfg",
		"starts": "2022-01-31T23:00:00.000Z",
		"ends": "2022-01-30T23:00:00.000Z",
		"marquee": "The Hmm || ",
		"info": null,
		"backgroundColor": "rgb(255,255,255)",
		"showViewerCount": null,
		"allowFlyingEmoji": true,
		"highlightDonateButton": false,
		"chatPlaybackDelay": null,
		"createdAt": "2022-02-21T22:34:25.313Z",
		"updatedAt": "2022-03-15T08:23:21.968Z",
		"publishedAt": "2022-02-28T15:23:46.867Z",
		"messages": {
			"data": []
		},
		"recording": {
			"data": {
				"id": 3,
				"title": "another test now",
				"upload_id": "F01FV5mDewtEWcukyzhjHmgnoHZpfTRC1W5VSUfF70228",
				"asset_id": "wlip7KeikzLQnjCMur6yXk6Je7rC3ha2pr5GQiwdV7M",
				"playback_id": "PB26fp01hHuI6jwmLEFfY3RYmWmEfS011bcPKs2pNeEDA",
				"error_message": null,
				"isReady": true,
				"createdAt": "2022-03-09T10:38:57.635Z",
				"updatedAt": "2022-03-09T10:39:23.683Z"
			}
		}
	}
}

However, when i use the rest API to findmany events and populate the 'recording' field, it doesn't work:
api/events?populate[0]=messages&populate[1]=recording

{
	"data": [
                 {
                    ...
                },
		{
			"id": 2,
			"title": "dfdfg",
			"slug": "dfdfg",
			"starts": "2022-01-31T23:00:00.000Z",
			"ends": "2022-01-30T23:00:00.000Z",
			"marquee": "The Hmm || ",
			"info": null,
			"backgroundColor": "rgb(255,255,255)",
			"showViewerCount": null,
			"allowFlyingEmoji": true,
			"highlightDonateButton": false,
			"chatPlaybackDelay": null,
			"createdAt": "2022-02-21T22:34:25.313Z",
			"updatedAt": "2022-03-15T08:23:21.968Z",
			"publishedAt": "2022-02-28T15:23:46.867Z",
			"messages": {
				"data": []
			}
		},
		{
		   .....	
		}
	]
}

I was thinking of posting this issue to strapi but it looks like populating works for all other fields (as you can see with 'messages' field).

Is it because of the type of relation? Am I missing something? Maybe I did something wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions