1
00:00:00,210 --> 00:00:07,050
All right, and once we can create the job as well as get all jobs, why don't we set up that token

2
00:00:07,050 --> 00:00:08,610
dynamically in the postman?

3
00:00:08,970 --> 00:00:13,980
Because as we'll be creating more users and, of course, add more functionality, it's going to get

4
00:00:14,280 --> 00:00:19,870
annoying quite fast if we'll have to copy and paste each and every time that token value.

5
00:00:20,430 --> 00:00:25,670
And first, what I did is I served the request we get on jobs one.

6
00:00:26,010 --> 00:00:27,330
And as you can see, that's the name.

7
00:00:27,350 --> 00:00:30,720
And of course, I saved it in Jobs API.

8
00:00:31,020 --> 00:00:36,780
And as far as the setup, it's going to go something like this where we'll start in login user and then

9
00:00:36,780 --> 00:00:38,520
we'll repeat the same in register.

10
00:00:38,790 --> 00:00:43,740
But for the time being, I just don't want to worry about setting up those unique emails.

11
00:00:44,040 --> 00:00:50,220
So let's go over here where we have the login user and we're looking for a test and we just need to

12
00:00:50,220 --> 00:00:52,010
add a little bit of code.

13
00:00:52,380 --> 00:00:55,560
First, we want to access the responses that we're getting back order.

14
00:00:55,600 --> 00:01:00,710
Of course, if we're successful, if we have logged in, then of course we'll get back to talking.

15
00:01:00,720 --> 00:01:01,100
Correct.

16
00:01:01,440 --> 00:01:05,260
And in order to get that, we'll just set up some kind of variable micas.

17
00:01:05,280 --> 00:01:12,960
I'm going to go with Jason there and we need to go with PCMCIA Postman and then Dot and we're looking

18
00:01:12,960 --> 00:01:16,040
for a response in there.

19
00:01:16,050 --> 00:01:18,420
We have a function by the name of Jason.

20
00:01:18,600 --> 00:01:25,710
And then let's just go with our token value and let's set up our global variable notice here.

21
00:01:25,710 --> 00:01:27,950
On the right hand side, we actually have snippets.

22
00:01:28,260 --> 00:01:31,560
So if we want to set up a new global variable, we just click it.

23
00:01:31,810 --> 00:01:33,900
And now we just need to provide the values.

24
00:01:34,350 --> 00:01:38,130
And effectively the name is going to be access token.

25
00:01:38,700 --> 00:01:43,710
And then as far as the value, this is where we go with Jason Data Dot.

26
00:01:43,950 --> 00:01:50,970
And of course, I know that in my responses, Tolkan is going to be located in token property or simply

27
00:01:50,970 --> 00:01:52,710
go with a token.

28
00:01:53,460 --> 00:01:58,890
And of course, once we send, we should see in the global's and variable.

29
00:01:59,190 --> 00:02:00,270
And of course we do.

30
00:02:00,630 --> 00:02:06,810
And the only thing that's left to do is to go to either get all jobs or create jobs.

31
00:02:06,810 --> 00:02:07,830
It doesn't really matter.

32
00:02:08,130 --> 00:02:14,400
We can go here and instead of authorizing that manually, I'll click it.

33
00:02:14,730 --> 00:02:18,990
And then we're looking for authorization when we want to go with Barer.

34
00:02:19,260 --> 00:02:24,660
So probably you have by default this inherent just go to bare token one.

35
00:02:24,900 --> 00:02:29,090
And then as far as the value, well, this is where you want to access that global one.

36
00:02:29,100 --> 00:02:29,580
Correct.

37
00:02:29,800 --> 00:02:37,050
So you just go here with access token and now once we send, we should get back the job.

38
00:02:37,320 --> 00:02:42,630
Now, of course, I created with the same values if I checked the body, so have Facebook and back end

39
00:02:42,630 --> 00:02:43,170
developer.

40
00:02:43,410 --> 00:02:49,160
So if I take a look at my database and if I refresh, I should have two values.

41
00:02:49,530 --> 00:02:51,840
I'll have one that I created before.

42
00:02:52,050 --> 00:02:57,420
And the second one, of course, was created when we are testing this dynamic setup.

43
00:02:57,720 --> 00:03:01,740
And of course we can do the same thing with get all jobs as well.

44
00:03:02,130 --> 00:03:03,270
So let's take a look.

45
00:03:03,270 --> 00:03:06,930
We have the headers here and I'm sorry, I'm looking in the wrong place.

46
00:03:07,230 --> 00:03:08,640
So we have the header here.

47
00:03:08,950 --> 00:03:09,990
Let's remove it.

48
00:03:10,020 --> 00:03:11,880
Let's check the authorization again.

49
00:03:12,240 --> 00:03:15,210
We have buried token, we're using access token.

50
00:03:15,420 --> 00:03:20,580
And once we send in the body now, we should get for jobs.

51
00:03:20,760 --> 00:03:26,310
And in order for everything to work, we also need to do that in the registered user.

52
00:03:26,670 --> 00:03:29,640
So let's go back quickly to the login one.

53
00:03:29,970 --> 00:03:34,410
Let's grab these two lines of code, then we'll go to register one again.

54
00:03:34,410 --> 00:03:37,260
We have the test and let's serve it here as well.

55
00:03:37,530 --> 00:03:40,260
And now let's try to create another user.

56
00:03:40,680 --> 00:03:43,590
So let's go to I believe in the body.

57
00:03:43,590 --> 00:03:43,920
Right?

58
00:03:43,980 --> 00:03:46,410
This is where we were creating a new user.

59
00:03:46,920 --> 00:03:51,600
And I'm going to go back to my good old Peter Peter at Gmail dot com.

60
00:03:51,780 --> 00:03:56,730
We send we get back the token and now the moment of truth.

61
00:03:57,060 --> 00:04:01,980
If I create a job and let's just say in this case, Netflix.

62
00:04:03,830 --> 00:04:10,990
And I'm still going to be a back end developer now, the this one should be created for Peter and again,

63
00:04:11,000 --> 00:04:14,290
notice how we don't need to worry about those headers anymore.

64
00:04:14,660 --> 00:04:17,000
So let's go back to our database.

65
00:04:17,420 --> 00:04:18,470
Let's refresh.

66
00:04:18,740 --> 00:04:25,270
And if everything is correct, I should have user by the name of Peter Pan I created.

67
00:04:25,550 --> 00:04:27,050
Of course, there it is.

68
00:04:27,050 --> 00:04:27,820
There's my Peter.

69
00:04:28,040 --> 00:04:33,560
And if I take a look at the jobs, Peter should also have a job.

70
00:04:33,830 --> 00:04:34,940
So I keep scrolling.

71
00:04:34,940 --> 00:04:40,460
And yes, there is I have the that looks one and of course it is a back end developer.

72
00:04:40,730 --> 00:04:48,980
So if I take a look at get all jobs now, of course I should get only one that is associated with Apiata.

73
00:04:49,220 --> 00:04:51,530
So let me go back to get all jobs.

74
00:04:51,530 --> 00:04:54,650
Let me send and of course I have count of one.

75
00:04:54,890 --> 00:05:00,130
So hopefully it is clear that now we're dynamically setting that access token.

76
00:05:00,260 --> 00:05:04,820
So you don't need to manually do that each and every time.

77
00:05:05,120 --> 00:05:10,520
And once we have all of this in place now, of course, we can continue with our application.

