<p>I don't think this is possible with feed me itself</p>
<p>configuration options are here: <a href="https://docs.craftcms.com/feed-me/v4/get-started/configuration.html#control-panel" rel="nofollow noreferrer">https://docs.craftcms.com/feed-me/v4/get-started/configuration.html#control-panel</a>
maybe forking feed-me repo and changing requests to POST is a solution</p>
<p>but there are two other solutions:</p>
<ul>
<li>fetching result as JSON from API via custom PHP code, upload it to the server and use this JSON file as feed input</li>
<li>writing a custom plugin:</li>
</ul>
<p>you should have a custom controller and action which it has logic to fetch JSON data from API via CURL and return it like:</p>
<blockquote>
<pre><code>   return $this-&gt;asJson([
        'jsonData' =&gt; $jsondata,
        'hasNext' =&gt; $hasNext, // optionally if there are a lot of data and your API supports data pagination
    ]);
</code></pre>
</blockquote>
<p>remember you should register this controller action on your plugin as a site URL, so feed me can access this URL</p>
<pre><code>Event::on(
    UrlManager::class,
    UrlManager::EVENT_REGISTER_SITE_URL_RULES,
    function(RegisterUrlRulesEvent $event) {
        $event-&gt;rules['plugin-handler/controllername/actionname'] = 'plugin-handler/controllername/actionname';
    }
);
</code></pre>
<p>finally, if this plugin is not on your local, you need to provide some basic authentication like a token over HTTPS on your action.
in this case, your feed URL is like <code>https://yoirsite/plugin-handler/controllername/actionname?token=xyz</code> and you should validate this token before returning data via action</p>

CC BY-SA 4.0
2022-12-17T19:48:54.340Z
Thank you for your detailed answer! I guess that makes sense. Will give that a go.
Marcus Scheller
CC BY-SA 4.0
2022-12-17T16:43:16.507Z
2022-12-17T17:02:08.030Z
2022-12-17T17:02:08.030Z
user9975
<p>I am trying to import data but the remote API only allows <code>POST</code> requests for this endpoint. I have looked into the docs as well as Guzzle but can’t seem to find info on how to change the request method to <code>POST</code>.</p>
<p>Craft Version is 3.7.61 and Feed Me Version is 4.5.3</p>
<p>Could anyone point me in the right direction? Thanks!</p>

<craft3><plugin-feedme>
(Feed Me) Request Method
# (Feed Me) Request Method

(Asked by: username_0 on 2022-12-16)

I am trying to import data but the remote API only allows `POST` requests for this endpoint. I have looked into the docs as well as Guzzle but can’t seem to find info on how to change the request method to `POST`.

Craft Version is 3.7.61 and Feed Me Version is 4.5.3

Could anyone point me in the right direction? Thanks!

**Tags:** craft3, plugin-feedme


---

## 1 answers

### Answer by username_1 on 2022-12-17. Score: 1 | Accepted answer

I don't think this is possible with feed me itself
configuration options are here: https://docs.craftcms.com/feed-me/v4/get-started/configuration.html#control-panel
maybe forking feed-me repo and changing requests to POST is a solution
but there are two other solutions:

fetching result as JSON from API via custom PHP code, upload it to the server and use this JSON file as feed input
writing a custom plugin:

you should have a custom controller and action which it has logic to fetch JSON data from API via CURL and return it like:

   return $this->asJson([
        'jsonData' => $jsondata,
        'hasNext' => $hasNext, // optionally if there are a lot of data and your API supports data pagination
    ]);


remember you should register this controller action on your plugin as a site URL, so feed me can access this URL
Event::on(
    UrlManager::class,
    UrlManager::EVENT_REGISTER_SITE_URL_RULES,
    function(RegisterUrlRulesEvent $event) {
        $event->rules['plugin-handler/controllername/actionname'] = 'plugin-handler/controllername/actionname';
    }
);

finally, if this plugin is not on your local, you need to provide some basic authentication like a token over HTTPS on your action.
in this case, your feed URL is like https://yoirsite/plugin-handler/controllername/actionname?token=xyz and you should validate this token before returning data via action

> **Comments:**
> **username_0**: Thank you for your detailed answer! I guess that makes sense. Will give that a go.  

---

