Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

Latest commit

 

History

History
466 lines (344 loc) · 10.9 KB

apidoc.md

File metadata and controls

466 lines (344 loc) · 10.9 KB

Front_Back v1.0.0

apiDoc

AllArticles

Insert a new Article

Back to top

POST /api/v1/articles

Parameter Parameters

Name Type Description
TITLE String

The Title of article to create

Success Response

Success-Response:

HTTP/1.1 201 OK
{
    "ID": 1,
    "TITLE" : "Lorem Ipsum"
}

Success 200

Name Type Description
ID Number

Id of the article created

TITLE String

Title of the article created

Request all articles

Back to top

GET /api/v1/articles

Success Response

Success-Response:

HTTP/1.1 200 OK
[
    {
        "ID": 1,
        "TITLE" : "Lorem Ipsum"
    },
    {
        "ID": 2,
        "TITLE" : "The game"
    },
    ...
]

Success 200

Name Type Description
ID Number

Id of the article

TITLE String

Title of the article

Request all articles with their paragraphs

Back to top

GET /api/v1/articles?paragraphs=true

Success Response

Success-Response:

HTTP/1.1 200 OK
[
    {
        "ID": 1,
        "TITLE" : "Lorem Ipsum",
        "CONTENT": [
                {
                    "ID": 1,
                    "CONTENT": "Lorem ipsum dolor sit amet.",
                    "POSITION": 1,
                    "ARTICLE_ID": 1
                },
                {
                    "ID": 2,
                    "CONTENT": "Ut enim ad minim veniam.",
                    "POSITION": 2,
                    "ARTICLE_ID": 1
                },
                ...
    },
    {
        "ID": 2,
        "TITLE" : "The game",
        "CONTENT" : [
                {
                    "ID": 3,
                    "CONTENT": "Perdu !",
                    "POSITION": 1,
                    "ARTICLE_ID": 2
                },
                ...
    },
    ...
]

Success 200

Name Type Description
ID Number

Id of the article

TITLE String

Title of the article

CONTENT Object[]

List of paragraphs

CONTENT.ID Number

Id of the article patched

CONTENT.TITLE String

Title of the article patched

CONTENT.POSITION Number

The position of the paragraph in the article

CONTENT.ARTICLE_ID Number

The Id of the article associated to the paragraph

AllParagraphs

Request a paragraph

Back to top

GET /api/v1/paragraphs/:id

Success Response

Success-Response:

HTTP/1.1 200 OK
{
        "ID": 1,
        "CONTENT": "Lorem ipsum dolor sit amet.",
        "POSITION": 1,
        "ARTICLE_ID": 1
}

Success 200

Name Type Description
ID Number

Id of the paragraph

CONTENT String

Content of the article

POSITION Number

The position of the paragraph in the article

ARTICLE_ID Number

The Id of the article associated to the paragraphe

Article

Delete an article

Back to top

DELETE /api/v1/articles/:id

Success Response

201 Success-Response:

HTTP/1.1 201 OK
{
    "Response" : "Successfully deleted article with ID <code>ID</code>",
}

Success 200

Name Type Description
ID Number

Id of the deleted article

Error 4xx

Name Type Description
ArticleNotFound

No article with the ID ID found

Error Response

Error-Response:

HTTP/1.1 404 Not Found
    {
        "Error": "No article with the ID <code>ID</code> found"
    }

request Article information

Back to top

GET /api/v1/articles/:id

Success Response

Success-Response:

HTTP/1.1 201 OK
{
    "ID": 1,
    "TITLE" : "Lorem Ipsum"
}

Success 200

Name Type Description
ID Number

Id of the article

TITLE String

Title of the article

Error 4xx

Name Type Description
ArticleNotFound

No article with the ID ID found

Modify an article

Back to top

PATCH /api/v1/articles/:id

Parameter Parameters

Name Type Description
TITLE String

The Title of article to patch

Success Response

Success-Response:

HTTP/1.1 201 OK
{
    "ID": 1,
    "TITLE" : "Lorem Ipsum"
}

Success 200

Name Type Description
ID Number

Id of the article patched

TITLE String

Title of the article patched

Paragraph

Add a new paragraph in the article

Back to top

POST /api/v1/articles/:idA/paragraphs

Parameter Parameters

Name Type Description
CONTENT String

Content of the paragraph patched

POSITION Number

Optional position of the paragraph in the article (if empty, the paragraph is added at the end of the article)

ARTICLE_ID Number

Id of the article associated to the paragraph

Success Response

Success-Response:

HTTP/1.1 201 OK
    [
        {
            "ID": 2,
            "CONTENT": "Ut enim ad minim veniam.",
            "POSITION": 2,
            "ARTICLE_ID": 1
        },
        ...
    ]

Success 200

Name Type Description
ID Number

Id of the article

TITLE String

Title of the article

POSITION Number

The position of the paragraph in the article

ARTICLE_ID Number

The Id of the article associated to the paragraph

Delete a paragraph

Back to top

DELETE /api/v1/paragraphs/:id

Success Response

201 Success-Response:

HTTP/1.1 201 OK
{
    "Response" : "Successfully deleted paragraph with ID <code>ID</code>",
}

Success 200

Name Type Description
ID Number

Id of the deleted paragraph

Error 4xx

Name Type Description
ArticleNotFound

No paragraph with the ID ID found

Error Response

Error-Response:

HTTP/1.1 404 Not Found
    {
        "Error": "No paragraph with the ID <code>ID</code> found"
    }

Get the pos-ian paragraph of the article

Back to top

GET /api/v1/articles/:idA/paragraphs/:pos

Success Response

Success-Response:

HTTP/1.1 201 OK
    [
        {
            "ID": 2,
            "CONTENT": "Ut enim ad minim veniam.",
            "POSITION": 2,
            "ARTICLE_ID": 1
        },
        ...
    ]

Success 200

Name Type Description
ID Number

Id of the article patched

TITLE String

Title of the article patched

POSITION Number

The position of the paragraph in the article

ARTICLE_ID Number

The Id of the article associated to the paragraph

Modify a paragraph

Back to top

PATCH /api/v1/paragraphs/:id

Parameter Parameters

Name Type Description
ID Number

Optional Id of the paragraph patched

CONTENT String

Optional Content of the paragraph patched

POSITION Number

Optional position of the paragraph in the article

ARTICLE_ID Number

Optional Id of the article associated to the paragraph

Success Response

Success-Response:

HTTP/1.1 201 OK
    {
        "ID": 2,
        "CONTENT": "Ut enim ad minim veniam.",
        "POSITION": 2,
        "ARTICLE_ID": 1
    }

Success 200

Name Type Description
ID Number

Id of the article patched

TITLE String

Title of the article patched

POSITION Number

The position of the paragraph in the article

ARTICLE_ID Number

The Id of the article associated to the paragraph

Paragraphs

Request all paragraphs of the article

Back to top

GET /api/v1/articles/:idA/paragraphs

Success Response

Success-Response:

HTTP/1.1 201 OK
    [
        {
            "ID": 2,
            "CONTENT": "Ut enim ad minim veniam.",
            "POSITION": 2,
            "ARTICLE_ID": 1
        },
        ...
    ]

Success 200

Name Type Description
ID Number

Id of the paragraph

CONTENT String

Content of the paragraph

POSITION Number

The position of the paragraph in the article

ARTICLE_ID Number

The Id of the article associated to the paragraph