apis Flashcards
1
Q
What is the difference between REST and SOAP APIs?
A
- REST - JSON, HTTP methods, caching
- SOAP - XML
2
Q
How do you handle C# API error handling?
A
- Use Try-Catch Blocks
- Return Appropriate HTTP Status Codes
- 400 Bad Request
- 500 Internal Server Error
3
Q
What is C# API data serialization?
A
- Convert data into format that can be transmitted and reconstructed on receiving end
- JSON - C# has libraries like Newtonsoft.Json for serializing and deserializing JSON data
4
Q
How do you deal with C# API security?
A
- Authentication - e.g. OAuth (Bearer Tokens), JWT, etc.
- Rate Limiting - to prevent DDOS attacks
- API Versioning - make sure code changes to APi doesn’t affect existing clients
5
Q
What are C# REST principles?
A
- Stateless Communication - each request is independent and doesn’t rely on any previous requests
- HTTP Methods - GET, POST, PUT, DELETE
- Representation - JSON
6
Q
What is an API wrapper?
A
- API wrapper lets you call it instead of the API directly.
7
Q
What are some API performance and optimizations?
A
- Caching
- Rate Limiting
- Asynchronous Processing
- Load Balancing
8
Q
Consume API steps
A
- GetAsync()
- ReadAsStringAsync()
- DeserializeObject