Answers.Body: <p>There's currently no method to parse variables into the feed itself through this, or any means. Typically, we approach this as feeds being third-party, or otherwise non-editable. How would you see utilising <code>issueNumber</code> to work in this scenario?</p>
  
  <p>You can use the concept of aliases in your URL if that helps?</p>
  
  <p>Lastly, you could also make use of the (undocumented) <code>Datatype::EVENT_AFTER_FETCH_FEED</code> event to perform any parsing on the feed once its been fetched?</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-07T20:46:17.977Z
Answers.Text: It turned out the way I was thinking about this didn't really make sense – I was hoping that I could use another plugin to edit the feed URL before starting it, essentially pulling data from a different URL each time. I ended up handling that bit in the other plugin by making a local copy of the changing file each time so that Feed Me could point to the local version reliably.
Answers.UserDisplayName: jtenclay
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-07T20:47:21.383Z
Answers.Text: I think using aliases probably would have been a more straightforward way, so I'm definitely going to use that suggestion in the future
Answers.UserDisplayName: jtenclay
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-04T14:06:22.223Z
Answers.LastActivityDate: 2018-05-04T14:06:22.223Z
Answers.UserDisplayName: crawf
Answers.Body: <p>Feed Me supports this but the setting isn't turned on by default.</p>
  <ol>
  <li>Create an feed-me.php file under your /config directory</li>
  <li>Turn on the parseTwig option using:</li>
  </ol>
  <pre><code>&lt;?php
  
  return [
      '*' =&gt; [
          'parseTwig' =&gt; true
      ]
  ];
  </code></pre>
  <ol start="3">
  <li>You can now use twig variables in the default value field eg. if issueNumber is a field and the field is being populated by your feed you can set the default to <code>http://some-url.com/{issueNumber}</code></li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-31T15:37:20.810Z
Answers.LastActivityDate: 2022-08-31T15:37:20.810Z
Answers.UserDisplayName: Mike Niland
Answers.Body: <p>Depending on what sort of dynamic data you need in your Feed URL (I needed the current date), you could also do this via the <code>feed-me.php</code> config file.</p>
  <pre><code>'feedOptions' =&gt; [
      '3' =&gt; [
          'feedUrl' =&gt; $someDynamicFeedUrl,
      ]
  ],
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-12-19T21:53:57.330Z
Answers.LastActivityDate: 2023-12-19T21:53:57.330Z
Answers.UserDisplayName: Alex Kendrick
Body: <p>I'm trying to import posts using the Feed Me plugin. I'd like to make a dynamic URL so that I can access the feed from a Cron job or from elsewhere in the CP. It says in the docs that I can use environment variables inside the Feed URL, but it isn't working for me. Am I using them the wrong way?</p>
  
  <p>My Feed URL (not working):</p>
  
  <p><code>http://some-url.com/{{issueNumber}}</code></p>
  
  <p>Apart from environment variables, is there some other way to pass variables into Feed Me? The client won't have direct access to the Feed Me plugin and therefore won't be able to manually edit the URL each time.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-15T19:51:02.053Z
Comments.Text: Update: I've updated my code so that this is no longer necessary, but I'm leaving the question up in case someone can use it in the future.
Comments.UserDisplayName: jtenclay
Tags: <plugin-development><plugin-feedme><environmentvariables>
Title: Using a dynamic url with Feed Me
ThreadText: # Using a dynamic url with Feed Me
  
  (Asked by: username_0 on 2018-01-15)
  
  I'm trying to import posts using the Feed Me plugin. I'd like to make a dynamic URL so that I can access the feed from a Cron job or from elsewhere in the CP. It says in the docs that I can use environment variables inside the Feed URL, but it isn't working for me. Am I using them the wrong way?
  
  My Feed URL (not working):
  
  `http://some-url.com/{{issueNumber}}`
  
  Apart from environment variables, is there some other way to pass variables into Feed Me? The client won't have direct access to the Feed Me plugin and therefore won't be able to manually edit the URL each time.
  
  **Tags:** plugin-development, plugin-feedme, environmentvariables
  
  > **Comments:**
  > **username_0**: Update: I've updated my code so that this is no longer necessary, but I'm leaving the question up in case someone can use it in the future.  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2018-05-04. Score: 3 | Accepted answer
  
  There's currently no method to parse variables into the feed itself through this, or any means. Typically, we approach this as feeds being third-party, or otherwise non-editable. How would you see utilising `issueNumber` to work in this scenario?
  
  You can use the concept of aliases in your URL if that helps?
  
  Lastly, you could also make use of the (undocumented) `Datatype::EVENT_AFTER_FETCH_FEED` event to perform any parsing on the feed once its been fetched?
  
  > **Comments:**
  > **username_0**: It turned out the way I was thinking about this didn't really make sense – I was hoping that I could use another plugin to edit the feed URL before starting it, essentially pulling data from a different URL each time. I ended up handling that bit in the other plugin by making a local copy of the changing file each time so that Feed Me could point to the local version reliably.  
  > **username_0**: I think using aliases probably would have been a more straightforward way, so I'm definitely going to use that suggestion in the future  
  
  ---
  
  ### Answer by username_2 on 2022-08-31. Score: 1
  
  Feed Me supports this but the setting isn't turned on by default.
  
  1. Create an feed-me.php file under your /config directory
  2. Turn on the parseTwig option using:
  
  ```
  <?php
  
  return [
      '*' => [
          'parseTwig' => true
      ]
  ];
  
  ```
  
  3. You can now use twig variables in the default value field eg. if issueNumber is a field and the field is being populated by your feed you can set the default to `http://some-url.com/{issueNumber}`
  
  
  ---
  
  ### Answer by username_3 on 2023-12-19. Score: 0
  
  Depending on what sort of dynamic data you need in your Feed URL (I needed the current date), you could also do this via the `feed-me.php` config file.
  
  ```
  'feedOptions' => [
      '3' => [
          'feedUrl' => $someDynamicFeedUrl,
      ]
  ],
  
  ```
  
  
  ---
  
  