WEBVTT

1
00:00.000 --> 00:03.200
Alright friends, let's walk through the solutions in.

2
00:03.200 --> 00:06.240
So the very first thing I asked you to do was to name a tool that you could use

3
00:06.240 --> 00:06.800
to send

4
00:06.800 --> 00:10.280
HTTP requests to this new REST API server.

5
00:10.280 --> 00:13.500
The solution I would suggest is the one that we saw at the end of this skill

6
00:13.500 --> 00:13.960
and this

7
00:13.960 --> 00:18.400
is the postman utility, although I will say that you do not have to use postman

8
00:18.400 --> 00:18.680
, there

9
00:18.680 --> 00:20.240
are other tools out there.

10
00:20.240 --> 00:24.000
And in fact you can just use regular programming languages, say for example,

11
00:24.000 --> 00:24.720
using Python

12
00:24.720 --> 00:26.520
to make the same type of requests.

13
00:26.520 --> 00:30.160
But for testing the ability to save your request and so on and so forth in a
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

13
00:26.520 --> 00:30.160
But for testing the ability to save your request and so on and so forth in a

14
00:30.160 --> 00:31.080
neat nice way,

15
00:31.080 --> 00:33.120
postman is a very, very good option.

16
00:33.120 --> 00:36.920
Okay, so next question you wish to read a list of all the user names stored on

17
00:36.920 --> 00:37.840
the server.

18
00:37.840 --> 00:41.420
However, the server is not accessible to the general public, which key factors

19
00:41.420 --> 00:41.880
do we have

20
00:41.880 --> 00:43.240
to consider right here?

21
00:43.240 --> 00:46.300
So the first thing to state here is that if we want to read a list of all the

22
00:46.300 --> 00:46.840
user names

23
00:46.840 --> 00:50.760
stored on the server, we're going to have to make a note of the particular URL

24
00:50.760 --> 00:51.160
that we

25
00:51.160 --> 00:55.470
want that we can target a very particular resource on the server, namely the

26
00:55.470 --> 00:56.160
list of all

27
00:56.160 --> 00:57.160
the user names.

28
00:57.160 --> 00:58.720
Now, what would we also want to consider?

29
00:58.720 --> 01:02.760
Well, maybe we want to specify the type of formatting we should expect back.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

29
00:58.720 --> 01:02.760
Well, maybe we want to specify the type of formatting we should expect back.

30
01:02.760 --> 01:06.860
So we might actually craft and accept header, but that is a little bit further

31
01:06.860 --> 01:07.400
down on

32
01:07.400 --> 01:08.400
the priorities.

33
01:08.400 --> 01:12.480
What I'm most concerned about is the fact that this server is not accessible to

34
01:12.480 --> 01:13.120
the general

35
01:13.120 --> 01:14.120
public.

36
01:14.120 --> 01:17.120
This indicates to me that we're going to have to have some type of

37
01:17.120 --> 01:17.840
authorization to

38
01:17.840 --> 01:18.840
access it.

39
01:18.840 --> 01:22.170
So as such, what I want to do is I want to make sure that I actually have my

40
01:22.170 --> 01:23.000
authorization

41
01:23.000 --> 01:26.480
header in play and I do actually have the correct credentials.

42
01:26.480 --> 01:28.560
Now what else do I want to think about?

43
01:28.560 --> 01:32.450
Once I get the resource and I have my headers in play, then I would also like
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

43
01:28.560 --> 01:32.450
Once I get the resource and I have my headers in play, then I would also like

44
01:32.450 --> 01:33.120
to make sure

45
01:33.120 --> 01:35.960
that I'm sending the correct HTTP method.

46
01:35.960 --> 01:38.840
So in my case here, I want to be sending a get request.

47
01:38.840 --> 01:43.240
Now, if I happen to do this, then what I should see is a successful response.

48
01:43.240 --> 01:46.600
Now if all of this happens to be successful, which we hope it would be, which

49
01:46.600 --> 01:47.440
status code

50
01:47.440 --> 01:50.280
would I actually expect to receive?

51
01:50.280 --> 01:54.000
Well, if we send a get request and I happen to be successful, then what I would

52
01:54.000 --> 01:54.400
expect

53
01:54.400 --> 01:58.880
to see would be a 200 status code, aka an OK response.

54
01:58.880 --> 01:59.880
All right.

55
01:59.880 --> 02:01.880
So now you wish to add some test data to do so.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

55
01:59.880 --> 02:01.880
So now you wish to add some test data to do so.

56
02:01.880 --> 02:06.060
You attempt to add a test user name into the data set, which modifications will

57
02:06.060 --> 02:06.480
you need

58
02:06.480 --> 02:08.880
to make in order for the request to be successful.

59
02:08.880 --> 02:13.350
So first thing here, I'm going to have to change the get request to be a post

60
02:13.350 --> 02:13.920
request

61
02:13.920 --> 02:14.920
in this case.

62
02:14.920 --> 02:18.750
Since I'm going to be inserting data, I'm going to also specify my content type

63
02:18.750 --> 02:19.160
header

64
02:19.160 --> 02:21.320
so the server can know what to expect.

65
02:21.320 --> 02:25.380
I'm also going to supply the actual content that I'm trying to add within the

66
02:25.380 --> 02:26.040
body of the

67
02:26.040 --> 02:27.040
actual request.

68
02:27.040 --> 02:30.450
As we saw in the video, when we utilize postman, and also we want to ensure
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

68
02:27.040 --> 02:30.450
As we saw in the video, when we utilize postman, and also we want to ensure

69
02:30.450 --> 02:31.400
that we're using

70
02:31.400 --> 02:35.640
the correct URL in order to insert new data into the data set.

71
02:35.640 --> 02:38.920
So assuming we have a success, which status code would we expect to see?

72
02:38.920 --> 02:43.290
Well, this time we should actually see a two or one status code indicating that

73
02:43.290 --> 02:43.600
a new

74
02:43.600 --> 02:45.920
resource was indeed created.

75
02:45.920 --> 02:50.000
So friends, that is us for our validation challenge on REST APIs.

76
02:50.000 --> 02:52.920
I hope it's been fun for you and I'd like to thank you for viewing.
