Skip to content

Commit

Permalink
Merge pull request #1 from uksrc/utils
Browse files Browse the repository at this point in the history
Initial functionality & documentation added
  • Loading branch information
pahjbo authored Oct 3, 2024
2 parents f0b28f3 + 98d0267 commit 9792a1f
Show file tree
Hide file tree
Showing 8 changed files with 1,086 additions and 29 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ The service requires Java 17 or later.
You can run your application in dev mode that enables live coding using:
```shell script
./gradlew quarkusDev

# Or to run without performing tests
./gradlew quarkusDev -x test
```

> **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at http://localhost:8080/q/dev/.
Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dependencies {
implementation("io.quarkus:quarkus-jdbc-postgresql")
implementation("io.quarkus:quarkus-arc")
implementation("io.quarkus:quarkus-resteasy-reactive")
implementation ("jakarta.validation:jakarta.validation-api:3.0.2")
testImplementation("io.quarkus:quarkus-junit5")
testImplementation("io.rest-assured:rest-assured")
}
Expand Down
233 changes: 233 additions & 0 deletions detail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
# archive-service

Details of the functionality of the archive-service endpoints.

------------------------------------------------------------------------------------------
Example resources suitable for **minimal** testing (Mandatory properties only).
#### Example Simple Observation
```xml
<observation>
<id>123456</id>
<collection>e-merlin</collection>
<intent>science</intent>
<uri>auri</uri>
</observation>
```
#### Example Derived Observation
```xml
<Observation>
<id>999</id>
<collection>e-merlin</collection>
<intent>science</intent>
<uri>auri</uri>
<members>anyURI</members>
</Observation>
```
------------------------------------------------------------------------------------------
### REST API details
Endpoints available for interaction with the archive-service.

#### Retrieving observations

<details>
<summary><code>GET</code> <code><b>/observations</b></code> <code>(Returns either all of the observations OR a paginated subset if optional page and size parameters supplied)</code></summary>

##### Parameters

> | name | type | data type | description |
> |------|----------|-----------|--------------------------------------------------------------------------------|
> | page | optional | integer | The page index, zero-indexed |
> | size | optional | integer | The number of observations to return for each page, must be greater than zero. |

##### Responses

> | http code | content-type | response |
> |-----------|-------------------|------------------------------------------|
> | `200` | `application/xml` | `Returned successfully` |
> | `400` | `text/plain` | `{"code":"400","message":"Bad Request"}` |

##### Example cURL

