API update #118

Closed
opened 2022-02-16 09:13:56 +01:00 by mpeltriaux · 2 comments
Owner

Status quo

The API has not been used yet, so we do not need to change the version from v1 into v2.

There has been some changes to CompensationAction, which is not reflected in the API currently. Furthermore we should think about pagination support, since fetching all existing data could result in a large response.

# Status quo *The API has not been used yet, so we do not need to change the version from `v1` into `v2`.* There has been some changes to CompensationAction, which is not reflected in the API currently. Furthermore we should think about pagination support, since fetching all existing data could result in a large response.
mpeltriaux added the
enhancement
label 2022-02-16 09:13:56 +01:00
mpeltriaux self-assigned this 2022-02-16 09:13:56 +01:00
Author
Owner

Pagination

Pagination is now supported for GET requests on all major datatypes (including EcoAccountDeduction)

Example:

{
    "rpp": 5,
    "p": 1,
    "next": null,
    "results": {
        ...
    }
}

next contains null if no further page exists. Otherwise there will be the url to the next available page.

Parameters

Pagination can be configured on a request using the GET parameters

  • rpp: Defines the results per page
  • p: Defines the requested page

ActionType

CompensationAction provides support for multiple action_type entries to define a compensation action more detailed. The API has been extended to provide support for these changes.

GET

Example

...

                "actions": [
                    {
                        "action_types": [
                            {
                                "atom_id": 709234,
                                "long_name": "Sonstiges (s. Erläuterungen)",
                                "short_name": null
                            }
                        ],
                        "action_details": [],
                        "amount": 1.0,
                        "unit": "cm",
                        "comment": ""
                    },
                    {
                        "action_types": [
                            {
                                "atom_id": 709234,
                                "long_name": "Sonstiges (s. Erläuterungen)",
                                "short_name": null
                            }
                        ],
                        "action_details": [
                            {
                                "atom_id": 709648,
                                "long_name": "mit Kettensäge",
                                "short_name": "Kettensäge"
                            }
                        ],
                        "amount": 1.0,
                        "unit": "cm",
                        "comment": "Lorem ipsum dolor sit amet, ..."
                    }
                ],
...

POST / PUT

Example

...

        "actions": [
            {
                "action_types": [
                    "709297",
                    "709289",
                    "709299"
                ],
                "action_details": [
                    "709661"
                ],
                "amount": 555.0,
                "unit": "qm",
                "comment": ""
            },
            {
                "action_types": [
                    "709452"
                ],
                "action_details": [],
                "amount": 1000.0,
                "unit": "qm",
                "comment": ""
            }
        ],
...
# Pagination Pagination is now supported for `GET` requests on all major datatypes (including EcoAccountDeduction) Example: ```json { "rpp": 5, "p": 1, "next": null, "results": { ... } } ``` `next` contains `null` if no further page exists. Otherwise there will be the url to the next available page. ### Parameters Pagination can be configured on a request using the `GET` parameters * `rpp`: Defines the results per page * `p`: Defines the requested page # ActionType CompensationAction provides support for multiple `action_type` entries to define a compensation action more detailed. The API has been extended to provide support for these changes. ## GET Example ```json ... "actions": [ { "action_types": [ { "atom_id": 709234, "long_name": "Sonstiges (s. Erläuterungen)", "short_name": null } ], "action_details": [], "amount": 1.0, "unit": "cm", "comment": "" }, { "action_types": [ { "atom_id": 709234, "long_name": "Sonstiges (s. Erläuterungen)", "short_name": null } ], "action_details": [ { "atom_id": 709648, "long_name": "mit Kettensäge", "short_name": "Kettensäge" } ], "amount": 1.0, "unit": "cm", "comment": "Lorem ipsum dolor sit amet, ..." } ], ... ``` ## POST / PUT Example ```json ... "actions": [ { "action_types": [ "709297", "709289", "709299" ], "action_details": [ "709661" ], "amount": 555.0, "unit": "qm", "comment": "" }, { "action_types": [ "709452" ], "action_details": [], "amount": 1000.0, "unit": "qm", "comment": "" } ], ... ```
mpeltriaux referenced this issue from a commit 2022-02-16 11:38:27 +01:00
mpeltriaux referenced this issue from a commit 2022-02-16 11:38:27 +01:00
Author
Owner

Merged in #119

# Merged in #119
btuelek referenced this issue from a commit 2024-12-05 13:18:37 +01:00
btuelek referenced this issue from a commit 2024-12-05 13:18:37 +01:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: IT-Naturschutz/konova#118
No description provided.