Common combinations of requests and endpoints
The appropriate combination of Request action type and Endpoint type depends upon your use case. Common use cases are summarised in the table below. Information about reading this table follows.
| Request payload | Response type | Endpoint type | Request action type |
|---|---|---|---|
| None | None | Endpoint |
SendTheHttpRequest |
| None | Deserialized with custom logic | Endpoint<TResult> |
SendTheHttpRequestAndGetTheResponse<T> |
| None | Deserialized from JSON | Endpoint<TResult> |
SendTheHttpRequestAndGetJsonResponse<T> |
| Serialized with custom logic | None | Derive from ParameterizedEndpoint<TParameters> |
SendTheHttpRequest |
| Serialized with custom logic | Deserialized with custom logic | Derive from ParameterizedEndpoint<TParameters,TResult> |
SendTheHttpRequestAndGetTheResponse<T> |
| Serialized with custom logic | Deserialized from JSON | Derive from ParameterizedEndpoint<TParameters,TResult> |
SendTheHttpRequestAndGetJsonResponse<T> |
| Serialized with JSON | None | JsonEndpoint<TParameters> |
SendTheHttpRequest |
| Serialized with JSON | Deserialized with custom logic | JsonEndpoint<TParameters,TResult> |
SendTheHttpRequestAndGetTheResponse<T> |
| Serialized with JSON | Deserialized from JSON | JsonEndpoint<TParameters,TResult> |
SendTheHttpRequestAndGetJsonResponse<T> |
Tip
To decide which types of endpoint & performable: Choose the endpoint type based upon the needs of the request, adding an extra generic type parameter if the response is to be strongly-typed. Choose the action type based upon the technical details of reading the response.
The first two columns
The first two columns indicate:
- The kind of request payload which will be sent
These are the parameters to the API function described by the endpoint - The type of the expected response body
Where an API function returns a response, this is the .NET type which will be used to represent that response
Where None is listed in either column this means "not applicable". For example, an API function which uses no parameters will have no request payload. In the case of responses, None might mean that the response body will be ignored.
The second two columns
The second two columns indicate the Endpoint type and Request action type which are recommended in this scenario.