Skip to content
This repository was archived by the owner on Aug 5, 2021. It is now read-only.

Commit bdd09c3

Browse files
committed
Merge branch 'master' of github.com:MapCreatorEU/api-docs
2 parents e6ba1b2 + 314c3e6 commit bdd09c3

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

source/v1/index.html.md

+31-31
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ api.users.get('me').then(console.log);
4343
```
4444

4545
```php
46-
This example uses the guzzlehttp package from composer.
46+
This example uses the guzzlehttp package from Composer.
4747

4848
<?php
4949

@@ -104,15 +104,15 @@ The Maps4News API is an OAuth2 API. We support implicit and password flows.
104104

105105
# API
106106

107-
To register an OAuth Client or Personal Access Token, please [log into the API](https://api.beta.maps4news.com) register one via your account settings.
107+
To register an OAuth Client or Personal Access Token, please [log into the API](https://api.beta.maps4news.com) and register one via your account settings.
108108

109-
Have a look at our [OpenAPI spec](/v1/api), the spec contains all the endpoints, info about how resources look and what each endpoint requires you to submit.
109+
Have a look at our [OpenAPI spec](/v1/api), the spec contains all the endpoints & info about how resources look and what each endpoint requires you to submit.
110110

111111
To Log in and try it out hit the "Try out" button.
112112

113113
## Return Data
114114

115-
> For Success Responses
115+
> For success responses
116116
117117
```json
118118
{
@@ -123,7 +123,7 @@ To Log in and try it out hit the "Try out" button.
123123
}
124124
```
125125

126-
> For Error Responses
126+
> For error responses
127127
128128
```json
129129
{
@@ -135,7 +135,7 @@ To Log in and try it out hit the "Try out" button.
135135
}
136136
```
137137

138-
> For Error Responses With Validation Errors
138+
> For error responses with validation errors
139139
140140
```json
141141
{
@@ -152,7 +152,7 @@ To Log in and try it out hit the "Try out" button.
152152
}
153153
```
154154

155-
> For Error Responses With JSON Schema Errors (Current only used when creating a Job Revision)
155+
> For error responses with JSON schema errors (current only used when creating a Job Revision)
156156
157157
```json
158158
{
@@ -178,9 +178,9 @@ To Log in and try it out hit the "Try out" button.
178178
}
179179
```
180180

181-
All JSON responses from the API is wrapped in a base object.
181+
All JSON responses from the API are wrapped in a base object.
182182

183-
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.
183+
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.
184184

185185
## Headers
186186

@@ -215,10 +215,10 @@ See [pagination](#pagination)
215215

216216
All returned model resources have an `ETag` and `Last-Modified` header.
217217

218-
`ETag` headers are returned from GET, Create & Update requests.
218+
`ETag` headers are returned from Get, Create & Update requests.
219219
Because the ETags are weak they can also be used on other routes.
220220

221-
For example, when getting a resource the API will return a `ETag` header, the value of the `ETag` header can be used on the update route prevent [the lost update problem](https://www.morpheusdata.com/blog/2015-02-21-lost-update-db).
221+
For example, when getting a resource the API will return an `ETag` header, the value of that `ETag` header can be used on the update route prevent the [lost update problem](https://www.morpheusdata.com/blog/2015-02-21-lost-update-db).
222222

223223
### Exposed CORS Headers
224224

@@ -233,7 +233,7 @@ For example, when getting a resource the API will return a `ETag` header, the va
233233
- `Authorization`
234234
- `Accept` (should be set to `application/json` for all API requests)
235235
- `Content-Type`
236-
- `X-No-CDN-Redirect` (Tells the API to not redirect the user to the CDN but instead fetch the item itself, default `false`)
236+
- `X-No-CDN-Redirect` (tells the API to not redirect the user to the CDN but instead fetch the item itself, default `false`)
237237

238238
### For Pagination
239239
See [pagination](#pagination)
@@ -247,15 +247,15 @@ See [pagination](#pagination)
247247
- [`If-Match`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match)
248248
- [`If-Unmodified-Since`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Unmodified-Since)
249249

250-
We follow the standard as described on mozilla developer network
250+
We follow the standard as described on the Mozilla Developer Network.
251251

252-
If you submit any of these headers the API will assume you only want to update a resource when the header condition is met, omit these if you do not care about preventing [the lost update problem](https://www.morpheusdata.com/blog/2015-02-21-lost-update-db)
252+
If you submit any of these headers the API will assume you only want to update a resource when the header condition is met, omit these if you do not care about preventing the [lost update problem](https://www.morpheusdata.com/blog/2015-02-21-lost-update-db)
253253

254254
## Query Parameters
255255

256256
The API has a few query parameters available that you can use to help find the resources you need.
257257

258-
All three of these query parameters are only available on listing endpoints, so endpoints that return an array of items.
258+
All of these query parameters are only available on listing endpoints, so endpoints that return an array of items.
259259

260260
### Pagination
261261

@@ -273,7 +273,7 @@ X-Per-Page: 50
273273
X-Offset: 0
274274
```
275275

276-
By default the API returns 12 items per page and defaults to page 1.
276+
By default, the API returns 12 items per page and defaults to page 1.
277277

278278
The number of items per page can be increased to a maximum of 50 items.
279279

@@ -285,7 +285,7 @@ So, for example: if the list has 600 items and the `offset` is set to 100, the `
285285

286286
### Sorting
287287

288-
> Sort ID Descending and Name Ascending
288+
> Sort ID descending and name ascending
289289
290290
```
291291
?sort=-id,name
@@ -297,15 +297,15 @@ The API supports sorting ascending or descending sorting on multiple columns (se
297297

298298
### Searching
299299

300-
> Search for name LIKE "Kevin" and company That Ends With "4News"
300+
> Search for name LIKE "Kevin" and company that ends with "4News"
301301
302302
```
303303
?search[name]=Kevin&search[company]=$:4News
304304
```
305305

306306
Searching can be done on multiple columns, we use the URL array syntax for this.
307307

308-
The basic syntax is `operator:value`, so: `=:Maps4News`
308+
The basic syntax is `operator:value`, so: `=:4News`
309309

310310
**The same is for searchable columns, these are whitelisted per resource**
311311

@@ -323,13 +323,13 @@ The available operators are:
323323

324324
## Keywords
325325

326-
There are a few keywords throughout the API that you can use in the url as shortcuts to certain resources.
326+
There are a few keywords throughout the API that you can use in the URL as shortcuts to certain resources.
327327

328328
```
329329
GET /v1/users/me
330330
```
331331

332-
For example, you can use `me` as an keyword for a user. This will return the resource of the logged in user.
332+
For example, you can use `me` as a keyword for a user. This will return the resource of the user that that is associated with the token used to make the request.
333333

334334
<br/>
335335

@@ -356,7 +356,7 @@ npm install @mapcreator/maps4news
356356
```
357357

358358
If you are using JavaScript to develop your app then you are in luck.
359-
We have created a query builder-like library that is able to do everything our API offers. It even does the Oauth login for you, in redirect, popup or password flow.
359+
We have created a query builder-like library that is able to do everything our API offers. It even does the OAuth login for you, in redirect, popup or password flow.
360360

361361
The library is freely available on [github](https://github.com/MapCreatorEU/api-wrapper) and [npm](https://www.npmjs.com/package/@mapcreator/maps4news).
362362

@@ -420,9 +420,8 @@ You can also include the wrapper via a script tag in your html file.
420420
## Authentication
421421

422422
Authentication is done through OAuth. This library provides multiple OAuth flow
423-
implementations for authentication. A client id can be obtained through a support
424-
ticket but this is planned to change in the near future. The client will first
425-
check if any tokens can be found in the cache before requiring authentication.
423+
implementations for authentication.
424+
The client will first check if any tokens can be found in the cache before requiring authentication.
426425
If one can be found the `api.authenticate()` method will instantly resolve without
427426
any side-effects. The variable `api.authenticated` will be set to true if a token
428427
has been found and is still valid.
@@ -546,11 +545,13 @@ const colors = await api.users.select('me').colors.list();
546545

547546
The wrapper exposes relations which return proxies.
548547
These proxies can be used to either build a route to a resource or to fetch resources.
548+
549549
This means that `api.users.get('me')` is the same as calling the route `/v1/users/me`.
550+
550551
All proxies expose the methods `new`, `list` and `lister`.
551552
Most proxies expose the methods `select` and `get`.
552553

553-
<br/><br/>
554+
Async methods return a `Promise` this means that both `then/catch` and `await/async` syntax are supported.
554555

555556
```js
556557
// Case translation
@@ -566,8 +567,6 @@ test.fooBarBaz === 123; // true
566567
The wrapper will transform snake_case named variables returned from the api into camelCase named variables.
567568
This means that for example `place_name` will be transformed into `placeName`.
568569

569-
Async methods return a `Promise` this means that both `then/catch` and `await/async` syntax are supported.
570-
571570
## Getting a resource
572571

573572
> Fetch resource and all its properties
@@ -589,8 +588,9 @@ api.users.select('me').mapstyleSets.list().then(function(sets) {
589588
```
590589

591590
Resources are bound to the base api class by default. Resources can be fetched in two ways;
592-
by selecting them (`.select`) or by fetching them (`.get`). Selecting them will only set the
593-
object's id to its properties. Fetching a resource returns a `Promise` that will resolve with the requested resource.
591+
by selecting them (`.select`) or by fetching them (`.get`).
592+
593+
Selecting them will only set the object's id to its properties. Fetching a resource returns a `Promise` that will resolve with the requested resource.
594594

595595
Selection is only useful as a stepping stone to related resources that can be easily obtained using the id of the parent.
596596

@@ -652,7 +652,7 @@ function parsePages(page) {
652652

653653
if (page.hasNext) {
654654
console.log('Grabbing page ' + (page.page + 1));
655-
page.next().then(parsePage);
655+
page.next().then(parsePages);
656656
}
657657
}
658658

0 commit comments

Comments
 (0)