Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Posting data into magento. #85

Closed
vimal-360 opened this issue Apr 11, 2022 · 1 comment
Closed

Posting data into magento. #85

vimal-360 opened this issue Apr 11, 2022 · 1 comment

Comments

@vimal-360
Copy link

Hello.

I am trying to post categories to magento using laravel. I found that this post, put, delete methods are protected. I can not use. Is there any other way? or why it is protected

$magento->api('categories')->post('/',$categoryArray);
  /**
     * Send a POST request with query parameters.
     *
     * @param  string  $path
     * @param  string  $parameters
     * @return \Illuminate\Http\Client\Response
     */
    protected function post($path, $parameters = [])
    {
        return $this->checkExceptions(Http::withToken($this->magento->token)
            ->post($this->apiRequest.$path, $parameters), $this->apiRequest.$path, $parameters);
    }
@ahinkle
Copy link
Member

ahinkle commented Apr 11, 2022

Hi @vimal-360,

We currently don't have active support on that post endpoint. Only to pull all (index via GET) categories; feel free to send a PR.

The protected post method is intentional; these are for custom endpoints. I would not recommend your method for making API calls. Please refer to the documentation. If you need a workaround for posting to categories, you could use Laravel's HTTP client to make a post request to your endpoint.

Something like this:

$response = Http::post('http://my-magento-shop.com/rest/default/V1/categories/', $payload);

Thanks

@ahinkle ahinkle closed this as completed Apr 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants