System Information
- Strapi Version: 4.11.1
- Operating System: Google Cloud Run SaaS
- Database: PostgreSql
- Node Version: v18.16.0
- NPM Version: 9.6.2
- Yarn Version: -
When making a post/put request to an entity using the Strapi API, the webhook generated does not include the data related to the relation entity. However, when performing the same operation using the UI, the relation data is present in the webhook. You can see the relationpopulates configuration below.
Config File: "…\Cms\Techcareer.StrapiCms\config\server.js"
module.exports = ({ env }) => ({
//url: env("PUBLIC_URL", "http://localhost:8080"),
host: env('HOST', '0.0.0.0'),
port: env.int('PORT', 8080),
app: {
keys: env.array('APP_KEYS'),
},
webhooks: {
// Add this to not receive populated relations in webhooks
populateRelations: true,
},
});
Sample Request: Location is related entity
Post: {{baseUrl}}/strapicms/api/companies
{
"data": {
"name": "Name Test",
"description": "test desc test desctest desctest desctest desctest desctest desctest desc",
"logo": "http://www.asd.com",
"location": 5
}
}
API Response:
Post: {{baseUrl}}/strapicms/api/companies
{
"data": {
"id": 15,
"attributes": {
"name": "Name Test",
"logo": "http://www.asd.com",
"description": "test desc test desctest desctest desctest desctest desctest desctest desc",
"createdAt": "2023-06-13T08:09:11.987Z",
"updatedAt": "2023-06-13T08:09:11.987Z"
}
},
"meta": {}
}
Triggerred Webhook: Location is null
It automatic triggerred from strapi but location value doesnt have.
{
"event": "entry.create",
"createdAt": "2023-06-13T08:32:55.708Z",
"model": "company",
"uid": "api::company.company",
"entry": {
"id": 19,
"name": "Paşa Test6",
"logo": "http://www.asd.com",
"description": "test desc test desctest desctest desctest desctest desctest desctest desc",
"createdAt": "2023-06-13T08:32:53.249Z",
"updatedAt": "2023-06-13T08:32:53.249Z"
}
}
API Populeted Request: It has location entity
Get: {{baseUrl}}/strapicms/api/companies/:id?populate=location
{
"data": {
"id": 15,
"attributes": {
"name": "Name Test",
"logo": "http://www.asd.com",
"description": "test desc test desctest desctest desctest desctest desctest desctest desc",
"createdAt": "2023-06-13T08:09:11.987Z",
"updatedAt": "2023-06-13T08:09:11.987Z",
"location": {
"data": {
"id": 5,
"attributes": {
"name": "Ağrı / Türkiye",
"country": "Türkiye",
"city": "Ağrı",
"phoneCountryCode": "+90",
"createdAt": "2023-03-14T00:00:00.000Z",
"updatedAt": "2023-03-14T00:00:00.000Z"
}
}
}
}
},
"meta": {}
}