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
Implementation of an API application using the Phalcon Framework (https://phalconphp.com)
9
+
Implementation of an API application using the Phalcon Framework [https://phalconphp.com](https://phalconphp.com)
10
10
11
11
### Installation
12
12
- Clone the project
13
13
- In the project folder run `nanobox run php-server`
14
14
- Hit the IP address with postman
15
15
16
-
This requires [nanobox](https://nanobox.io) to be present in your system. Visit their site for installation instructions.
16
+
**NOTE**This requires [nanobox](https://nanobox.io) to be present in your system. Visit their site for installation instructions.
17
17
18
18
### Features
19
19
##### JWT Tokens
@@ -29,18 +29,63 @@ As part of the security of the API, [JWT](https://jwt.io) are used. JSON Web Tok
29
29
- TokenVerification - When a token is supplied, check if it is correctly signed
30
30
- TokenValidation - When a token is supplied, check if it is valid (`issuedAt`, `notBefore`, `expires`)
31
31
32
+
##### JSONAPI
33
+
This implementation follows the [JSON API](https://jsonapi.org) standard. All responses are formatted according to the standard, which offers a uniformed way of presenting data, simple or compound documents, includes (related data), sparse fieldsets, sorting, patination and filtering.
@@ -120,93 +165,14 @@ The record always has `id` and `type` present at the top level. `id` is the uniq
120
165
}
121
166
```
122
167
123
-
`POST /login`
124
-
```
125
-
"username" => "niden"
126
-
"password" => "110011"
127
-
```
128
-
129
-
```json
130
-
{
131
-
"jsonapi": {
132
-
"version": "1.0"
133
-
},
134
-
"data": {
135
-
"token": "aa.bb.cc"
136
-
},
137
-
"meta": {
138
-
"timestamp": "2018-06-08T15:07:35+00:00",
139
-
"hash": "6219ae83afaebc08da4250c4fd23ea1b4843d"
140
-
}
141
-
}
142
-
```
143
-
144
-
`GET /users/get/1051`
145
-
```json
146
-
{
147
-
"jsonapi": {
148
-
"version": "1.0"
149
-
},
150
-
"data": [
151
-
{
152
-
"id": 1051,
153
-
"type": "users",
154
-
"attributes": {
155
-
"status": 1,
156
-
"username": "niden",
157
-
"issuer": "https:\/\/niden.net",
158
-
"tokenPassword": "11110000",
159
-
"tokenId": "11001100"
160
-
}
161
-
}
162
-
],
163
-
"meta": {
164
-
"timestamp": "2018-06-08T15:07:35+00:00",
165
-
"hash": "6219ae83afaebc08da4250c4fd23ea1b4843d"
166
-
}
167
-
}
168
-
```
169
-
170
-
`GET /users/get`
171
-
```json
172
-
{
173
-
"jsonapi": {
174
-
"version": "1.0"
175
-
},
176
-
"data": [
177
-
{
178
-
"id": 1051,
179
-
"type": "users",
180
-
"attributes": {
181
-
"status": 1,
182
-
"username": "niden",
183
-
"issuer": "https:\/\/niden.net",
184
-
"tokenPassword": "11110000",
185
-
"tokenId": "11001100"
186
-
}
187
-
},
188
-
{
189
-
"id": 1244,
190
-
"type": "users",
191
-
"attributes": {
192
-
"status": 1,
193
-
"username": "phalcon",
194
-
"issuer": "https:\/\/phalconphp.com",
195
-
"tokenPassword": "00001111",
196
-
"tokenId": "99009900"
197
-
}
198
-
}
199
-
],
200
-
"meta": {
201
-
"timestamp": "2018-06-08T15:07:35+00:00",
202
-
"hash": "6219ae83afaebc08da4250c4fd23ea1b4843d"
203
-
}
204
-
}
205
-
```
206
-
168
+
For more information regarding responses, please check [JSON API](https://jsonapi.org)
169
+
207
170
### TODO
208
-
- Work on companies `GET`
209
-
- Work on relationships and data returned
171
+
-~~Work on companies GET~~
172
+
-~~Work on relationships and data returned~~
210
173
- Write examples of code to send to the client
174
+
- Create docs endpoint
211
175
- Work on pagination
176
+
- Work on filters
177
+
- Work on sorting
212
178
- Perhaps add a new claim to the token tied to the device? `setClaim('deviceId', 'Web-Server')`. This will allow the client application to invalidate access to a device that has already been logged in.
0 commit comments