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
{{ message }}
This repository was archived by the owner on Mar 31, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+33-7Lines changed: 33 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,9 +67,14 @@ logging framework at deployment time.
67
67
The API of Airtable itself is limited to 5 requests per second. If you exceed this rate, you will receive a 429 status code and will
68
68
need to wait 30 seconds before subsequent requests will succeed.
69
69
70
-
*TODO:*
71
-
* How to create an Airtable Object
72
-
* How to create an Airtable Base
70
+
### Connecting to Airtable
71
+
To use this Libraray you will need a Airtable Object. Simply create one! `Airtable airtable = new Airtable();`.
72
+
This Object needs an API-Key or it won't work properly so `airtable.configure(AIRTABLE_API_KEY);`.
73
+
Now the Airtable Object needs to know on which base you want access. This Method will return a Base Object which will be used in the Future.
74
+
`Base base = airtable.base(AIRTABLE_BASE);`
75
+
76
+
With the Base object you can perform all kind of Operations see more [here](#crud-operations-on-table-records).
77
+
73
78
74
79
## Object Mapping
75
80
The Java implementation of the Airtable API provides automatic Object mapping. You can map any Table to your own Java Classes.
@@ -146,7 +151,7 @@ Now our Java Class should look like this:
146
151
}
147
152
}
148
153
```
149
-
For each column we give the Java class an attribute with the column name (Be careful! See more about naming in the [Section 'Annotations'](#annotations))
154
+
For each column we give the Java class an attribute with the column name (Be careful! See more about naming in the Section [Annotations](#annotations))
150
155
and add Getters and Setters for each attribute. The attribute types can be either primitive Java types like `String` and `Float` for Text and Numbers,
151
156
`String Array` for references on other Tables or `Attachment` for attached photos and files.
152
157
@@ -209,6 +214,21 @@ The airtable.java API will respect these mappings automatically.
209
214
@SerializedName("First- & Lastname")
210
215
privateString name;
211
216
```
217
+
### Sort
218
+
With the integrated Sort element you can retrieve a list of sort objects that specifies how the records will be ordered.
219
+
Each sort object must have a field key specifying the name of the field to sort on, and an optional direction key that is either "asc" or "desc".
220
+
The default direction is "asc".
221
+
222
+
For example, to sort records by Name, pass in:
223
+
224
+
```Java
225
+
Sort sort =newSort("Name", Sort.Direction.desc);
226
+
List<Movie> listMovies = movieTable.select(sort);
227
+
```
228
+
If you set the view parameter, the returned records in that view will be sorted by these fields.
229
+
230
+
Detailed Example see [TableParameterTest](https://github.com/Sybit-Education/airtable.java/blob/develop/src/test/java/com/sybit/airtable/TableParameterTest.java)
231
+
212
232
213
233
## CRUD-Operations on Table Records
214
234
@@ -217,9 +237,11 @@ Select list of items from table:
217
237
218
238
+`table(name).select()`: get all records of table `name`
219
239
+`table(name).select(Integer maxRecords)`: get max `maxRecords` records of table `name`
240
+
+`table(name).select(String[] fields)`: get records of table `name` with only the specified `fields`
241
+
+`table(name).select(String view)`: get records of table `name` with the specified `view` (more about [views](https://support.airtable.com/hc/en-us/sections/200644955-Views))
242
+
+`table(name).select(Sort sortation)`: get records of table `name` using `sort` to sort records (More about Sort [here](#sort))
220
243
+`table(name).select(Query query)`: get records of table `name` using `query` to filter
Detailed example see [TableDestroyTest.java](https://github.com/Sybit-Education/airtable.java/blob/develop/src/test/java/com/sybit/airtable/TableCreateRecordTest.java)
Detailed example see [TableUpdateTest](https://github.com/Sybit-Education/airtable.java/blob/develop/src/test/java/com/sybit/airtable/TableUpdateTest.java)
320
+
295
321
# Roadmap
296
322
297
323
Short overview of features, which are supported:
@@ -304,8 +330,8 @@ Short overview of features, which are supported:
0 commit comments