# Guide to RESTful Webservices

**URL:** <https://discourse.julialang.org/t/guide-to-restful-webservices/70350>\
**Category:** Web Stack\
**Tags:** question, package\
**Created:** [October 25, 2021, 7:03pm UTC](https://discourse.julialang.org/t/guide-to-restful-webservices/70350 "2021-10-25T19:03:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![vmuser](https://avatars.discourse-cdn.com/v4/letter/v/f4b2a3/32.png) [@vmuser](https://discourse.julialang.org/u/vmuser)\
**Post date:** [October 25, 2021, 7:03pm UTC](https://discourse.julialang.org/t/guide-to-restful-webservices/70350/1 "2021-10-25T19:03:13Z")

</div>

My company is currently switching our core application from Python to Julia. The application is used as a RESTful web service by other internal web services which are exposed to our clients.

Everything goes smooth so far but what I am missing is a request validation. In Python we used [Marshmallow](https://marshmallow.readthedocs.io/en/stable/) to serialize the requests and more importantly to validate them. In my opinion this validation made our code base much cleaner as we had a clear separation between actual logic and preparation.

So I was looking for a similar package in Julia and could not find anything. JSON3.jl is great for serializing but does not provide a validation. Does anyone of you know a suitable package? Otherwise I was thinking about starting an opensource project for that.

The other thing is that I was missing a summary in how to get a web service running in Julia. There are several tutorials that describe parts of it like how to set up a RESTful API Server with HTTP.jl, use Revise for developing etc. Other things I did not find, for example how to use PackeCompier.js with Docker so you can build containers with Sysimages and make them ready almost immediately if you need to scale up fast.

I guess this would be useful for a lot of companies or other users that want to switch to Julia as we are surely not alone with these “problems”. Does anyone know a nice blog or a book or anything that covers this? Otherwise I could start writing such a guide if there’s interest.

---

<div class="post-metadata">

**Author:** ![cjdoris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cjdoris/32/213133_2.png) [@cjdoris](https://discourse.julialang.org/u/cjdoris)\
**Post date:** [October 25, 2021, 8:29pm UTC](https://discourse.julialang.org/t/guide-to-restful-webservices/70350/2 "2021-10-25T20:29:23Z")

</div>

JSON3 already has some pretty powerful validation built in, since it can read JSON directly to a struct: [Home · JSON3.jl](https://quinnj.github.io/JSON3.jl/stable/#Read-JSON-into-a-type)

This means the types encountered while parsing JSON are necessarily validated. If you need to validate the values further, I suppose that could be done in the constructor of the struct.

---

<div class="post-metadata">

**Author:** ![vmuser](https://avatars.discourse-cdn.com/v4/letter/v/f4b2a3/32.png) [@vmuser](https://discourse.julialang.org/u/vmuser)\
**Post date:** [October 26, 2021, 6:40am UTC](https://discourse.julialang.org/t/guide-to-restful-webservices/70350/3 "2021-10-26T06:40:34Z")

</div>

Yes, I’m talking about further validation like minimum/maximum values, default values, etc. But honestly I did not spend too much time yet on that topic so maybe JSON3 + validating in the constructor will do the trick. I am a bit hesitant because I feel like too much validation in the constructor might get a bit messy, but I’ll give it a try. Otherwise I’ll think of an extension of JSON3.

---

<div class="post-metadata">

**Author:** ![MarcMush](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marcmush/32/18006_2.png) [@MarcMush](https://discourse.julialang.org/u/MarcMush)\
**Post date:** [October 26, 2021, 7:44am UTC](https://discourse.julialang.org/t/guide-to-restful-webservices/70350/4 "2021-10-26T07:44:28Z")

</div>

There is [JSONSchema.jl](https://github.com/fredo-dedup/JSONSchema.jl) but I never tried it

---

<div class="post-metadata">

**Author:** ![vmuser](https://avatars.discourse-cdn.com/v4/letter/v/f4b2a3/32.png) [@vmuser](https://discourse.julialang.org/u/vmuser)\
**Post date:** [October 26, 2021, 9:15am UTC](https://discourse.julialang.org/t/guide-to-restful-webservices/70350/5 "2021-10-26T09:15:09Z")

</div>

Thanks, I’ll have a look at it!

---

<div class="post-metadata">

**Author:** ![sashmit](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sashmit/32/18791_2.png) [@sashmit](https://discourse.julialang.org/u/sashmit)\
**Post date:** [October 26, 2021, 12:09pm UTC](https://discourse.julialang.org/t/guide-to-restful-webservices/70350/6 "2021-10-26T12:09:23Z")

</div>

I found the microservices tutorial by @quinnj (the author of JSON3) very helpful myself.

[![](https://global.discourse-cdn.com/julialang/original/3X/1/e/1ef7b902f014c5ae9be536e442880ce1ad15c41b.jpeg "JuliaCon 2020 | Building Microservices and Applications in Julia") ](https://www.youtube.com/watch?v=uLhXgt_gKJc)

---

<div class="post-metadata">

**Author:** ![vmuser](https://avatars.discourse-cdn.com/v4/letter/v/f4b2a3/32.png) [@vmuser](https://discourse.julialang.org/u/vmuser)\
**Post date:** [October 28, 2021, 6:21am UTC](https://discourse.julialang.org/t/guide-to-restful-webservices/70350/7 "2021-10-28T06:21:03Z")

</div>

That’s a very nice tutorial! I had something similar in mind, but in text form.
