Aimeos Create an new extension and Api in it.
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
- TEJASPARMAR
- Posts: 15
- Joined: 20 Mar 2024, 11:53
Aimeos Create an new extension and Api in it.
I want to create a new Api inside the extension I have created and installed on my store.
I can call Api but cannot call Post Api and pass data to the Api.
Any suggestions or examples for the are appreciated.
PHP version : 8.1.28
AIMEOS version : 2022.10.9
Environment : Linux
I can call Api but cannot call Post Api and pass data to the Api.
Any suggestions or examples for the are appreciated.
PHP version : 8.1.28
AIMEOS version : 2022.10.9
Environment : Linux
Last edited by TEJASPARMAR on 31 May 2024, 09:23, edited 1 time in total.
Re: Aimeos Create an new extension and Api in it.
Can you provide some more information?
Which Aimeos version do you use?
What API do you want to extend?
Please post examples of your GET and POST requests and responses.
Which Aimeos version do you use?
What API do you want to extend?
Please post examples of your GET and POST requests and responses.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
- TEJASPARMAR
- Posts: 15
- Joined: 20 Mar 2024, 11:53
Re: Aimeos Create an new extension and Api in it.
Get Api : http://local.aimeos/jsonapi/punchoutsso
Response: message printed in get function of standard.php file
Post: http://local.aimeos/jsonapi/punchoutsso
Response: Page Expired.
I want to call the post method and pass JSON data to the function on the post.
AIMEOS version : 2022.10.9
Response: message printed in get function of standard.php file
Post: http://local.aimeos/jsonapi/punchoutsso
Response: Page Expired.
I want to call the post method and pass JSON data to the function on the post.
AIMEOS version : 2022.10.9
- TEJASPARMAR
- Posts: 15
- Joined: 20 Mar 2024, 11:53
Re: Aimeos Create an new extension and Api in it.
AIMEOS version : 2022.10.9TEJASPARMAR wrote: ↑01 Jun 2024, 09:14 Get Api : http://local.aimeos/jsonapi/punchoutsso
Response: message printed in get function of standard.php file
Post: http://local.aimeos/jsonapi/punchoutsso
Response: Page Expired.
I want to call the post method and pass JSON data to the function on the post.
AIMEOS version : 2022.10.9
Re: Aimeos Create an new extension and Api in it.
For POST/PATCH/DELETE requests, you have to include the "_token" parameter with the Laravel X-CSRF-TOKEN value.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
- TEJASPARMAR
- Posts: 15
- Joined: 20 Mar 2024, 11:53
Re: Aimeos Create an new extension and Api in it.
OK, Thanks for the reply.
Can you guide me on how to get a token in an Aimeos?
Can you guide me on how to get a token in an Aimeos?
Re: Aimeos Create an new extension and Api in it.
First, make sure you send the session cookie with each request: https://aimeos.org/docs/latest/frontend ... i/baskets/
Then, in every response of the JSON:API, there's a "meta" section with a "csrf" sub-section containing the token name and value: https://aimeos.org/docs/latest/frontend ... the-basket
Then, in every response of the JSON:API, there's a "meta" section with a "csrf" sub-section containing the token name and value: https://aimeos.org/docs/latest/frontend ... the-basket
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
- TEJASPARMAR
- Posts: 15
- Joined: 20 Mar 2024, 11:53
Re: Aimeos Create an new extension and Api in it.
Thanks, it is working now.
The post method is also working with CSRF TOKEN.
now, I want to add a redirection code in "public function get"
public function get( ServerRequestInterface $request, ResponseInterface $response ) : \Psr\Http\Message\ResponseInterface
{
//code**********
return redirect()->intended('/');
}
If I am using this, It is now allowing me to redirect.
Can you please suggest, how can we redirect from there?
The post method is also working with CSRF TOKEN.
now, I want to add a redirection code in "public function get"
public function get( ServerRequestInterface $request, ResponseInterface $response ) : \Psr\Http\Message\ResponseInterface
{
//code**********
return redirect()->intended('/');
}
If I am using this, It is now allowing me to redirect.
Can you please suggest, how can we redirect from there?
Re: Aimeos Create an new extension and Api in it.
You shouldn't send a redirect in a JSON:API response because it violates the JSON:API specs. Instead, return the redirect URL in the meta section of the response or as "next" link so the client can care about.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
- TEJASPARMAR
- Posts: 15
- Joined: 20 Mar 2024, 11:53
Re: Aimeos Create an new extension and Api in it.
Can we create a page in an extension?
if yes.
How can we create a page and define its route in an extension only?
if yes.
How can we create a page and define its route in an extension only?