Skip to content

Commit 3220204

Browse files
authored
Update README.md
1 parent c3ab092 commit 3220204

1 file changed

Lines changed: 34 additions & 19 deletions

File tree

README.md

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ $airtable = new Airtable(array(
6666

6767
## Examples
6868

69-
A number of examples are placed below to help use this wrapper. The examples assume that the class has already been initiated
69+
A number of examples are placed below to help use this wrapper. The examples assume that the class has already been initiated.
7070

7171
### getApiKey & getBaseId
7272

@@ -95,7 +95,7 @@ $params: Array. All parameters are optional.
9595
For more details on accepted parameters, see the airtable documentation.
9696
```
9797

98-
A special parameter not included on the Airtable API has been added called checkOffset. This paramater defaults to true but can be set to false. It allows you to return just 1 page of results instead of all of them if you have more than 5 pages of results being returned.
98+
A special parameter not included on the Airtable API has been added called checkOffset. This paramater defaults to true but can be set to false. It allows you to return just 1 page of results instead of looping through all of them. (Depending on your rate limits, any more than 500 records in 1 search may return false if those rate limits are reached).
9999

100100
##### Code Template:
101101
```php
@@ -154,13 +154,13 @@ print_r($airtable->retrieveRecord("Users", "recfauP0XQTTgXMQK"));
154154
```
155155

156156
##### Result:
157-
```php
157+
```
158158
Array with all the information from one record that is not empty.
159159
```
160160

161161
### createRecord
162162

163-
Create a record in a specific table.
163+
Create a record in a given table.
164164

165165
```
166166
$table_name: String. Required.
@@ -184,38 +184,48 @@ print_r($airtable->createRecord("Users", array(
184184
```
185185

186186
##### Result:
187-
```php
187+
```
188188
On success, the created record is returned with the field information and id of the record.
189189
```
190190

191191
### updateRecord
192192

193-
Update a specific record
193+
Update a specific record from a given table.
194194

195195
```
196196
$table_name: String. Required.
197197
$record_id: String. Required.
198-
$data: Array. Optional.
198+
$data: Array. Optional (though recommended).
199+
$destructive: Boolean. Optional. Default false.
200+
A value of false runs a PATCH update leaving data untouched if not edited.
201+
A value of true runs a PUT update which destroys the instance and updates it with only the new data added.
199202
```
200203

201204
##### Code Template:
202205
```php
203-
$airtable->retrieveRecord($table_name, $record_id);
206+
$airtable->updateRecord($table_name, $record_id, array(
207+
"field_name1" => "field_value1",
208+
"field_name2" => "field_value2"...
209+
), $destructive);
204210
```
205211

206212
##### Code Example:
207213
```php
208-
214+
print_r($airtable->updateRecord("Users", "recAkSf8l5IpITPV8", array(
215+
"First Name" => "Joe1",
216+
"Last Name" => "Smith1"
217+
)));
209218
```
210219

211220
##### Result:
212-
```php
213-
221+
```
222+
On success, updated record returned with the new information.
223+
$destructive was not set to true, so the rest of the record's information remained intact.
214224
```
215225

216226
### deleteRecord
217227

218-
Retrieves a specific record from a given table. Empty fields from record are not returned. following parameters:
228+
Deletes a specific record from a given table.
219229

220230
```
221231
$table_name: String. Required.
@@ -224,27 +234,32 @@ $record_id: String. Required.
224234

225235
##### Code Template:
226236
```php
227-
$airtable->retrieveRecord($table_name, $record_id);
237+
$airtable->deleteRecord($table_name, $record_id);
228238
```
229239

230240
##### Code Example:
231241
```php
232-
242+
print_r($airtable->deleteRecord("Users", "recU84ywe5m1md4wP"));
233243
```
234244

235245
##### Result:
236-
```php
237-
246+
```
247+
On success, returns the fact that it was deleted along with the id of the deleted record.
238248
```
239249

240250
### getLastLog & getLog
241251

252+
Error logging is supported so that your program does not crash on request errors. Any of the functions that require Curl Requests will return false on failure or the record(s) at hand on success. On top of that, each failure or success is logged within the wrapper instance. The following code shows how to access the log:
253+
242254
##### Code:
243255
```php
244-
256+
print_r($airtable->getLog());
257+
echo "<br />";
258+
print_r($airtable->getLastLog());
245259
```
246260

247261
##### Result:
248-
```php
249-
262+
```
263+
your_entire_log
264+
last_entry_of_log
250265
```

0 commit comments

Comments
 (0)