I try to setup a section-plugin, where editors can create a page and publish by one click.
The creation already works. Unfortenetly i can’t set the state to listed.
I always get a 404 error:
message: "No route found for path: \"pages/messages+test123/status\" and request method: \"POST\""
There is no diffenrence, if i do get or post. Which one would be right?
What am i doing wrong?
Common question: Is it possible to set the status while creation?
create() {
let content = {
text: 'testtext'
};
this.$api
.post('pages/messages/children', { slug: 'test123', title: 'test123-title', template: 'message', content: content })
.then(response => {
// response.id: "messages/test123"
this.deploy(response.id);
})
.catch(error => {
console.log('error', error)
});
},
deploy(id) {
this.$api
.post('pages/' + id.replace('/', '+') + '/status', { 'status': 'listed' })
.then(response => {
console.log(response);
})
.catch(error => {
console.log('error', error)
});
}
Beside of the status, i have some minor issues while creating the page.
The new Page ignores the title, and takes the slug as the title, but if i add the title to the content-array, it works.
Furthermore as far as i can see, the template is required, otherwise it stops with an error "Undefined array key “template”
Am i doing something wrong here too? I thought by the docu, title has to be part of the post parameters and template is not required…
Thx!