Entry is saved but the data is not saved in Strapi 4 Content-type

System Information
  • Strapi Version: 4.2.0
  • Operating System: Windows 10
  • Database: Sqlite
  • Node Version: 16.17.1
  • NPM Version: 8.15.0
  • Yarn Version:

I am learning Strapi in version 4. Through strapi admin, I have created a content type named “Events” and created some entries. These entries, which I created in strapi admin, are perfectly saved and committed to the backend sqlite database.

But, when I make a post request through my programme, the entry is saved but data is not saved. Or even when I make a post request through postman, the entry is saved but the data is not saved in the new entry.

My javascript programme reads as under:


const axios = require(‘axios’)
const URL =‘http://localhost:1337/api/events

const obj = {
data : {
attributes: {
name: ‘test’,
venue : ‘town hall’,
address : ‘test’,
date : ‘2022-11-20’,
time : ‘10 pm’,
performers : ‘test’,
description : ‘test from js programme’,
user : ‘test’
}
}
}

axios({
method: ‘post’,
url: URL,
data: obj
}).then((res)=>console.log(res.data)).
catch ((err)=> console.log(err.message))

/* response received is as under with
status code 200 on strapi server side

{
data: {
id: 57,
attributes: {
name: null,
slug: null,
venue: null,
address: null,
date: null,
time: null,
performers: null,
description: null,
createdAt: ‘2022-11-10T13:24:26.335Z’,
updatedAt: ‘2022-11-10T13:24:26.335Z’,
publishedAt: ‘2022-11-10T13:24:26.332Z’
}
},
meta: {}
}

*/


---
**Surprisingly, the strapi backend console displays response code 200. The entry is saved, but the data is not saved in content type.**

All CRUD permissions for content type "Events" are public. I am not in a position to figure out what I am doing wrong here.

Community, please help me, in my learning.