# Do automatic https request to update data in my database

**URL:** <https://forum.elixirforum.com/t/do-automatic-https-request-to-update-data-in-my-database/52097>\
**Category:** Questions\
**Tags:** httpoison, http-requests\
**Created:** [November 29, 2022, 11:08am UTC](https://forum.elixirforum.com/t/do-automatic-https-request-to-update-data-in-my-database/52097 "2022-11-29T11:08:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![HelpMeToKeepMyJob](https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/h/a88e4f/32.png) [@HelpMeToKeepMyJob](https://forum.elixirforum.com/u/HelpMeToKeepMyJob)\
**Post date:** [November 29, 2022, 11:08am UTC](https://forum.elixirforum.com/t/do-automatic-https-request-to-update-data-in-my-database/52097/1 "2022-11-29T11:08:42Z")

</div>

Hello guys !  
I just started elixir a couple of days ago but I’m still a total beginner and I need your help to develop my API. Actually, I’m working on a project that must use a third party API ([coinapi.io](http://coinapi.io)) to update some data in my database. Poison seems to be a good candidate to do that but my problem is that I have no clue how to do automatic http requests, I mean where (wich folder, doc) to write my automatic calls and how to make them automatic, let’s say one call each 5 minutes ?

---

<div class="post-metadata">

**Author:** ![LostKobrakai](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lostkobrakai/32/3072_2.png) [@LostKobrakai](https://forum.elixirforum.com/u/LostKobrakai)\
**Post date:** [November 29, 2022, 11:12am UTC](https://forum.elixirforum.com/t/do-automatic-https-request-to-update-data-in-my-database/52097/2 "2022-11-29T11:12:17Z")

</div>

> [@HelpMeToKeepMyJob](#):
>
> I mean where (wich folder, doc) to write my automatic calls

Elixir files can be anywhere within a mix projects `lib/` folder and will work, but it’s common convention to namespace modules by their relative paths.

> [@HelpMeToKeepMyJob](#):
>
> how to make them automatic, let’s say one call each 5 minutes ?

There are various ways of calling functionality on a schedule from more OTP reliant using `Parent.Periodic`, over cron like using `quantum` or db driven using `Oban`. You can also run your own logic with a genserver and e.g. `Process.send_after`.

---

<div class="post-metadata">

**Author:** ![HelpMeToKeepMyJob](https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/h/a88e4f/32.png) [@HelpMeToKeepMyJob](https://forum.elixirforum.com/u/HelpMeToKeepMyJob)\
**Post date:** [November 29, 2022, 11:30am UTC](https://forum.elixirforum.com/t/do-automatic-https-request-to-update-data-in-my-database/52097/3 "2022-11-29T11:30:00Z")

</div>

Thanks for the advices !  
Just to be sure, how my new created file with my code in it can be used ? It’s automaticly used or do I need to call it somewhere (if so where) ?

---

<div class="post-metadata">

**Author:** ![kokolegorille](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/kokolegorille/32/4784_2.png) [@kokolegorille](https://forum.elixirforum.com/u/kokolegorille)\
**Post date:** [November 29, 2022, 2:14pm UTC](https://forum.elixirforum.com/t/do-automatic-https-request-to-update-data-in-my-database/52097/4 "2022-11-29T14:14:55Z")

</div>

> [@HelpMeToKeepMyJob](#):
>
> Poison seems to be a good candidate

You probably mean httpoison, poison is a json decoder/encoder

> [@HelpMeToKeepMyJob](#):
>
> how my new created file with my code in it can be used

It depends… if You use a gen\_server, You need to start it in the supervision tree. Otherwise what You put in lib should be available once compiled…
