You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This page discusses how to read a list of publications on Issuu
9
+
10
+
### Getting a list of publications
11
+
12
+
:::tip[Issuu API]
13
+
14
+
This method corresponds to calling `HTTP GET https://api.issuu.com/v2/publications`.<br />
15
+
API documentation: https://api.issuu.com/v2/reference/#get-/publications
16
+
17
+
:::
18
+
19
+
To read a list of published documents, we can use the `Publications.GetPublicationsAsync` operation. This operation will return a page of a set of documents.
if (response.IsSuccess&&response.Datais { Length: >0 })
26
+
{
27
+
vardocuments=response.Data;
28
+
// Do something with the documents.
29
+
}
30
+
}
31
+
```
32
+
33
+
If the response is successful, the `Meta` property should be populated with additional paging information. You can use this to determine if you can read any other pages of information.
34
+
35
+
:::tip[Paging Defaults]
36
+
37
+
The following defaults are used for `page` and `size` if you do not provide them:
The mapping delegate must accept a HTTP response message, and return a `MappedResponse<TResponse>`, which will contain the result data, and any additional metadata and links.
You do not need to worry about mapping an error response from the Issuu API, as the IssuuSDK will handle this automatically. When your mapping delegate is called, this is for a success HTTP status code
83
+
84
+
:::
85
+
86
+
Internally, the IssuuSDK makes use of this approach combined with specific container types which can be deserialized from the JSON responses.
87
+
88
+
#### `DataContainer<TResult>` container type
89
+
90
+
This container type is used when returning set operations, where `TResult` is the array of the intended type:
91
+
92
+
| Property | Type | Notes |
93
+
|---|---|---|
94
+
|`Count`|`int?`| The total number of items |
95
+
|`PageSize`|`int?`| The size of the page |
96
+
|`Results`|`TData?`| The data |
97
+
|`Links`|`Dictionary<string, LinkContainer>?`| The set of links for the resource |
98
+
99
+
For example, when using the `Drafts.GetDraftsAsync(...)` operation, internally a `DataContainer<Document[]>` is used which returns a set of documents.
100
+
101
+
:::info[Single Results]
102
+
103
+
The `DataContainer<T>` type is only used for results that return sets of data. For individual result instances, such as a single document, the JSON result is directly deserialized, not in a wrapping type.
104
+
105
+
:::
106
+
107
+
#### `LinkContainer` container type
108
+
109
+
This container type is used to deserialize a link:
110
+
111
+
This container type is used to deserialzie a specific error message:
112
+
113
+
| Property | Type | Notes |
114
+
|---|---|---|
115
+
|`Href`|`string`| The error message |
116
+
117
+
#### `ErrorContainer` container type
118
+
119
+
This container type is used to deserialize an error response:
120
+
121
+
| Property | Type | Notes |
122
+
|---|---|---|
123
+
|`Fields`|`Dictionary<string, ErrorMessageContainer>?`| The set of field errors |
124
+
|`Details`|`Dictionary<string, ErrorMessageContainer>?`| The set of specific error details |
125
+
|`Message`|`string`| The error message |
126
+
127
+
#### `ErrorMessageContainer` container type
128
+
129
+
This container type is used to deserialzie a specific error message:
130
+
131
+
| Property | Type | Notes |
132
+
|---|---|---|
133
+
|`Message`|`string`| The error message |
134
+
22
135
### HTTP GET example - returning a single resource
0 commit comments