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.
This example uses the guzzlehttp package from composer.
46
+
This example uses the guzzlehttp package from Composer.
47
47
48
48
<?php
49
49
@@ -104,15 +104,15 @@ The Maps4News API is an OAuth2 API. We support implicit and password flows.
104
104
105
105
# API
106
106
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.
108
108
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.
110
110
111
111
To Log in and try it out hit the "Try out" button.
112
112
113
113
## Return Data
114
114
115
-
> For Success Responses
115
+
> For success responses
116
116
117
117
```json
118
118
{
@@ -123,7 +123,7 @@ To Log in and try it out hit the "Try out" button.
123
123
}
124
124
```
125
125
126
-
> For Error Responses
126
+
> For error responses
127
127
128
128
```json
129
129
{
@@ -135,7 +135,7 @@ To Log in and try it out hit the "Try out" button.
135
135
}
136
136
```
137
137
138
-
> For Error Responses With Validation Errors
138
+
> For error responses with validation errors
139
139
140
140
```json
141
141
{
@@ -152,7 +152,7 @@ To Log in and try it out hit the "Try out" button.
152
152
}
153
153
```
154
154
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)
156
156
157
157
```json
158
158
{
@@ -178,9 +178,9 @@ To Log in and try it out hit the "Try out" button.
178
178
}
179
179
```
180
180
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.
182
182
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.
184
184
185
185
## Headers
186
186
@@ -215,10 +215,10 @@ See [pagination](#pagination)
215
215
216
216
All returned model resources have an `ETag` and `Last-Modified` header.
217
217
218
-
`ETag` headers are returned from GET, Create & Update requests.
218
+
`ETag` headers are returned from Get, Create & Update requests.
219
219
Because the ETags are weak they can also be used on other routes.
220
220
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).
222
222
223
223
### Exposed CORS Headers
224
224
@@ -233,7 +233,7 @@ For example, when getting a resource the API will return a `ETag` header, the va
233
233
-`Authorization`
234
234
-`Accept` (should be set to `application/json` for all API requests)
235
235
-`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`)
237
237
238
238
### For Pagination
239
239
See [pagination](#pagination)
@@ -247,15 +247,15 @@ See [pagination](#pagination)
We follow the standard as described on mozilla developer network
250
+
We follow the standard as described on the Mozilla Developer Network.
251
251
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)
253
253
254
254
## Query Parameters
255
255
256
256
The API has a few query parameters available that you can use to help find the resources you need.
257
257
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.
259
259
260
260
### Pagination
261
261
@@ -273,7 +273,7 @@ X-Per-Page: 50
273
273
X-Offset: 0
274
274
```
275
275
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.
277
277
278
278
The number of items per page can be increased to a maximum of 50 items.
279
279
@@ -285,7 +285,7 @@ So, for example: if the list has 600 items and the `offset` is set to 100, the `
285
285
286
286
### Sorting
287
287
288
-
> Sort ID Descending and Name Ascending
288
+
> Sort ID descending and name ascending
289
289
290
290
```
291
291
?sort=-id,name
@@ -297,15 +297,15 @@ The API supports sorting ascending or descending sorting on multiple columns (se
297
297
298
298
### Searching
299
299
300
-
> Search for name LIKE "Kevin" and company That Ends With "4News"
300
+
> Search for name LIKE "Kevin" and company that ends with "4News"
301
301
302
302
```
303
303
?search[name]=Kevin&search[company]=$:4News
304
304
```
305
305
306
306
Searching can be done on multiple columns, we use the URL array syntax for this.
307
307
308
-
The basic syntax is `operator:value`, so: `=:Maps4News`
308
+
The basic syntax is `operator:value`, so: `=:4News`
309
309
310
310
**The same is for searchable columns, these are whitelisted per resource**
311
311
@@ -323,13 +323,13 @@ The available operators are:
323
323
324
324
## Keywords
325
325
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.
327
327
328
328
```
329
329
GET /v1/users/me
330
330
```
331
331
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.
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.
360
360
361
361
The library is freely available on [github](https://github.com/MapCreatorEU/api-wrapper) and [npm](https://www.npmjs.com/package/@mapcreator/maps4news).
362
362
@@ -420,9 +420,8 @@ You can also include the wrapper via a script tag in your html file.
420
420
## Authentication
421
421
422
422
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.
426
425
If one can be found the `api.authenticate()` method will instantly resolve without
427
426
any side-effects. The variable `api.authenticated` will be set to true if a token
0 commit comments