# Integration test
An integration test runs a test suite with sample data (fixtures) against a running instance of the API. This can be achieved with Rails internals, and mocked through curl bash scripts.
- [ ] Turning this into a Rails integration test, based on
- [Testing Rails Applications — Ruby on Rails Guides](https://guides.rubyonrails.org/testing.html#the-low-down-on-fixtures)
- [ActiveRecord::FixtureSet](https://api.rubyonrails.org/v6.0.2.1/classes/ActiveRecord/FixtureSet.html)
[TOC]
# MVC
## Models
:::info
https://pad.degrowth.net/s/incommon-api-models
:::
## Routes
* [x] addresses
* [x] agents
* [x] categories
* [x] collections
* [x] emails
* [x] entities
* [x] links
* [x] locations
* [x] maps
* [x] phones
* [x] places
* [x] positions
* [x] resources
* [x] roles
* [x] sections
* [x] taxonomies
* [x] things
* [x] users
## Controllers
* show `rg -U "def show\n" | rg .rb | cut -d_ -f1`
* [x] addresses
* [x] agents
* [x] categories
* [x] collections
* [x] emails
* [x] *entities* infers from ResourcesController
* [x] links
* [x] locations
* [x] maps
* [x] phones
* [x] places
* [x] positions
* [x] resources
* [x] roles
* [x] sections
* [x] taxonomies
* [x] things
* [x] users
* create `rg -U "def create\n" | rg .rb | cut -d_ -f1`
* [x] addresses
* [x] **agents**
* [x] categories
* [x] collections
* [x] **emails**
* [ ] ~~*entities* infer from *resources*~~
* [x] links
* [x] locations
* [x] maps
* [x] **phones**
* [x] *places* infer from *resources*
* [x] positions
* [ ] ~~*resources*~~
* [x] **roles**
* [x] sections
* [x] taxonomies
* [x] *things* infer from *resources
* [x] **users**
* update `rg -U "def update\n" | rg .rb | cut -d_ -f1`
* [ ] addresses
* [x] agents
* [ ] categories
* [ ] collections
* [ ] emails
* [ ] ~~entities~~
* [ ] links
* [ ] locations
* [ ] maps
* [ ] phones
* [ ] places
* [ ] positions
* [ ] ~~resources~~
* [ ] roles
* [ ] sections
* [ ] taxonomies
* [ ] things
* [ ] users
* destroy `rg -U "def destroy\n" | rg .rb | cut -d_ -f1`
* [ ] addresses
* [ ] ~~agents~~ https://framagit.org/incommon.cc/incommon-api/merge_requests/8#note_540379
* [ ] categories
* [ ] collections
* [ ] emails
* [ ] ~~entities~~
* [ ] links
* [ ] locations
* [ ] maps
* [ ] phones
* [ ] places
* [ ] positions
* [ ] ~~resources~~
* [ ] roles
* [ ] sections
* [ ] taxonomies
* [ ] things
* [ ] users
# CRUD Actions
## controller actions of HTTP verbs
[🛤 Routes](http://localhost:3000/rails/info/routes)
### Verbs
Verb | Action
- | -
GET | #index
POST | #create
|
GET | #show
PATCH | #update
PUT | #update
DELETE | #destroy
## Delete
## Update
## Read
:::success
implemented
:::
## Create
No *entities* and *resources* neccessary.
### ☑ Thing
##### Fixture
```javascript=
{
"name": "Test thing",
"summary": "Let loose in the world, it seeks meaning.",
"email": "thing@manyworlds.com",
"uri": "https://manyworlds.com",
"visible": true
}
```
##### Request
```bash
curl -d '{"name":"Test thing","summary":"Let loose in the world, it seeks meaning.","email":"thing@manyworlds.com","uri":"https://manyworlds.com","visible":true}' -sL -H 'Accept: application/vnd.api+json' -H 'Content-Type: application/json' http://localhost:3000/things?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b | jq
```
```bash
curl -sL -H 'Accept: application/vnd.api+json' -H 'Content-Type: application/json' -d '{"name":"Fifth thing for testing","summary":"Yet yet another test of some kind.","email":"thing@world.com","uri":"http://world.com","visible":true}' http://localhost:3000/things?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b | fx
```
```bash
curl -sL -H 'Accept: application/vnd.api+json' -H 'Content-Type: application/json' -d '{"name":"7th thing for testing","summary":"Yet yet another test of some kind.","email":"thing@world.com","uri":"http://world.com","visible":true,"uuid":"b02b0def-62aa-49a1-96c6-41331a3098b9"}' http://localhost:3000/things?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b | jq
```
##### Response
```javascript=
{
"data": {
"id": "7a4e84d1-5136-4bf3-b315-79da0960ba21",
"type": "things",
"attributes": {
"name": "Test thing",
"summary": "Let loose in the world,it seeks meaning.",
"description": null,
"main_address": null,
"main_email": "thing@manyworlds.com",
"main_link": "https://manyworlds.com",
"main_phone": null,
"type": "Thing",
"uuid": "7a4e84d1-5136-4bf3-b315-79da0960ba21",
"visible": true,
"created_at": "2020-02-27T15:21:16.456Z",
"updated_at": "2020-02-27T15:21:16.456Z"
},
"relationships": {
"agent": {
"meta": {
"included": false
}
},
"locations": {
"meta": {
"included": false
}
},
"addresses": {
"meta": {
"included": false
}
},
"emails": {
"meta": {
"included": false
}
},
"links": {
"meta": {
"included": false
}
},
"phones": {
"meta": {
"included": false
}
},
"collections": {
"meta": {
"included": false
}
}
},
"links": {
"self": "http://api.example.net/resources/7a4e84d1-5136-4bf3-b315-79da0960ba21"
},
"meta": {
"current": {
"agent_name": "IN COMMON Agent",
"agent_uuid": "7218b579-a1b4-4318-9fa8-e8dbff2a61c0",
"user_uuid": "6c8be57b-5730-428d-bdf2-ff9bcb37d7fd",
"restricted": true,
"anonymous": true,
"locale": "en"
}
}
},
"jsonapi": {
"version": "1.0"
}
}
```
### ☑ Place
##### Fixture
```javascript=
{
"name": "Circus Homo Novus",
"address": "Adamߴs Route 42, Laniakea",
"description": "We come from nothing, we go back to nothing.\nWhat have you lost?\n\nNothing!",
"email": "i@chn.io",
"uri": "https://chn.io"
}
```
##### Request
```bash
curl -sL -H 'Accept: application/vnd.api+json' -H 'Content-Type: application/json' -d '{"name":"Circus Homo Novus","address":{"street":"Adamߴs Route 42","country":"DE","region":"Laniakea"},"description":"We come from nothing, we go back to nothing.\nWhat have you lost?\n\nNothing\!","phone":"+491753211525","email":"i@chn.io","uri":"https://chn.io","visible":true}' http://localhost:3000/places?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b | jq
```
##### Response
```javascript=
{
"data": {
"id": "94ac421e-1f94-47ad-8045-83a89759e8b5",
"type": "places",
"attributes": {
"name": "Circus Homo Novus",
"summary": null,
"description": "We come from nothing, we go back to nothing.\nWhat have you lost?\n\nNothing!",
"main_address": {
"id": 3022,
"street": "Adamߴs Route 42",
"pobox": null,
"postal_code": null,
"locality": null,
"region": "Laniakea",
"country": "DE",
"created_at": "2020-02-28T00:09:15.691Z",
"updated_at": "2020-02-28T00:09:15.691Z"
},
"main_email": "i@chn.io",
"main_link": "https://chn.io",
"main_phone": "+49 175 3211 525",
"type": "Place",
"uuid": "94ac421e-1f94-47ad-8045-83a89759e8b5",
"visible": true,
"created_at": "2020-02-28T00:09:41.567Z",
"updated_at": "2020-02-28T00:09:41.567Z"
},
"relationships": {
"agent": {
"meta": {
"included": false
}
},
"locations": {
"meta": {
"included": false
}
},
"addresses": {
"meta": {
"included": false
}
},
"emails": {
"meta": {
"included": false
}
},
"links": {
"meta": {
"included": false
}
},
"phones": {
"meta": {
"included": false
}
},
"collections": {
"meta": {
"included": false
}
}
},
"links": {
"self": "http://api.example.net/places/94ac421e-1f94-47ad-8045-83a89759e8b5"
},
"meta": {
"current": {
"agent_name": "IN COMMON Agent",
"agent_uuid": "7218b579-a1b4-4318-9fa8-e8dbff2a61c0",
"user_uuid": "6c8be57b-5730-428d-bdf2-ff9bcb37d7fd",
"restricted": true,
"anonymous": true,
"locale": "en"
}
}
},
"jsonapi": {
"version": "1.0"
}
}
```
### ☑ Link
##### Fixture
```javascript=
{
"uri":"http://federated.wiki"
}
```
##### Request
```bash
curl -sL -H 'Accept: application/vnd.api+json' -H 'Content-Type: application/json' -d '{"uri":"http://federated.wiki"}' http://localhost:3000/links?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b | fx
```
##### Response
http://localhost:3000/links/3219?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b
```javascript=
{
"data": {
"id": "3219",
"type": "links",
"attributes": {
"uri": "http://federated.wiki",
"secure": false,
"not_found": false,
"cert_error": false,
"server_error": false,
"created_at": "2020-02-19T11:19:50.105Z",
"updated_at": "2020-02-19T11:19:50.105Z"
},
"relationships": {
"agents": {
"meta": {
"included": false
}
},
"resource_links": {
"meta": {
"included": false
}
}
},
"meta": {
"current": {
"agent_name": "IN COMMON Agent",
"agent_uuid": "7218b579-a1b4-4318-9fa8-e8dbff2a61c0",
"user_uuid": "6c8be57b-5730-428d-bdf2-ff9bcb37d7fd",
"restricted": true,
"anonymous": true,
"locale": "en"
}
}
},
"jsonapi": {
"version": "1.0"
}
}
```
### ☑ Phone
##### Fixture
```javascript=
{
"number":"+491753211525"
}
```
##### Request
```bash
curl -sL -H 'Accept: application/vnd.api+json' -H 'Content-Type: application/json' -d '{"number":"+491753211525"}' http://localhost:3000/phones?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b | fx
```
##### Response
http://localhost:3000/phones/2150?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b
```javascript=
{
"data": {
"id": "2050",
"type": "phones",
"attributes": {
"number": "+491753211525",
"failing": false,
"created_at": "2020-02-19T11:47:50.516Z",
"updated_at": "2020-02-19T11:47:50.516Z"
},
"relationships": {
"resource_phones": {
"meta": {
"resources_count": 0,
"entities_count": 0,
"places_count": 0,
"services_count": 0,
"things_count": 0
}
}
},
"links": {
"self": "http://api.example.net/phones/2050"
},
"meta": {
"current": {
"agent_name": "IN COMMON Agent",
"agent_uuid": "7218b579-a1b4-4318-9fa8-e8dbff2a61c0",
"user_uuid": "6c8be57b-5730-428d-bdf2-ff9bcb37d7fd",
"restricted": true,
"anonymous": true,
"locale": "en"
}
}
},
"jsonapi": {
"version": "1.0"
}
}
```
### ☑ Email
##### Fixture
```javascript=
{
"address":"yala@allmende.io"
}
```
##### Request
```bash
curl -sL -H 'Accept: application/vnd.api+json' -H 'Content-Type: application/json' -d '{"address":"yala@allmende.io"}' http://localhost:3000/emails?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b | fx
```
##### Response
http://localhost:3000/emails/1262?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b
```javascript=
{
"data": {
"id": "1262",
"type": "emails",
"attributes": {
"address": "ad34a18e88b8641abb52887a530ccbd0154da1e120b271b36f553bdbe4d174e0",
"bouncing": false,
"failing": false,
"created_at": "2020-02-19T12:08:56.667Z",
"updated_at": "2020-02-19T12:08:56.667Z"
},
"relationships": {
"resource_emails": {
"meta": {
"resources_count": 0,
"entities_count": 0,
"places_count": 0,
"services_count": 0,
"things_count": 0
}
}
},
"links": {
"self": "http://api.example.net/emails/1262"
},
"meta": {
"current": {
"agent_name": "IN COMMON Agent",
"agent_uuid": "7218b579-a1b4-4318-9fa8-e8dbff2a61c0",
"user_uuid": "6c8be57b-5730-428d-bdf2-ff9bcb37d7fd",
"restricted": true,
"anonymous": true,
"locale": "en"
}
}
},
"jsonapi": {
"version": "1.0"
}
}
```
### ☑ Map
##### Fixture
```javascript=
{
"zoom": 12,
"agent_id": 12132,
"collection_id": 16,
"position_id": 8234,
"taxonomy_id": 27
}
```
##### Request
```bash=
curl -sL -H 'Accept: application/vnd.api+json' -H 'Content-Type: application/json' -d '{"zoom":12,"agent_id":12132,"collection_id":16,"position_id":8234,"taxonomy_id":27}' http://localhost:3000/maps?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b | jq
```
##### Response
http://localhost:3000//maps/c6289739-1179-457c-ab09-3aefab9a0d19?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b
```javascript=
{
"data": {
"id": "c6289739-1179-457c-ab09-3aefab9a0d19",
"type": "maps",
"attributes": {
"id": 2,
"zoom": 12,
"center": {
"longitude": 4.3510466,
"latitude": 50.8378565
}
},
"relationships": {
"collection": {
"links": {
"self": "http://api.example.net/collections/16"
},
"meta": {
"resource_count": 0
}
},
"position": {
"links": {
"self": "http://api.example.net/positions/8234"
}
},
"taxonomy": {
"meta": {
"included": false
}
},
"resources": {
"meta": {
"included": false
}
}
},
"links": {
"self": "http://api.example.net/maps/c6289739-1179-457c-ab09-3aefab9a0d19"
},
"meta": {
"current": {
"agent_name": "IN COMMON Agent",
"agent_uuid": "7218b579-a1b4-4318-9fa8-e8dbff2a61c0",
"user_uuid": "6c8be57b-5730-428d-bdf2-ff9bcb37d7fd",
"restricted": true,
"anonymous": true,
"locale": "en"
}
}
},
"jsonapi": {
"version": "1.0"
}
}
```
### ☑ Location
##### Fixture
```javascript=
{
locatable_id: 12155,
position_id: 8234
}
```
##### Request
```bash=
curl -sL -H 'Accept: application/vnd.api+json' -H 'Content-Type: application/json' -d '{"locatable_id":12155,"position_id":8234}' http://localhost:3000/locations?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b | jq
```
##### Response
```javascript=
{
"data": {
"id": "12042",
"type": "locations",
"attributes": {
"locatable_type": "Resource",
"locatable_id": 12155,
"position_id": 8234,
"created_at": "2020-03-03T03:29:47.604Z",
"updated_at": "2020-03-03T03:29:47.604Z"
},
"relationships": {
"locatable": {
"links": {
"self": "http://api.example.net/resources/2cc316a8-95b1-4635-9979-f93a0e03033e"
}
},
"position": {
"links": {
"self": "http://api.example.net/positions/8234"
}
}
},
"links": {
"self": "http://api.example.net/locations/12042"
},
"meta": {
"current": {
"agent_name": "IN COMMON Agent",
"agent_uuid": "7218b579-a1b4-4318-9fa8-e8dbff2a61c0",
"user_uuid": "6c8be57b-5730-428d-bdf2-ff9bcb37d7fd",
"restricted": true,
"anonymous": true,
"locale": "en"
}
}
},
"jsonapi": {
"version": "1.0"
}
}
```
### ☑ Position
##### Fixture
adapted from PositionFabricator
```javascript=
{
"elevation": 9.99,
"geo_type": "Point",
"geometry": "POINT (4.3510466 50.8378565)",
"latitude": 50.8378565,
"longitude": 4.3510466
}
```
##### Request
```bash=
curl -sL -H 'Accept: application/vnd.api+json' -H 'Content-Type: application/json' -d '{"elevation": 9.99,"geo_type": "Point","geometry":"POINT (4.3510466 50.8378565)","latitude":50.8378565,"longitude":4.3510466}' http://localhost:3000/positions?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b | jq
```
##### Response
http://localhost:3000/positions/8234?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b
```javascript=
{
"data": {
"id": "8234",
"type": "positions",
"attributes": {
"box": null,
"elevation": "9.99",
"geo_type": "Point",
"geometry": "POINT (4.3510466 50.8378565)",
"latitude": "50.8378565",
"longitude": "4.3510466",
"radius": null,
"created_at": "2020-03-03T00:45:43.810Z",
"updated_at": "2020-03-03T00:45:43.810Z"
},
"relationships": {
"locations": {
"meta": {
"included": false
}
}
},
"links": {
"self": "http://api.example.net/positions/8234"
},
"meta": {
"current": {
"agent_name": "IN COMMON Agent",
"agent_uuid": "7218b579-a1b4-4318-9fa8-e8dbff2a61c0",
"user_uuid": "6c8be57b-5730-428d-bdf2-ff9bcb37d7fd",
"restricted": true,
"anonymous": true,
"locale": "en"
}
}
},
"jsonapi": {
"version": "1.0"
}
}
```
### ☑ Collection
##### Fixture
```javascript=
{
"name": "Test collection",
"agent_id": "12132",
"summary": "This cannot exceed 160 chars.",
"description": "This is a test description that might reach up to 8 kilobytes."
}
```
:::info
`agent_id` does not read the publicly exposed UUIDs, but database internal `id`s
:::
##### Request
```bash
curl -sL -H 'Accept: application/vnd.api+json' -H 'Content-Type: application/json' -d '{"name": "Test collection","agent_id":"12132","summary": "This cannot exceed 160 chars.","description": "This is a test description that might reach up to 8 kilobytes."}' http://localhost:3000/collections?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b | fx
```
##### Response
http://localhost:3000/collections/16?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b
```javascript=
{
"data": {
"id": "16",
"type": "collections",
"attributes": {
"name": "Test collection",
"summary": "This cannot exceed 160 chars.",
"description": "This is a test description that might reach up to 8 kilobytes.",
"created_at": "2020-02-19T10:38:02.176Z",
"updated_at": "2020-02-19T10:38:02.176Z"
},
"relationships": {
"agent": {
"links": {
"self": "http://api.example.net/agents/4734e387-a43a-45a6-b34f-13423da995a4"
}
},
"maps": {
"meta": {
"included": false
}
},
"resource_collections": {
"meta": {
"included": false
}
},
"resources": {
"meta": {
"resource_count": 0
}
}
},
"links": {
"self": "http://api.example.net/collections/16"
},
"meta": {
"current": {
"agent_name": "IN COMMON Agent",
"agent_uuid": "7218b579-a1b4-4318-9fa8-e8dbff2a61c0",
"user_uuid": "6c8be57b-5730-428d-bdf2-ff9bcb37d7fd",
"restricted": true,
"anonymous": true,
"locale": "en"
}
}
},
"jsonapi": {
"version": "1.0"
}
}
```
### ☑ Role
##### Fixture
```javascript=
{
"user_id":"-1",
"agent_id":"-1",
"roles":8
}
```
##### Request
```bash=
curl -sL -H 'Accept: application/vnd.api+json' -H 'Content-Type: application/json' -d '{"user_id":"-1","agent_id":"-1","roles":8}' http://localhost:3000/roles?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b | jq
```
##### Response
```javascript=
```
### ☑ User
##### Fixture
```javascript=
{
"username": "test user",
"password": "very strong password"
}
```
##### Request
```bash
curl -sL -H 'Accept: application/vnd.api+json' -H 'Content-Type: application/json' -d '{"username":"test user","password":"very strong password"}' http://localhost:3000/users?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b | jq
```
##### Response
```javascript=
```
### ☑ Section
##### Fixture
```javascript=
{
"name": "Section 1",
"category_id": 21,
"summary": "Test section for test category"
}
```
```javascript=
{
"name": "Section 2",
"category_id": 21,
"summary": "Another test section for the same test category"
}
```
##### Request
```bash
curl -sL -H 'Accept: application/vnd.api+json' -H 'Content-Type: application/json' -d '{"name": "Section 1","category_id": 21,"summary": "Test section for test category"}' http://localhost:3000/sections?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b | jq
```
```bash
curl -sL -H 'Accept: application/vnd.api+json' -H 'Content-Type: application/json' -d '{"name": "Section 2","category_id": 21,"summary": "Another test section for the same test category"}' http://localhost:3000/sections?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b | jq
```
##### Response
http://localhost:3000/sections/113?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b
```javascript=
{
"data": {
"id": "113",
"type": "sections",
"attributes": {
"name": "Section 1",
"summary": "Test section for test category",
"description": null,
"color": null,
"created_at": "2020-02-18T15:48:04.045Z",
"updated_at": "2020-02-18T15:48:04.045Z"
},
"relationships": {
"category": {
"meta": {
"included": false
}
},
"resources": {
"meta": {
"count": 0
}
}
},
"links": {
"self": "http://api.example.net/sections/113"
},
"meta": {
"current": {
"agent_name": "IN COMMON Agent",
"agent_uuid": "7218b579-a1b4-4318-9fa8-e8dbff2a61c0",
"user_uuid": "6c8be57b-5730-428d-bdf2-ff9bcb37d7fd",
"restricted": true,
"anonymous": true,
"locale": "en"
}
}
},
"jsonapi": {
"version": "1.0"
}
}
```
```javascript=
{
"data": {
"id": "114",
"type": "sections",
"attributes": {
"name": "Section 2",
"summary": "Another test section for the same test category",
"description": null,
"color": null,
"created_at": "2020-02-18T15:49:51.630Z",
"updated_at": "2020-02-18T15:49:51.630Z"
},
"relationships": {
"category": {
"meta": {
"included": false
}
},
"resources": {
"meta": {
"count": 0
}
}
},
"links": {
"self": "http://api.example.net/sections/114"
},
"meta": {
"current": {
"agent_name": "IN COMMON Agent",
"agent_uuid": "7218b579-a1b4-4318-9fa8-e8dbff2a61c0",
"user_uuid": "6c8be57b-5730-428d-bdf2-ff9bcb37d7fd",
"restricted": true,
"anonymous": true,
"locale": "en"
}
}
},
"jsonapi": {
"version": "1.0"
}
}
```
### ☑ Taxonomy
Depends on:
- Agent
##### Fixture
```javascript=
{
"name": "test taxonomy",
"agent_id": 12132,
"summary": "Tests the Taxonomy API",
"description": "This tests the functionality of the taxonomies/ route of the IN COMMON API."
}
```
```javascript=
{
"name": "test taxonomy",
"agent_id": 12132,
"summary": "Tests the Taxonomy API",
"description": "This tests the functionality of the taxonomies/ route of the IN COMMON API.",
"uuid": "80e7a209-f8af-4ea6-a62d-e30013c8e278"
}
```
##### Requests
```bash
curl -sL -H 'Accept: application/vnd.api+json' -H 'Content-Type: application/json' -d '{"name":"test taxonomy","agent_id": 12132,"summary": "Tests the Taxonomy API","description":"This tests the functionality of the taxonomies/ route of the IN COMMON API."}' http://localhost:3000/taxonomies?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b | jq
```
```bash
curl -sL -H 'Accept: application/vnd.api+json' -H 'Content-Type: application/json' -d '{"name":"test taxonomy","agent_id": 12132,"summary": "Tests the Taxonomy API","description":"This tests the functionality of the taxonomies/ route of the IN COMMON API.","uuid":"80e7a209-f8af-4ea6-a62d-e30013c8e278"}' http://localhost:3000/taxonomies?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b | jq
```
##### Response
http://localhost:3000/taxonomies/80e7a209-f8af-4ea6-a62d-e30013c8e278?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b
```javascript=
{
"data": {
"id": "80e7a209-f8af-4ea6-a62d-e30013c8e278",
"type": "taxonomies",
"attributes": {
"name": "test taxonomy",
"summary": "Tests the Taxonomy API",
"description": "This tests the functionality of the taxonomies/ route of the IN COMMON API.",
"created_at": "2020-02-10T18:52:30.487Z",
"updated_at": "2020-02-10T18:52:30.487Z"
},
"relationships": {
"agent": {
"meta": {
"included": false
}
},
"categories": {
"meta": {
"count": 1
}
},
"sections": {
"meta": {
"included": false
}
}
},
"links": {
"self": "http://api.example.net/taxonomies/80e7a209-f8af-4ea6-a62d-e30013c8e278"
},
"meta": {
"current": {
"agent_name": "IN COMMON Agent",
"agent_uuid": "7218b579-a1b4-4318-9fa8-e8dbff2a61c0",
"user_uuid": "6c8be57b-5730-428d-bdf2-ff9bcb37d7fd",
"restricted": true,
"anonymous": true,
"locale": "en"
}
}
},
"links": {
"agent": "http://localhost:3000/agents/4734e387-a43a-45a6-b34f-13423da995a4"
},
"jsonapi": {
"version": "1.0"
}
}
```
- [ ] include links to `categories` and `sections`
### ☑ Category
Depends on
- Taxonomy
- [ ] Should these also receive and read UUIDs?
- [ ] reveal links? to
- `taxonomies`
- `sections`
##### Fixture
```javascript=
{
"name": "test category",
"taxonomy_id": 27,
"summary": "tests the API",
"description": "This tests the functionality of the categories/ route of the IN COMMON API.",
"color": "#8A2BE2"
}
```
##### Request
```bash
curl -sL -H 'Accept: application/vnd.api+json' -H 'Content-Type: application/json' -d '{"name":"test category","taxonomy_id": 27,"summary": "tests the API","description":"This tests the functionality of the categories/ route of the IN COMMON API.","color":"#8A2BE2"}' http://localhost:3000/categories?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b | jq
```
##### Response
http://localhost:3000/categories/21?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b
```javascript=
{
"data": {
"id": "21",
"type": "categories",
"attributes": {
"name": "test category",
"summary": "tests the API",
"description": "This tests the functionality of the categories/ route of the IN COMMON API.",
"color": null,
"created_at": "2020-02-10T18:57:45.850Z",
"updated_at": "2020-02-10T18:57:45.850Z"
},
"relationships": {
"taxonomy": {
"meta": {
"included": false
}
},
"sections": {
"meta": {
"count": 0
}
}
},
"links": {
"self": "http://api.example.net/categories/21"
},
"meta": {
"current": {
"agent_name": "IN COMMON Agent",
"agent_uuid": "7218b579-a1b4-4318-9fa8-e8dbff2a61c0",
"user_uuid": "6c8be57b-5730-428d-bdf2-ff9bcb37d7fd",
"restricted": true,
"anonymous": true,
"locale": "en"
}
}
},
"jsonapi": {
"version": "1.0"
}
}
```
### ☑ Address
- https://getfakedata.com/address/de_DE
- https://www.fakenamegenerator.com/gen-male-gr-gr.php
- [ ] Should these also receive and read UUIDs?
- [ ] reveal links? to
- `resources`
- `entities`
- `places`
- `services`
- `things`
##### Fixture
```javascript=
{
"street": "Fuhrmannstr. 60",
"postal_code": "52302",
"locality": "Torgau",
"country": "DE"
}
```
```javascript=
{
"street": "8, impasse de Deschamps",
"postal_code": "07185",
"locality": "Couturiernec",
"country": "FR"
}
```
##### Request
```bash
curl -sL -H 'Accept: application/vnd.api+json' -H 'Content-Type: application/json' -d '{"street":"Fuhrmannstr. 60","postal_code": "52302","locality":"Torgau","country":"DE"}' http://localhost:3000/addresses?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b | fx
```
```bash
curl -sL -H 'Accept: application/vnd.api+json' -H 'Content-Type: application/json' -d '{"street":"8, impasse de Deschamps","postal_code": "07185","locality":"Couturiernec","country":"FR"}' http://localhost:3000/addresses?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b | jq
```
##### Response
http://localhost:3000/addresses/3015?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b
```javascript=
{
"data": {
"id": "3015",
"type": "addresses",
"attributes": {
"street": "Fuhrmannstr. 60",
"pobox": null,
"postal_code": "52302",
"locality": "Torgau",
"region": null,
"country": "DE",
"created_at": "2020-02-10T17:47:05.491Z",
"updated_at": "2020-02-10T17:47:05.491Z"
},
"relationships": {
"resource_addresses": {
"meta": {
"resources_count": 0,
"entities_count": 0,
"places_count": 0,
"services_count": 0,
"things_count": 0
}
}
},
"meta": {
"current": {
"agent_name": "IN COMMON Agent",
"agent_uuid": "7218b579-a1b4-4318-9fa8-e8dbff2a61c0",
"user_uuid": "6c8be57b-5730-428d-bdf2-ff9bcb37d7fd",
"restricted": true,
"anonymous": true,
"locale": "en"
}
}
},
"jsonapi": {
"version": "1.0"
}
}
```
http://localhost:3000/addresses/3016?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b
```javascript=
{
"data": {
"id": "3016",
"type": "addresses",
"attributes": {
"street": "8, impasse de Deschamps",
"pobox": null,
"postal_code": "07185",
"locality": "Couturiernec",
"region": null,
"country": "FR",
"created_at": "2020-02-10T17:55:03.868Z",
"updated_at": "2020-02-10T17:55:03.868Z"
},
"relationships": {
"resource_addresses": {
"meta": {
"resources_count": 0,
"entities_count": 0,
"places_count": 0,
"services_count": 0,
"things_count": 0
}
}
},
"meta": {
"current": {
"agent_name": "IN COMMON Agent",
"agent_uuid": "7218b579-a1b4-4318-9fa8-e8dbff2a61c0",
"user_uuid": "6c8be57b-5730-428d-bdf2-ff9bcb37d7fd",
"restricted": true,
"anonymous": true,
"locale": "en"
}
}
},
"jsonapi": {
"version": "1.0"
}
}
```
### ☑ Agent
It turns out it was implemented via AgentCreator in the import scripts, but not yet exposed to the JSONAPI.
- [ ] Have it use encrypted `email` fields?
##### Fixture
```javascript=
{
"name": "yala",
"email": "yala@allmende.io",
"uri": "https://almereyda.de",
"email_validated": true,
"uri_is_origin": true,
"visible": true
}
```
##### Request
```bash
curl -siL -H 'Accept: application/vnd.api+json' -H 'Content-Type: application/json' -d '{"name": "yala", "email": "yala@allmende.io", "uri": "https://almereyda.de", "email_validated": true, "uri_is_origin": true, "visible": true}' http://localhost:3000/agents?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b
```
##### Response
http://localhost:3000/agents/4734e387-a43a-45a6-b34f-13423da995a4?api_key=23d8009f-f2ec-44b6-bcbe-58ad1d3af10b
```javascript=
{
"data": {
"id": "4734e387-a43a-45a6-b34f-13423da995a4",
"type": "agents",
"attributes": {
"name": "yala",
"summary": null,
"description": null,
"email": "yala@allmende.io",
"uri": "https://almereyda.de",
"type": "Agent",
"uuid": "4734e387-a43a-45a6-b34f-13423da995a4",
"visible": true,
"created_at": "2020-01-13T20:40:57.593Z",
"updated_at": "2020-01-13T20:40:57.593Z"
},
"relationships": {
"roles": {
"meta": {
"editor_count": 0,
"maintainer_count": 0,
"leader_count": 0,
"observer_count": 0
}
}
},
"links": {
"self": "http://api.example.net/agents/4734e387-a43a-45a6-b34f-13423da995a4"
},
"meta": {
"current": {
"agent_name": "IN COMMON Agent",
"agent_uuid": "7218b579-a1b4-4318-9fa8-e8dbff2a61c0",
"user_uuid": "6c8be57b-5730-428d-bdf2-ff9bcb37d7fd",
"restricted": true,
"anonymous": true,
"locale": "en"
}
}
},
"jsonapi": {
"version": "1.0"
}
}
```