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 Aug 5, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: source/v1/api.html.md
+8-5Lines changed: 8 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,9 +44,9 @@ To Log in and try it out hit the "Try out" button and use `client_id` **2**.
44
44
}
45
45
```
46
46
47
-
All JSON responses from the API a wrapper in a base object.
47
+
All JSON responses from the API is wrapped in a base object.
48
48
49
-
Be sure to include an `Accept: application/json` header, otherwise errors like `401, 403 & 404` will either return HTML or redirect you to the login page.
49
+
Be sure to include an `Accept: application/json` header, otherwise errors like `401`, `403` & `404` will either return HTML or redirect you to the login page.
50
50
51
51
52
52
# Query Parameters
@@ -70,7 +70,9 @@ X-Page: 1
70
70
X-Per-Page: 50
71
71
```
72
72
73
-
By default de API returns 12 items per page. This can be increased to a maximum of 50 items per page.
73
+
By default the API returns 12 items per page and defaults to page 1.
74
+
75
+
The number of items per page can be increased to a maximum of 50 items.
74
76
75
77
## Sorting
76
78
@@ -80,7 +82,7 @@ By default de API returns 12 items per page. This can be increased to a maximum
80
82
?sort=-id,name
81
83
```
82
84
83
-
The API supports sorting ascending or descending sorting on multiple columns (seperated by a comma) on the resources.
85
+
The API supports sorting ascending or descending sorting on multiple columns (separated by a comma) on the resources.
84
86
85
87
**Sortable columns are whitelisted inside the API, there is currently no documentation on what columns are whitelisted**
86
88
@@ -92,7 +94,8 @@ The API supports sorting ascending or descending sorting on multiple columns (se
92
94
?search[name]=Kevin&search[company]=$:4News
93
95
```
94
96
95
-
Searching can be done on multiple columns, we use the URL array syntax for this.
97
+
Searching can be done on multiple columns, we use the URL array syntax for this.
98
+
96
99
The basic syntax is `operator:value`, so: `=:Maps4News`
97
100
98
101
**The same is for searchable columns, these are whitelisted per resource**
This will create a pop-up window containing the login page. Once the pop-up redirects back to the callback it will resolve the promise. The callback can be an empty page hosted on the same domain.
146
+
This will create a pop-up window containing the login page.
147
+
Once the pop-up redirects back to the callback it will resolve the promise.
148
+
The callback can be an empty page hosted on the same domain.
147
149
148
-
Callback url is set to the current url by default. The script is smart enough close the page if it detects that it's a child after authentication. This means that either the current page can be set as the callback (default) or a blank page. The callback must be hosted on the same domain as the application to allow for cross window communication.
150
+
Callback url is set to the current url by default.
151
+
The script is smart enough close the page if it detects that it's a child after authentication.
152
+
This means that either the current page can be set as the callback (default) or a blank page.
153
+
The callback must be hosted on the same domain as the application to allow for cross window communication.
149
154
150
155
## Dummy flow
151
156
@@ -171,6 +176,9 @@ The dummy flow can be used when a token *should* be present in the cache.
171
176
172
177
# Basics
173
178
179
+
These examples assume that an instance of the api exists and is authenticated.
180
+
See the node and web authentication examples for more information on authenticating.
These examples assume that an instance of the api exists and is authenticated.
186
-
See the node and web authentication examples for more information on authenticating.
193
+
The wrapper exposes relations which return proxies.
194
+
These proxies can be used to either build a route to a resource or to fetch resources.
195
+
This means that `api.users.get('me')` is the same as calling the route `/v1/users/me`.
196
+
All proxies expose the methods `new`, `list` and `lister`.
197
+
Most proxies expose the methods `select` and `get`.
187
198
188
-
The wrapper exposes relations which return proxies. These proxies can be used to either build a route to a resource or to fetch resources. This means that `api.users.get('me')` is the same as calling the route `/v1/users/me`. All proxies expose the methods `new`, `list` and `lister`. Most proxies expose the methods `select` and `get`.
199
+
<br/><br/>
189
200
190
201
```js
191
202
// Case translation
@@ -195,17 +206,18 @@ const data = {
195
206
196
207
consttest=api.static().new(data);
197
208
198
-
test.fooBarBaz===123;
209
+
test.fooBarBaz===123;// true
199
210
```
200
211
201
-
The wrapper will transform snake_case named variables returned from the api into camelCase named variables. This means that for example `place_name` will be transformed into `placeName`.
212
+
The wrapper will transform snake_case named variables returned from the api into camelCase named variables.
213
+
This means that for example `place_name` will be transformed into `placeName`.
202
214
203
215
Async methods return a `Promise` this means that both `then/catch` and `await/async` syntax are supported.
0 commit comments