An open API service indexing awesome lists of open source software.

https://github.com/moonman369/go-crud-api

This a Go Based CRUD-API Endpoint
https://github.com/moonman369/go-crud-api

ba backend clevercloud crud-api go gomodule web-server

Last synced: about 1 year ago
JSON representation

This a Go Based CRUD-API Endpoint

Awesome Lists containing this project

README

          

**This is a Go based CRUD API to store and process movies**

# API Documentation

### 1. GET ALL MOVIES
- Base URL: `https://go-crud-api.cleverapps.io`
- Endpoint: `/movies`
- Method: `GET`
- Example Response:
```
200 OK
[
{
"id": "2",
"isbn": "831479",
"title": "Inception",
"director": {
"firstName": "Christopher",
"lastName": "Nolan"
}
},
{
"id": "3",
"isbn": "15740661",
"title": "Avatar",
"director": {
"firstName": "James",
"lastName": "Cameron"
}
}
]
```



### 2. GET MOVIE BY ID
- Base URL: `https://go-crud-api.cleverapps.io`
- Endpoint: `/movies/[id: numeric string]`
- Method: `GET`
- Example Request: `/movies/2`
- Example Successful Response:
```
200 OK
{
"id": "2",
"isbn": "831479",
"title": "Inception",
"director": {
"firstName": "Christopher",
"lastName": "Nolan"
}
}
```
- Example Unsuccessful Response: `404 NOT FOUND`

### 3. CREATE MOVIE
- Base URL: `https://go-crud-api.cleverapps.io`
- Endpoint: `/movies`
- Method: `POST`
- Example Request Body:
```
{
"title": "movie_name",
"director": {
"firstName": "director_first_name",
"lastName": "director_last_name"
}
}
```
- Example Successful Response:
```
200 OK
{
"id": "3", // plain counter
"isbn": "831479", //random
"title": "movie_name",
"director": {
"firstName": "director_first_name",
"lastName": "director_last_name"
}
}
```

### 4. UPDATE MOVIE
- Base URL: `https://go-crud-api.cleverapps.io`
- Endpoint: `/movies/[id: numeric string]`
- Method: `PUT`
- Exmaple Request Query: `/movies/4`
- Example Request Body:
```
{
"title": "updated_movie_name",
"director": {
"firstName": "updated_director_first_name",
"lastName": "updated_director_last_name"
}
}
```
- Example Successful Response:
```
200 OK
{
"id": "4", // unchanged
"isbn": "831479", // unchanged
"title": "updated_movie_name",
"director": {
"firstName": "updated_director_first_name",
"lastName": "updated_director_last_name"
}
}
```
- Example Unsuccessful Response: `404 NOT FOUND`

### 5. DELETE MOVIE
- Base URL: `https://go-crud-api.cleverapps.io`
- Endpoint: `/movies/[id: numeric string]`
- Method: `DELETE`
- Exmaple Request Query: `/movies/4`
- Example Successful Response: `200 OK`
- Example Unsuccessful Response: `404 NOT FOUND`