🌐 REST API Integration

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/9

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No study sessions yet.

10 Terms

1
New cards

What is URLSession in Swift?

URLSession is the primary API for networking. It supports data, upload, and download tasks. It handles caching, authentication, and background execution. Configurations define behavior. It is thread-safe.

2
New cards

What is URLRequest in Swift?

URLRequest represents an HTTP request. It contains method, headers, body, and cache policy. It can be configured before sending. Requests are immutable after creation. It defines how data is sent.

3
New cards

What is URLComponents in Swift?

URLComponents constructs URLs safely. It manages query parameters and encoding. It prevents malformed URLs. It is preferred over manual string concatenation. It improves correctness.

4
New cards

What are the different HTTP methods?

GET retrieves data. POST creates resources. PUT replaces resources. PATCH partially updates. DELETE removes resources. Each has semantic meaning.

5
New cards

What are HTTP response status codes?

They indicate request results. 2xx means success. 4xx indicates client errors. 5xx indicates server errors. Proper handling is essential for robust networking.

6
New cards

What is OAuth protocol?

OAuth is an authorization framework. It allows secure delegated access. Users authenticate without sharing credentials. Tokens represent access rights. OAuth is widely used in APIs.

7
New cards

What is caching in iOS apps?

Caching stores responses to reduce network usage. URLCache provides built-in support. Caching improves performance and battery life. Cache policies control behavior. Incorrect caching causes stale data issues.

8
New cards

What is Result type in Swift?

Result represents success or failure explicitly. It wraps a success value or an error. It enforces error handling. Result is heavily used in async APIs. It improves clarity.

9
New cards

How do you handle retry calls in API requests?

By retrying failed requests conditionally. Combine offers retry operators. Custom logic may use backoff strategies. Avoid infinite retries. Respect network conditions.

10
New cards

How do you check for internet availability in iOS?

Use NWPathMonitor. It reports network reachability. It replaces deprecated Reachability APIs. Monitoring must be retained. Availability can change dynamically.