Orit
Active member
Hello
I've added a new API endpoint to an addon we use (Snogs Advanced forms).
So far the GET method works as it should.
I am now trying to get the POST method to function.
I have two controller classes:
class Form extends AbstractController
class Forms extends AbstractController
The Forms class fetches a list of forms (actionGet).
I currently don't want to allow creating a form,
but added the actionPost function to see when it gets rendered:
The Form class fetches a specific form (actionGet)
I created a POST method in the Form class, but when I try out the api it keeps reading the POST method in the Forms class,
and I get the expected error for not sending the correct input:
What am I missing?
EDIT: Just to clarify I have added the api scopes in XF: forms:read, forms:write
But I don't know where and when to call them....
I've added a new API endpoint to an addon we use (Snogs Advanced forms).
So far the GET method works as it should.
I am now trying to get the POST method to function.
I have two controller classes:
class Form extends AbstractController
class Forms extends AbstractController
The Forms class fetches a list of forms (actionGet).
I currently don't want to allow creating a form,
but added the actionPost function to see when it gets rendered:
PHP:
public function actionPost()
{
$this->assertRequiredApiInput(['title']);
}
The Form class fetches a specific form (actionGet)
I created a POST method in the Form class, but when I try out the api it keeps reading the POST method in the Forms class,
and I get the expected error for not sending the correct input:
JSON:
{
"errors": [
{
"code": "required_input_missing",
"message": "Required input missing: title",
"params": {
"missing": [
"title"
]
}
}
]
}
What am I missing?
EDIT: Just to clarify I have added the api scopes in XF: forms:read, forms:write
But I don't know where and when to call them....
Last edited: