# Talking with a rest api

**URL:** <https://discourse.dojo.io/t/talking-with-a-rest-api/322>\
**Category:** Dojo 2+ users\
**Created:** [November 19, 2018, 5:02pm UTC](https://discourse.dojo.io/t/talking-with-a-rest-api/322 "2018-11-19T17:02:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SimonScholz](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dojo.io/simonscholz/32/63_2.png) [@SimonScholz](https://discourse.dojo.io/u/SimonScholz)\
**Post date:** [November 19, 2018, 5:02pm UTC](https://discourse.dojo.io/t/talking-with-a-rest-api/322/1 "2018-11-19T17:02:55Z")

</div>

Hi guys,

I followed your tutorials and I’d love to create a spa, which is capable of getting its data from a rest backend.  
In another topic Dylan mentioned your fetch api, but I cannot find any tutorials or documentation for that.

I’ve been using Dojo 1 about 5 years ago a lot and was really happy that Dojo 2 , 3, 4 finally came out after such a long time.

What I am trying to accomplish first is to create a login page, which is capable getting a jwt token by using an /auth rest end point by sending a username/password json request body and getting back a jwt token in the server response body.  
Then I want to use this token to send it as “Authorization Bearer ${token}” header for certain rest api calls, which need authorization.

Can you give me an example on how to achieve this?

As I said, I already had a look at your tutorials, but these lack the point about the fetch api for getting data from a rest backend.  
And I also cloned the examples from [https://github.com/dojo/examples](https://github.com/dojo/examples) and had a look at the realworld example, which seems to have a login, but to me it seems like this realworld app is not really talking to a backend, right?

Looking forward to get some guidance.

---

<div class="post-metadata">

**Author:** ![uberintj](https://avatars.discourse-cdn.com/v4/letter/u/47e85d/32.png) [@uberintj](https://discourse.dojo.io/u/uberintj)\
**Post date:** [December 4, 2018, 7:14pm UTC](https://discourse.dojo.io/t/talking-with-a-rest-api/322/2 "2018-12-04T19:14:06Z")

</div>

I’ve been interested in this topic as well for a UI redesign I’m planning. From what I can find, this [answer](https://discourse.dojo.io/t/dojo2-and-nodejs/253) addresses it succinctly. In short, use the standard fetch API calls to do the networking (interacting with your RESTful service) and Dojo stores to do the data management client-side (a store with fetch calls built into it?). I guess the build system will generate an app that works on browsers that do not support fetch yet, but I’m hoping someone more familiar will corroborate this as true.
