diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 026fd31..0000000 Binary files a/.DS_Store and /dev/null differ diff --git a/README.md b/README.md deleted file mode 100644 index 462d399..0000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -# low-quality-identifier-service diff --git a/api/.DS_Store b/api/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/api/.DS_Store and /dev/null differ diff --git a/api/low-quality-identifier-db.json b/api/low-quality-identifier-db.json deleted file mode 100644 index 898ae25..0000000 --- a/api/low-quality-identifier-db.json +++ /dev/null @@ -1,146 +0,0 @@ -{ - "users": [ - { - "last_name": "Doe", - "first_name": "John", - "email": "j.doe@example.com", - "id": "1" - }, - { - "last_name": "Adams", - "first_name": "Alice", - "email": "a.adams@example.com", - "id": "2" - }, - { - "last_name": "Brown", - "first_name": "Chris", - "email": "c.brown@example.com", - "id": "3" - }, - { - "last_name": "Clark", - "first_name": "Dana", - "email": "d.clark@example.com", - "id": "4" - }, - { - "id": "1eb3", - "last_nam": "Jones", - "first_name": "Genny", - "email": "gen.jones@example.com" - }, - { - "last_name": "Jones", - "first_name": "Genny", - "email": "genny.jones@example.com", - "id": "ee43" - } - ], - "photos": [ - { - "user_id": 1, - "file_name": "vacation1.jpg", - "traits": { - "blurriness": true, - "faces": true, - "subject_matter": "landscape", - "similarity_check": false, - "rating": 3 - }, - "action": "move_to:/archive", - "id": "1" - }, - { - "user_id": 1, - "file_name": "party1.jpg", - "traits": { - "blurriness": false, - "faces": true, - "subject_matter": "party", - "similarity_check": true, - "rating": 5 - }, - "action": "keep", - "id": "2" - }, - { - "user_id": 2, - "file_name": "conference1.jpg", - "traits": { - "blurriness": true, - "faces": false, - "subject_matter": "document", - "similarity_check": false, - "rating": 2 - }, - "action": "delete", - "id": "3" - }, - { - "user_id": 2, - "file_name": "wedding1.jpg", - "traits": { - "blurriness": false, - "faces": true, - "subject_matter": "event", - "similarity_check": true, - "rating": 4 - }, - "action": "move_to:/favorites", - "id": "4" - }, - { - "user_id": 3, - "file_name": "nature1.jpg", - "traits": { - "blurriness": false, - "faces": false, - "subject_matter": "nature", - "similarity_check": true, - "rating": 5 - }, - "action": "keep", - "id": "5" - }, - { - "user_id": 3, - "file_name": "selfie1.jpg", - "traits": { - "blurriness": true, - "faces": true, - "subject_matter": "selfie", - "similarity_check": false, - "rating": 2 - }, - "action": "delete", - "id": "6" - }, - { - "user_id": 4, - "file_name": "sports1.jpg", - "traits": { - "blurriness": false, - "faces": false, - "subject_matter": "sports", - "similarity_check": false, - "rating": 4 - }, - "action": "keep", - "id": "7" - }, - { - "user_id": 4, - "file_name": "family1.jpg", - "traits": { - "blurriness": true, - "faces": true, - "subject_matter": "family", - "similarity_check": true, - "rating": 3 - }, - "action": "move_to:/album", - "id": "8" - } - ] -} \ No newline at end of file diff --git a/api/start-server.bat b/api/start-server.bat deleted file mode 100644 index 321af6e..0000000 --- a/api/start-server.bat +++ /dev/null @@ -1 +0,0 @@ -json-server -w low-quality-identifier-db.json diff --git a/api/start-server.sh b/api/start-server.sh deleted file mode 100644 index 9795af7..0000000 --- a/api/start-server.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -json-server -w low-quality-identifier-db.json diff --git a/docs/.DS_Store b/docs/.DS_Store deleted file mode 100644 index 1fd1f60..0000000 Binary files a/docs/.DS_Store and /dev/null differ diff --git a/docs/_config.yml b/docs/_config.yml deleted file mode 100644 index fc3c0df..0000000 --- a/docs/_config.yml +++ /dev/null @@ -1,2 +0,0 @@ -include: ['pages'] -theme: jekyll-theme-slate \ No newline at end of file diff --git a/docs/api/.DS_Store b/docs/api/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/docs/api/.DS_Store and /dev/null differ diff --git a/docs/api/quickstart.md b/docs/api/quickstart.md deleted file mode 100644 index 929cd77..0000000 --- a/docs/api/quickstart.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -layout: page ---- - -# Quickstart guide - -The low-quality image identifier service provides a cloud-hosted photo gallery which allows you to identify low quality images to mark and sort them for cleanup. - -## At a glance - -This Quickstart provides all the information you need to begin using the low quality image identifier to sort photos for cleanup. - -You’ll learn when and how to use the web service and get set up to make your first call to the API. - -## Setting up the the low quality image identifier service - -Photos will surface in the the low quality image identifier service when they are created in the database and assigned to users (by user {id}). If you’ve used the the low quality image identifier service previously, you’re already enrolled in the service and may have photos to work with. - -If not, you might need to set up your development system and get going from scratch. Don’t worry – you only have to do this one time per development system! Follow these [prerequisite steps](../tutorials/before-you-start.md) to install the tools and test your development system. - -## When to use the the low quality image identifier service - -The the low quality image identifier service REST API offers a wide range of integration possibilities, from sorting photos in bulk for cleanup. - -The service comprises two resources: [`users`](users) and [`photos`](photos). The [`users`](users) resource (containing the subscribers to the service) works in synergy with the [`photos`](photos) resource (containing the photoss) to align users with their the low quality image identifier list. - -Using this cloud-based service, customers can register themselves to create and manage their own photoss. -When they're registered, customers can update and delete photoss to suit their needs. Adding photoss on customers' behalf is easy - if they're collaborating with colleagues on different teams and projects, for example, they might be delegated requests and assigned photoss from different sources. - -## How to use the the low quality image identifier service - -To build your API call, you must have the following components: - -* **A host.** The {base_url} depends on users' installation of the service in their development environment. For v1 of the low quality image identifier Service API, the **base_url** variable is typically set to `http://localhost:3000`. -* **Authorization.** For v1 of the the low quality image identifier service, requests do not use any authorization. All endpoints are available to all users and applications. -* **A request.** The the low quality image identifier service REST API enables CRUD operations via HTTP requests on database resources (`GET`, `POST`, `PUT`, `PATCH`, and `DELETE` methods). Request and response bodies are encoded as JSON. - -### Supported endpoints - -| HTTP Method | Endpoint | -| :--------------: | :--------------: | -| GET | [List user by ID](users-get-user-by-id.md) | -| GET | [List user by email](users-get-user-by-email.md) | -| POST | [Create a user](users-create-user.md) | -| PUT | [Update user by ID](users-update-by-id.md) | - -## Make your first API call – *Get user id* - -Assume that you’re already enrolled in the the low quality image identifier service and you want to list all photoss as a first call to the API. - -Let’s test making this simple request to the [`photos`](photos) resource. You’ll use cURL to make the API call. - -```bash - -curl http://localhost:3000/photos?user_id=1 -``` - -If the call was successful, the response you receive will be a list of photos from the the low quality image identifier service such as you see in this example: - -```js - - [ - { - "user_id": 1, - "file_name": "vacation1.jpg", - "traits": { - "blurriness": true, - "faces": true, - "subject_matter": "landscape", - "similarity_check": false, - "rating": 3 - }, - "action": "move_to:/archive", - "id": "1" - }, - { - "user_id": 1, - "file_name": "party1.jpg", - "traits": { - "blurriness": false, - "faces": true, - "subject_matter": "party", - "similarity_check": true, - "rating": 5 - }, - "action": "keep", - "id": "2" - } - ] - -``` - ---- - -**NOTE:** -cURL comes installed by default on Mac operating systems. If you need to, install it from [here](https://curl.se/windows/). - ---- - -## Next steps - -Now that you’ve everything set up correctly, you’re good to go and can take full advantage of the the low quality image identifier service API! Go ahead and start posting new photoss or enrolling new users. You’ll see how easy the API is to use. - -If you need more guidance, the Tutorials section of the API documentation walks through any photos you’ll want to do. The finer details of the supported resources, endpoints and properties are in the API reference section. For more information, go [here](../index.md). \ No newline at end of file diff --git a/docs/api/reference-topics/photos/add-new-photo.md b/docs/api/reference-topics/photos/add-new-photo.md deleted file mode 100644 index 84ea142..0000000 --- a/docs/api/reference-topics/photos/add-new-photo.md +++ /dev/null @@ -1,83 +0,0 @@ ---- -layout: page ---- - -# Add a new photo - -Use this operation to create a new photo resource. - -## URL - -```shell - -{POST} {base_url}/photos -``` - -## Params - -| Parameter name | Type | Description | -| -------------- | ------ | ------------ | -| `file_name` | String | The name of the photo file | -| `traits.blurriness` | Boolean | Indicates if the photo is blurry | -| `traits.faces` | Boolean | Indicates if the photo contains faces | -| `traits.subject_matter` | String | Description of the subject of the photo | -| `traits.similarity_check` | Boolean | Indicates the similiary of the photo | -| `traits.rating` | Number | Quality rating of the photo | -| `action` | String | Specifies the action to take on the photo | - -## Request headers - -This request does not use any authorization. The endpoint is available to all tasks and applications. - -| Header name | Description | Required | Values | -| -------------- | ------ | ------------ |------------ | -| Content-Type | The format of the data to be posted. | Optional | application/json. Default value. | -| Accept | The format of the data to be returned. | Optional | application/json. Default value. | - - -## Request body - -```js -[ - { - "file_name": "new_photo.jpg", - "traits": { - "blurriness": true, - "faces": true, - "subject_matter": "landscape", - "similarity_check": false, - "rating": 3 - }, - "action": "move_to:/archive" - } -] -``` - -## Response body - -The following example shows the response. - -```js -[ - { - "id": "aab5", - "file_name": "new_photo.jpg", - "traits": { - "blurriness": true, - "faces": true, - "subject_matter": "landscape", - "similarity_check": false, - "rating": 3 - }, - "action": "move_to:/archive" - } -] -``` - -## Return status - -| Status value | Return status | Description | -| ------------- | ----------- | ----------- | -| 201 | Created | The request has been fulfilled and resulted in a new resource being created. | -| 404 | Error | Specified user record not found | -| ECONNREFUSED | N/A | Service is offline. Start the service and try again. | \ No newline at end of file diff --git a/docs/api/reference-topics/photos/delete-photo.md b/docs/api/reference-topics/photos/delete-photo.md deleted file mode 100644 index 2c7458e..0000000 --- a/docs/api/reference-topics/photos/delete-photo.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -layout: page ---- - -# Delete a photo - -Use this operation to delete a photo resource. You need to retrieve the photo's id for this operation. Refer to [Show one photo](/show-one-photo.md) to get the photo id. - -## URL - -```shell - -{DELETE} {base_url}/photos/{id} -``` - -## Params - -| Parameter name | Type | Description | -| -------------- | ------ | ------------ | -| `id` | String | The unique identifier of the photo | - -## Request headers - -This request does not use any authorization. The endpoint is available to all tasks and applications. - -| Header name | Description | Required | Values | -| -------------- | ------ | ------------ |------------ | -| Content-Type | The format of the data to be posted. | Optional | application/json. Default value. | -| Accept | The format of the data to be returned. | Optional | application/json. Default value. | - - -## Request body - -None - -## Return body - -The following example shows the response. - -```js -[ - { - "file_name": "new_photo.jpg", - "traits": { - "blurriness": false, - "faces": false, - "subject_matter": "landscape", - "similarity_check": false, - "rating": 3 - }, - "action": "move_to:/archive", - "id": "aab5" - } -] -``` - -## Return status - -| Status value | Return status | Description | -| ------------- | ----------- | ----------- | -| 200 | Success | Requested data returned successfully | -| 404 | Error | Specified user record not found | -| ECONNREFUSED | N/A | Service is offline. Start the service and try again. | \ No newline at end of file diff --git a/docs/api/reference-topics/photos/index.md b/docs/api/reference-topics/photos/index.md deleted file mode 100644 index 91441f5..0000000 --- a/docs/api/reference-topics/photos/index.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -layout: page ---- -# `photo` resource - -Base endpoint: - -```shell -{{base_url}}/photos -``` - -Contains information about the users of the service. - -To add photos, the user must be added to the service first. - -## Resource properties - -Sample `photo` resource - -```js -{ - "user_id": 1, - "file_name": "vacation1.jpg", - "traits": { - "blurriness": true, - "faces": true, - "subject_matter": "landscape", - "similarity_check": false, - "rating": 3 - }, - "action": "move_to:/archive", - "id": 1 - } -``` - -| Property name | Type | Description | -| ------------- | ----------- | ----------- | -| `user_id` | string | The unique identifier of the user who owns the photo. | -| `file_name` | string | The name of the photo file. | -| `traits` | string | The traits noted in the phoot. | -| `traits.blurriness` | boolean | Indicates if the photo is blurry. | -| `traits.faces` | boolean | Indicates if there are faces in the photo. | -| `traits.subject_matter` | string | The subject of what's in the photo. | -| `traits.similarity_check` | boolean | Indicates if the photo is similar to another photo. | -| `traits.rating` | number | The rating of the traits in the photo. | -| `action` | string | Indicates the actions to be taken based on the photo check. | -| `action.id` | string | The unique identifier of the action. | - - - diff --git a/docs/api/reference-topics/photos/show-one-photo.md b/docs/api/reference-topics/photos/show-one-photo.md deleted file mode 100644 index 419982e..0000000 --- a/docs/api/reference-topics/photos/show-one-photo.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -layout: page ---- - -# Show photo by id - -Returns a single photo resource. - -## URL - -```shell - -{GET} {base_url}/photos/{id} -``` - -## Params - -| Parameter name | Type | Description | -| -------------- | ------ | ------------ | -| `id` | String | The unique identifier of the photo | - -## Request headers - -This request does not use any authorization. The endpoint is available to all tasks and applications. - -| Header name | Description | Required | Values | -| -------------- | ------ | ------------ |------------ | -| Content-Type | The format of the data to be posted. | Optional | application/json. Default value. | -| Accept | The format of the data to be returned. | Optional | application/json. Default value. | - - -## Request body - -None - -## Return body - -The following example shows the response. - -```js -[ - { - "file_name": "new_photo.jpg", - "traits": { - "blurriness": false, - "faces": false, - "subject_matter": "landscape", - "similarity_check": false, - "rating": 3 - }, - "action": "move_to:/archive", - "id": "aab5" - } -] -``` - -## Return status - -| Status value | Return status | Description | -| ------------- | ----------- | ----------- | -| 200 | Success | Requested data returned successfully | -| 404 | Error | Specified user record not found | -| ECONNREFUSED | N/A | Service is offline. Start the service and try again. | \ No newline at end of file diff --git a/docs/api/reference-topics/photos/update-a-photo.md b/docs/api/reference-topics/photos/update-a-photo.md deleted file mode 100644 index 5ae253f..0000000 --- a/docs/api/reference-topics/photos/update-a-photo.md +++ /dev/null @@ -1,83 +0,0 @@ ---- -layout: page ---- - -# Add a new photo - -Use this operation to update an existing photo resource. - -## URL - -```shell - -{PUT} {base_url}/photos/{id} -``` - -## Params - -| Parameter name | Type | Description | -| -------------- | ------ | ------------ | -| `file_name` | String | The name of the photo file | -| `traits.blurriness` | Boolean | Indicates if the photo is blurry | -| `traits.faces` | Boolean | Indicates if the photo contains faces | -| `traits.subject_matter` | String | Description of the subject of the photo | -| `traits.similarity_check` | Boolean | Indicates the similiary of the photo | -| `traits.rating` | Number | Quality rating of the photo | -| `action` | String | Specifies the action to take on the photo | - -## Request headers - -This request does not use any authorization. The endpoint is available to all tasks and applications. - -| Header name | Description | Required | Values | -| -------------- | ------ | ------------ |------------ | -| Content-Type | The format of the data to be posted. | Optional | application/json. Default value. | -| Accept | The format of the data to be returned. | Optional | application/json. Default value. | - - -## Request body - -```js -[ - { - "file_name": "new_photo.jpg", - "traits": { - "blurriness": true, - "faces": true, - "subject_matter": "landscape", - "similarity_check": false, - "rating": 3 - }, - "action": "move_to:/archive" - } -] -``` - -## Response body - -The following example shows the response. - -```js -[ - { - "id": "aab5", - "file_name": "new_photo.jpg", - "traits": { - "blurriness": true, - "faces": true, - "subject_matter": "landscape", - "similarity_check": false, - "rating": 3 - }, - "action": "move_to:/archive" - } -] -``` - -## Return status - -| Status value | Return status | Description | -| ------------- | ----------- | ----------- | -| 201 | Created | The request has been fulfilled and resulted in a new resource being created. | -| 404 | Error | Specified user record not found | -| ECONNREFUSED | N/A | Service is offline. Start the service and try again. | \ No newline at end of file diff --git a/docs/api/reference-topics/users/add-new-user.md b/docs/api/reference-topics/users/add-new-user.md deleted file mode 100644 index e25876c..0000000 --- a/docs/api/reference-topics/users/add-new-user.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -layout: page ---- - -# Add a new user - -Use this operation to create a new user. - -## URL - -```shell - -{POST} {base_url}/users -``` - -## Params - -| Parameter name | Type | Description | -| -------------- | ------ | ------------ | -| `last_name` | String | The user's last name | -| `first_name` | String | The user's first name | -| `email` | String | The user's email address | - - - -## Request headers - -This request does not use any authorization. The endpoint is available to all tasks and applications. - -| Header name | Description | Required | Values | -| -------------- | ------ | ------------ |------------ | -| Content-Type | The format of the data to be posted. | Optional | application/json. Default value. | -| Accept | The format of the data to be returned. | Optional | application/json. Default value. | - - -## Request body - -```js -[ - { - "last_name": "Doe", - "first_name": "John", - "email": "j.doe@example.com", - } -] -``` - -## Return body - -The following example shows the response. - -```js -[ - { - "last_name": "Doe", - "first_name": "John", - "email": "j.doe@example.com", - "id": 1 - } -] -``` - -## Return status - -| Status value | Return status | Description | -| ------------- | ----------- | ----------- | -| 201 | Created | The request has been fulfilled and resulted in a new resource being created. | -| 404 | Error | Specified user record not found | -| ECONNREFUSED | N/A | Service is offline. Start the service and try again. | \ No newline at end of file diff --git a/docs/api/reference-topics/users/delete-user.md b/docs/api/reference-topics/users/delete-user.md deleted file mode 100644 index 13c5294..0000000 --- a/docs/api/reference-topics/users/delete-user.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -layout: page ---- - -# Delete a user - -Use this operation to delete a user resource. You need to retrieve the user's id for this operation. Refer to [Read one user](/read-one-user.md) to get the user id. - -## URL - -```shell - -{DELETE} {base_url}/users/{id} -``` - -## Params - -| Parameter name | Type | Description | -| -------------- | ------ | ------------ | -| `id` | String | The unique identifier of the user | - -## Request headers - -This request does not use any authorization. The endpoint is available to all tasks and applications. - -| Header name | Description | Required | Values | -| -------------- | ------ | ------------ |------------ | -| Content-Type | The format of the data to be posted. | Optional | application/json. Default value. | -| Accept | The format of the data to be returned. | Optional | application/json. Default value. | - - -## Request body - -None - -## Return body - -The following example shows the response. - -```js -[ - { - "last_name": "Doe", - "first_name": "John", - "email": "j.doe@example.com", - "id": 1 - } -] -``` - -## Return status - -| Status value | Return status | Description | -| ------------- | ----------- | ----------- | -| 200 | Success | Requested data returned successfully | -| 404 | Error | Specified user record not found | -| ECONNREFUSED | N/A | Service is offline. Start the service and try again. | \ No newline at end of file diff --git a/docs/api/reference-topics/users/get-all-users.md b/docs/api/reference-topics/users/get-all-users.md deleted file mode 100644 index 037e764..0000000 --- a/docs/api/reference-topics/users/get-all-users.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -layout: page ---- - -# Get all users - -Returns all users of the service. - -## URL - -```shell - -{GET} {base_url}/users -``` - - - - -## Request headers - -| Header name | Description | Required | Values | -| -------------- | ------ | ------------ |------------ | -| Content-Type | The format of the data to be posted. | Optional | application/json. Default value. | -| Accept | The format of the data to be returned. | Optional | application/json. Default value. | - -## Return body - -The following example shows the response. - - ```js - [ - { - "last_name": "Smith", - "first_name": "Ferdinand", - "email": "f.smith@example.com", - "id": 1 - }, - { - "last_name": "Jones", - "first_name": "Jill", - "email": "j.jones@example.com", - "id": 2 - } - ``` - -## Return status - -| Status value | Return status | Description | -| ------------- | ----------- | ----------- | -| 200 | Success | Requested data returned successfully | -| 404 | Error | Specified user record not found | -| ECONNREFUSED | N/A | Service is offline. Start the service and try again. | \ No newline at end of file diff --git a/docs/api/reference-topics/users/index.md b/docs/api/reference-topics/users/index.md deleted file mode 100644 index 3ccae73..0000000 --- a/docs/api/reference-topics/users/index.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -layout: page ---- -# `user` resource - -Base endpoint: - -```shell -{base_url}/users -``` - -Contains information about the users of the service. - -To have photos in the service, the user must be added to the service first. - -## Resource properties - -Sample `user` resource - -```js -{ - "last_name": "Smith", - "first_name": "Ferdinand", - "email": "f.smith@example.com", - "id": 1 -} -``` - -| Property name | Type | Description | -| ------------- | ----------- | ----------- | -| `last_name` | string | The user's last name | -| `first_name` | string | The user's first name | -| `email` | string | The user's email address | -| `id` | number | The user's unique record ID | - -## Operations - -The `user` resource supports these operations. - -### READ (GET) - -* [Get all users](get-all-users) -* [Get users by ID](show-one-user) - -### CREATE (POST) - -* [Create user](add-new-user) - -### UPDATE (PUT) - -* [Update user by ID](update-user) - -### DELETE - -* [Delete user by ID](delete-user) diff --git a/docs/api/reference-topics/users/show-one-user.md b/docs/api/reference-topics/users/show-one-user.md deleted file mode 100644 index fae7517..0000000 --- a/docs/api/reference-topics/users/show-one-user.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -layout: page ---- - -# Get user by id - -Returns a single user using their id. - -## URL - -```shell - -{GET} {base_url}/users/{id} -``` - -## Params - -| Parameter name | Type | Description | -| -------------- | ------ | ------------ | -| `id` | String | The unique identifier of the user | - -## Request headers - -This request does not use any authorization. The endpoint is available to all tasks and applications. - -| Header name | Description | Required | Values | -| -------------- | ------ | ------------ |------------ | -| Content-Type | The format of the data to be posted. | Optional | application/json. Default value. | -| Accept | The format of the data to be returned. | Optional | application/json. Default value. | - - -## Request body - -None - -## Return body - -The following example shows the response. - -```js -[ - { - "last_name": "Doe", - "first_name": "John", - "email": "j.doe@example.com", - "id": 1 - } -] -``` - -## Return status - -| Status value | Return status | Description | -| ------------- | ----------- | ----------- | -| 200 | Success | Requested data returned successfully | -| 404 | Error | Specified user record not found | -| ECONNREFUSED | N/A | Service is offline. Start the service and try again. | \ No newline at end of file diff --git a/docs/api/reference-topics/users/update-user.md b/docs/api/reference-topics/users/update-user.md deleted file mode 100644 index 593e019..0000000 --- a/docs/api/reference-topics/users/update-user.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -layout: page ---- - -# Update a user - -Use this operation to update a user resource. You need to retrieve the user's id for this operation. Refer to [Read one user](/read-one-user.md) to get the user id. - -## URL - -```shell - -{PUT} {base_url}/users/{id} -``` - -## Params - -| Parameter name | Type | Description | -| -------------- | ------ | ------------ | -| `id` | String | The unique identifier of the user | - -## Request headers - -This request does not use any authorization. The endpoint is available to all tasks and applications. - -| Header name | Description | Required | Values | -| -------------- | ------ | ------------ |------------ | -| Content-Type | The format of the data to be posted. | Optional | application/json. Default value. | -| Accept | The format of the data to be returned. | Optional | application/json. Default value. | - - -## Request body - -None - -## Return body - -The following example shows the response. - -```js -[ - { - "last_name": "Doe", - "first_name": "John", - "email": "j.doe@example.com", - "id": 1 - } -] -``` - -## Return status - -| Status value | Return status | Description | -| ------------- | ----------- | ----------- | -| 200 | Success | Requested data returned successfully | -| 404 | Error | Specified user record not found | -| ECONNREFUSED | N/A | Service is offline. Start the service and try again. | \ No newline at end of file diff --git a/docs/index.md b/docs/index.md deleted file mode 100644 index 7b1983a..0000000 --- a/docs/index.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -layout: page ---- - -# Low quality identifier service API - -The low-quality image identifier service provides a cloud-hosted photo gallery which allows you to identify low quality images to mark and sort them for cleanup. - -This guide shows you how to interact with the low quality identifier service using the REST API. - -## Quickstart - -The quickstart guide shows you how to immediatly begin using this service to tag photos for cleanup. - -[Quickstart](api/quickstart) - -## Tutorials - -Learn how to do common tasks within the low-quality image identifier service. - -Before you begin, you must follow the prerequisite tutorial below. You only have to do this one time per development system. - -* [Getting started](tutorials/before-you) - -After your system is ready, these tutorials show you how to perform common tasks. - -* [Add a new user](tutorials/add-a-new-user-tutorial) -* [Add a new photo](tutorials/add-a-new-photo-tutorial) -* [View photo quality check results](tutorials/view-photo-quality-checks) - -## API reference docs - -Detailed descriptions of the low-quality image identifier service's resources. - -The API reference documents refer to a `{base_url}` when they -refer to the URL of a resource. The `{base_url}` value depends -on the installation of the service. - -When running a local test, the `{base_url}` is -generally `http://localhost:3000`. - -* [Users resource](api/reference-topics/users) -* [Photos resource](api/reference-topics/photos) \ No newline at end of file diff --git a/docs/tutorials/.DS_Store b/docs/tutorials/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/docs/tutorials/.DS_Store and /dev/null differ diff --git a/docs/tutorials/add-a-new-photo-tutorial.md b/docs/tutorials/add-a-new-photo-tutorial.md deleted file mode 100644 index 019d8d4..0000000 --- a/docs/tutorials/add-a-new-photo-tutorial.md +++ /dev/null @@ -1,80 +0,0 @@ ---- -layout: page ---- - -# Tutorial: Add a new photo - -In this tutorial, you learn the operations needed to -add a new photo. - -Expect this tutorial to take about 15 minutes to complete. - -## Before you start - -Make sure you've completed the [Before you start a tutorial](before-you-start-a-tutorial) topic on the development system you'll use for the tutorial. - -## Add a new photo - -Adding a new photo to the service requires that you add (`POST`) the details of a new [`photo`](../api/photo) resource to the service. - -To add a new photo: - -1. Make sure your local service is running, or start it by using this command, if it's not. - - ```shell - cd /low-quality-identifier-service/api - json-server -w low-quality-identifier-service-source.json - ``` - -1. Open the Postman app on your desktop. -1. In the Postman app, create a new request with these values: - - * **Method**: POST - * **Authorization**: Basic Auth (`username`/`password`) - * **URL**: `{base_url}/photos` - * **Headers**:`Content-Type: application/json` - * **Request body**: - - You can change the values of each property as you'd like. - - ```js - [ - { - "id": "aab5", - "file_name": "new_photo.jpg", - "traits": { - "blurriness": true, - "faces": true, - "subject_matter": "landscape", - "similarity_check": false, - "rating": 3 - }, - "action": "move_to:/archive" - } - ] - ``` - -1. In the Postman app, choose **Send** to make the request. -1. Watch for the response body, which should look something like this. Note that the names should be the same as you used in your **Request body** and the response should include the new photo's `id`. - - ```js - [ - { - "id": "aab5", - "file_name": "new_photo.jpg", - "traits": { - "blurriness": true, - "faces": true, - "subject_matter": "landscape", - "similarity_check": false, - "rating": 3 - }, - "action": "move_to:/archive" - } - ] - ``` - -After doing this tutorial in Postman, you might like to repeat it in -your favorite programming language. To do this, adapt the values from -the tutorial to the properties and arguments that the language uses to -make REST API calls. \ No newline at end of file diff --git a/docs/tutorials/add-a-new-user-tutorial.md b/docs/tutorials/add-a-new-user-tutorial.md deleted file mode 100644 index 3e4b750..0000000 --- a/docs/tutorials/add-a-new-user-tutorial.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -layout: page ---- - -# Tutorial: Add a new user - -In this tutorial, you learn the operations needed to -add a new user. - -Expect this tutorial to take about 15 minutes to complete. - -## Before you start - -Make sure you've completed the [Before you start a tutorial](before-you-start-a-tutorial) topic on the development system you'll use for the tutorial. - -## Add a new user - -Adding a new user to the service requires that you add (`POST`) the details of a new [`user`](../api/user) resource to the service. - -To add a new user: - -1. Make sure your local service is running, or start it by using this command, if it's not. - - ```shell - cd /low-quality-identifier-service/api - json-server -w low-quality-identifier-service-source.json - ``` - -1. Open the Postman app on your desktop. -1. In the Postman app, create a new request with these values: - - * **Method**: POST - * **Authorization**: Basic Auth (`username`/`password`) - * **URL**: `{base_url}/photos` - * **Headers**:`Content-Type: application/json` - * **Request body**: - You can change the values of each property as you'd like. - - ```js - [ - { - "last_name": "Doe", - "first_name": "John", - "email": "j.doe@example.com", - } - ] - ``` - -1. In the Postman app, choose **Send** to make the request. -1. Watch for the response body, which should look something like this. Note that the names should be the same as you used in your **Request body** and the response should include the new user's `id`. - - ```js - [ - { - "last_name": "Doe", - "first_name": "John", - "email": "j.doe@example.com", - "id": 1 - } - ] - ``` - -After doing this tutorial in Postman, you might like to repeat it in -your favorite programming language. To do this, adapt the values from -the tutorial to the properties and arguments that the language uses to -make REST API calls. diff --git a/docs/tutorials/before-you-start.md b/docs/tutorials/before-you-start.md deleted file mode 100644 index 4d25146..0000000 --- a/docs/tutorials/before-you-start.md +++ /dev/null @@ -1,83 +0,0 @@ ---- -layout: page ---- - -# Before you start a tutorial - -These are the steps you must do before you can run the tutorials for **the low-quality image identifier service**. - -Expect this preparation to take about 20 minutes to complete. - -## Preparing for the tutorials - -The following instructions describe how to prepare for running the tutorials on Windows. For information about how to prepare MacOS for the tutorials, visit the [MacOS installation guide](macos-installation). - -### To complete the tutorials in this section, you need the following: - -* A [GitHub account](https://github.com) -* A development system (PC, Mac, or Linux) running a current or -long-term support (LTS version of the operating system). -* The following software on your development system: - * [Git](https://docs.github.com/en/get-started/quickstart/set-up-git) (for the command line) - * [GitHub Desktop](https://desktop.github.com) (optional) - * A fork of the [the low-quality image identifier service repo](https://github.com/UWC2-APIDOC/the low-quality image identifier service-public) - * A current/LTS version of [node.js](https://nodejs.org/en/) - * A current version of [json-server](https://www.npmjs.com/package/json-server) - * A current copy of the database file. You can get this by syncing your fork. - * **TIP**: If you're using a fork of the repo, create a working branch in which to do your tutorials. Create a new branch for each tutorial to prevent a mistake in one from affecting your work in another. - * The [Postman desktop app](https://www.postman.com/downloads/). Because you run the **the low-quality image identifier service service** on your development system with an `http://localhost` hostname, the web-version of Postman can't perform the exercises. - -## Test your development system - -To test your development system, follow these steps: - -1. Create and checkout a test branch of your fork of the the low-quality image identifier service repo. Your `GitHub repo workspace` is the directory that contains your fork of the `the low-quality image identifier service` repo. - - ```shell - cd - ls - # (see the the low-quality image identifier service directory in the list) - cd the low-quality image identifier service - git checkout -b tutorial-test - cd api - json-server -w the low-quality image identifier service db-source.json - ``` - - If your development system is installed correctly, you should see - the service start and display the URL of the service: `http://localhost:3000`. - -2. Make a test call to the service. - - ```shell - curl http://localhost:3000/users - ``` - -3. If the service is running correctly, you should see a list of users from the service, such as in this example. - - ```js - [ - { - "last_name": "Smith", - "first_name": "Ferdinand", - "email": "f.smith@example.com", - "id": 1 - }, - { - "last_name": "Jones", - "first_name": "Jill", - "email": "j.jones@example.com", - "id": 2 - } - ``` - -If you don't see the list of users, or receive an error in any step -of the procedure, investigate and correct the error before continuing. -Some common situations that cause errors include: - -1. You mistyped a command. -2. You aren't in the correct directory. -3. A required software component didn't install correctly. -4. A required software component isn't up to date. - -If you see the list of users from the service, you're ready to do -the tutorials. diff --git a/docs/tutorials/view-photo-quality-checks.md b/docs/tutorials/view-photo-quality-checks.md deleted file mode 100644 index 4af1e99..0000000 --- a/docs/tutorials/view-photo-quality-checks.md +++ /dev/null @@ -1,106 +0,0 @@ ---- -layout: page ---- - -# Tutorial: View photo quality checks - -In this tutorial, you learn the operations needed to view the results of a photo check. - -Expect this tutorial to take about 15 minutes to complete. - -## Before you start - -Make sure you've completed the [Before you start a tutorial](before-you-start-a-tutorial) topic on the development system you'll use for the tutorial. - -## Retreive user id - -Viewing the results of a photo quality check requires knowing your user id. - -To retrieve your user id: - -1. Make sure your local service is running, or start it by using this command, if it's not. - - ```shell - cd /low-quality-identifier-service/api - json-server -w low-quality-identifier-service-source.json - ``` - -1. Open the Postman app on your desktop. -1. In the Postman app, create a new request with these values: - * **METHOD**: GET - * **URL**: `{{base_url}}/users` - * **Headers**:`Content-Type: application/json` - * **Parameters**: `email` - Enter the user's email address in the parameter value. - -1. In the Postman app, choose **Send** to make the request. -1. Watch for the response body, which should look something like this. Note that the names should be the same as you used in your **Request body** and the response should include the user's `id`. You will need this `id` value in the next step. - - ```js - [ - { - "last_name": "Doe", - "first_name": "John", - "email": "j.doe@example.com", - "id": "1" - } - ] - ``` -## See details of photos - -Viewing the results of all photo quality checks requires knowing the photo's id. - -To retrieve the photos: - -1. Make sure your local service is running, or start it by using this command, if it's not. - - ```shell - cd /low-quality-identifier-service/api - json-server -w low-quality-identifier-service-source.json - ``` - -1. Open the Postman app on your desktop. -1. In the Postman app, create a new request with these values: - - * **Method**: Get - * **Authorization**: Basic Auth (`username`/`password`) - * **URL**: `{base_url}/photos` - * **Headers**:`Content-Type: application/json` - * **Parameters**: `user_id` - Enter the user's id in the parameter value. - -1. In the Postman app, choose **Send** to make the request. -1. Watch for the response body, which should look something like this. The response body will show all photos that belong to the user. - -Note the `trait` and `action` values to understand the results of the photo quality check. - - ```js - [ - { - "user_id": 1, - "file_name": "vacation1.jpg", - "traits": { - "blurriness": true, - "faces": true, - "subject_matter": "landscape", - "similarity_check": false, - "rating": 3 - }, - "action": "move_to:/archive", - "id": "1" - }, - { - "user_id": 1, - "file_name": "party1.jpg", - "traits": { - "blurriness": false, - "faces": true, - "subject_matter": "party", - "similarity_check": true, - "rating": 5 - }, - "action": "keep", - "id": "2" - } - ] - ``` diff --git a/postman/.DS_Store b/postman/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/postman/.DS_Store and /dev/null differ diff --git a/postman/Low-quality-photo-identifier-service.postman_collection.json b/postman/Low-quality-photo-identifier-service.postman_collection.json deleted file mode 100644 index 3a2387a..0000000 --- a/postman/Low-quality-photo-identifier-service.postman_collection.json +++ /dev/null @@ -1,339 +0,0 @@ -{ - "info": { - "_postman_id": "ac2df178-7ba5-491f-b860-332ba64f1187", - "name": "Low-quality-photo-identifier-service", - "description": "Thses test requires this environment variable:\n\n- **`base_url`**: the base URL of the test server. For local testing with the json-server, this is **`http:/localhost:3000`**.", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" - }, - "item": [ - { - "name": "Users", - "item": [ - { - "name": "Create", - "item": [ - { - "name": "Add a new user", - "protocolProfileBehavior": { - "disabledSystemHeaders": { - "content-type": true - } - }, - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"last_name\": \"Jones\",\r\n \"first_name\": \"Jenny\",\r\n \"email\": \"jen.jones@example.com\"\r\n}" - }, - "url": { - "raw": "{{base_url}}/users", - "host": [ - "{{base_url}}" - ], - "path": [ - "users" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Get", - "item": [ - { - "name": "Get users", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{base_url}}/users", - "host": [ - "{{base_url}}" - ], - "path": [ - "users" - ] - }, - "description": "This is a GET request and it is used to \"get\" data from an endpoint. There is no request body for a GET request, but you can use query parameters to help specify the resource you want data on (e.g., in this request, we have `id=1`).\n\nA successful GET response will have a `200 OK` status, and should include some kind of response body - for example, HTML web content or JSON data." - }, - "response": [] - }, - { - "name": "Get user by ID", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{base_url}}/users/{{user_id}}", - "host": [ - "{{base_url}}" - ], - "path": [ - "users", - "{{user_id}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Update", - "item": [ - { - "name": "Update user", - "request": { - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"last_name\": \"Jones\",\r\n \"first_name\": \"Jillio\",\r\n \"email\": \"j.jones@example.com\"\r\n}" - }, - "url": { - "raw": "{{base_url}}/users/{{user_id}}", - "host": [ - "{{base_url}}" - ], - "path": [ - "users", - "{{user_id}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Delete", - "item": [ - { - "name": "Delete user", - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{base_url}}/users/{{user_id}}", - "host": [ - "{{base_url}}" - ], - "path": [ - "users", - "{{user_id}}" - ] - } - }, - "response": [] - } - ] - } - ] - }, - { - "name": "Photos", - "item": [ - { - "name": "Create", - "item": [ - { - "name": "Create a new photo", - "protocolProfileBehavior": { - "disabledSystemHeaders": { - "content-type": true - } - }, - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"last_name\": \"Jones\",\r\n \"first_name\": \"Jenny\",\r\n \"email\": \"jen.jones@example.com\"\r\n}" - }, - "url": { - "raw": "{{base_url}}/photos", - "host": [ - "{{base_url}}" - ], - "path": [ - "photos" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Get", - "item": [ - { - "name": "Show one photo", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{base_url}}/photos/{{photo_id}}", - "host": [ - "{{base_url}}" - ], - "path": [ - "photos", - "{{photo_id}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Update", - "item": [ - { - "name": "Update photo", - "request": { - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"last_name\": \"Jones\",\r\n \"first_name\": \"Jillio\",\r\n \"email\": \"j.jones@example.com\"\r\n}" - }, - "url": { - "raw": "{{base_url}}/photos/{{photo_id}}", - "host": [ - "{{base_url}}" - ], - "path": [ - "photos", - "{{photo_id}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Delete", - "item": [ - { - "name": "Delete photo", - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{base_url}}/photos/{{photo_id}}", - "host": [ - "{{base_url}}" - ], - "path": [ - "photos", - "{{photo_id}}" - ] - } - }, - "response": [] - } - ] - } - ] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], - "variable": [ - { - "key": "id", - "value": "1" - }, - { - "key": "base_url", - "value": "https://postman-rest-api-learner.glitch.me/" - }, - { - "key": "nameID", - "value": "undefined_vip" - } - ] -} \ No newline at end of file