> ```
> curl -X 'GET' -H 'accept: application/xml' 'http://localhost:8080/observations'
> ```
</details>
<details>
<summary><code>GET</code> <code><b>/observations/{observationId}</b></code> <code>(Returns an Observation with the supplied ID, if found)</code></summary>
##### Parameters
> | name | type | data type | description |
> |---------------|-----------|-----------|---------------------------------------------------------------------|
> | observationId | required | String | The unique identifier of a specific Observation (Simple or Derived) |
##### Responses
> | http code | content-type | response |
> |-----------|-------------------|-----------------------------------------------|
> | `201` | `application/xml` | `Observation found and returned successfully` |
> | `400` | `text/plain` | `{"code":"400","message":"Bad Request"}` |
> | `404` | `text/plain` | Observation not found |
##### Example cURL
> ```
> curl -X 'GET' 'http://localhost:8080/observations/23456' -H 'accept: application/xml'
> ```
</details>
<details>
<summary><code>GET</code> <code><b>/observations/collection/{collectionId}</b></code> <code>(Returns all observations for the supplied collectionId, if found)</code></summary>
##### Parameters
> | name | type | data type | description |
> |--------------|----------|-----------|--------------------------------------------------------------------------------|
> | collectionId | required | String | The unique identifier of a specific collection |
> | page | optional | integer | The page index, zero-indexed |
> | size | optional | integer | The number of observations to return for each page, must be greater than zero. |
##### Responses
> | http code | content-type | response |
> |-----------|-------------------|-------------------------------------------------------------------------------|
> | `201` | `application/xml` | `List of Observation (Simple and/or Derived) found and returned successfully` |
> | `400` | `text/plain` | `{"code":"400","message":"Bad Request"}` |
##### Example cURL
> ```
> curl -X 'GET' 'http://localhost:8080/observations/23456' -H 'accept: application/xml'
> ```
</details>
------------------------------------------------------------------------------------------
#### Adding new Observations
<details>
<summary><code>POST</code> <code><b>/observations/add</b></code> <code>(Add a new observation)</code></summary>
##### Responses
> | http code | content-type | response |
> |---------------|-------------------|-----------------------------------------------------------------|
> | `201` | `application/xml` | `Observation added successfully, body contains new Observation` |
> | `400` | `text/plain` | `{"code":"400","message":"Bad Request"}` |
##### Example cURL
> ```
> curl -v --header "Content-Type: application/xml" -T observation1.xml http://localhost:8080/observations/add
> ```
</details>
<details>
<summary><code>POST</code> <code><b>/observations/derived/add</b></code> <code>(Add a new derived observation)</code></summary>
##### Responses
> | http code | content-type | response |
> |---------------|-------------------|------------------------------------------------------------------------|
> | `201` | `application/xml` | `Observation added successfully, body contains new DerivedObservation` |
> | `400` | `text/plain` | `{"code":"400","message":"Bad Request"}` |
##### Example cURL
> ```
> curl -v --header "Content-Type: application/xml" -T observation1.xml http://localhost:8080/observations/derived/add
> ```
</details>
------------------------------------------------------------------------------------------
#### Updating observations
<details>
<summary><code>PUT</code> <code><b>/observations/update/{observationId}</b></code> <code>(Updates an observation (Simple or Derived) with the same observationId)</code></summary>
##### Parameters
> | name | type | data type | description |
> |---------------|-----------|-----------|-----------------------------------------------------------|
> | observationId | required | String | The unique identifier of a specific observation to update |
##### Responses
> | http code | content-type | response |
> |-----------|-------------------|------------------------------------------|
> | `200` | `application/xml` | `Observation updated successfully` |
> | `400` | `text/plain` | `{"code":"400","message":"Bad Request"}` |
> | `404` | `text/plain` | Observation not found |
##### Example cURL
> ```
> curl -v --header "Content-Type: application/xml" -T observation123.xml http://localhost:8080/observations/update/123
> ```
</details>
------------------------------------------------------------------------------------------
#### Deleting Observations
<details>
<summary><code>GET</code> <code><b>/observations/{observationId}</b></code> <code>(Delete an Observation with the supplied ID, if found)</code></summary>
##### Parameters
> | name | type | data type | description |
> |---------------|-----------|-----------|---------------------------------------------------------------------|
> | observationId | required | String | The unique identifier of a specific Observation (Simple or Derived) |
##### Responses
> | http code | content-type | response |
> |-----------|-------------------|------------------------------------------|
> | `204` | `application/xml` | `Observation deleted` |
> | `400` | `text/plain` | `{"code":"400","message":"Bad Request"}` |
> | `404` | `text/plain` | Observation not found |
##### Example cURL
> ```
> curl -X 'DELETE' 'http://localhost:8080/observations/delete/123' -H 'accept: */*'
> ```
</details>
------------------------------------------------------------------------------------------
#### Retrieving collections
<details>
<summary><code>GET</code> <code><b>/observations/collections</b></code> <code>(Returns the names of all the collections as a TSV (Tab Separated List))</code></summary>
##### Responses
> | http code | content-type | response |
> |-----------|--------------|------------------------------------------|
> | `200` | `text/plain` | `Returned successfully` |
> | `400` | `text/plain` | `{"code":"400","message":"Bad Request"}` |
##### Example cURL
> ```
> curl -X 'GET' -H 'accept: application/xml' 'http://localhost:8080/observations/collections'
> ```
</details>
16 changes: 0 additions & 16 deletions src/main/java/org/uksrc/archive/GreetingResource.java

This file was deleted.

Loading

0 comments on commit 9792a1f

Please sign in to comment.