Курси /
Introduction to .NET with C#
Handling Exceptions caused by HTTP Request
Important Points:
- Runtime errors can occur when making API requests. The most notable case is if the URL / URI provided is invalid;
- We use try-catch blocks to enclose the
GetAsync
method to make it safe; - The
HttpResponseMessage
class has anIsSuccessStatusCode
attribute, which has the valuetrue
in case the API successfully responds with the requested data; HttpResponseMessage
also has aStatusCode
attribute which represents the response status code. You can learn more about status codes here;- HTTP status codes are three-digit numbers returned by a server in response to a client's request made to a website or web server. They provide information about the outcome of the request and help troubleshoot issues.
Other HTTP methods including POST, PUT and DELETE will be covered in the upcoming course when we create our own API.
What methods do we use to make an API request safer?
Виберіть кілька правильних відповідей
Все було зрозуміло?
Секція 2. Розділ 7
Зміст курсу
Introduction to .NET with C#
2. Asynchronous Programming and Introduction to Web Services
3. Introduction to Databases with .NET
Introduction to .NET with C#
Handling Exceptions caused by HTTP Request
Important Points:
- Runtime errors can occur when making API requests. The most notable case is if the URL / URI provided is invalid;
- We use try-catch blocks to enclose the
GetAsync
method to make it safe; - The
HttpResponseMessage
class has anIsSuccessStatusCode
attribute, which has the valuetrue
in case the API successfully responds with the requested data; HttpResponseMessage
also has aStatusCode
attribute which represents the response status code. You can learn more about status codes here;- HTTP status codes are three-digit numbers returned by a server in response to a client's request made to a website or web server. They provide information about the outcome of the request and help troubleshoot issues.
Other HTTP methods including POST, PUT and DELETE will be covered in the upcoming course when we create our own API.
What methods do we use to make an API request safer?
Виберіть кілька правильних відповідей
Все було зрозуміло?
Секція 2. Розділ 7