scitran / core

RESTful API
https://scitran.github.io
MIT License
18 stars 18 forks source link

Add endpoint for modifying container info fields #988

Closed nagem closed 6 years ago

nagem commented 6 years ago

Similar to #893, add endpoint to modify container info using set/delete/replace keywords.

POST /api/<container>/<container_id>/info

Format of request:

# set or delete required, can have both
{
    "set": {}, 
    "delete": []
}

OR

{
    "replace": {}
}

Example Requests

POST /api/acquisitions/5984d10adf01e2001433dde8/info HTTP/1.1
Content-Type: application/json

{
    "set": {
        "top_level_key": 123,
        "complex_object_key": {
            "a": 1,
            "b": 2
        }
    },
    "delete": ["keys", "to", "be", "removed"]
}
POST /api/acquisitions/5984d10adf01e2001433dde8/info HTTP/1.1
Content-Type: application/json

{
    "replace": {
        "notice": "this is a full replace of the info field"
    }
}

Breaking Changes

None

There will be a transition period where setting info through PUT /container_name/container_idwill still be allowed. It is expected that eventually all changes in info should go through these new endpoints.

@kofalt SDK related additive changes

Review Checklist

codecov-io commented 6 years ago

Codecov Report

Merging #988 into master will increase coverage by 0.03%. The diff coverage is 97.22%.

@@            Coverage Diff             @@
##           master     #988      +/-   ##
==========================================
+ Coverage   90.39%   90.43%   +0.03%     
==========================================
  Files          50       50              
  Lines        6717     6753      +36     
==========================================
+ Hits         6072     6107      +35     
- Misses        645      646       +1
nagem commented 6 years ago

Tests are added. Feel free to start SDK development at any time @kofalt

nagem commented 6 years ago

Rebased, merging when CI is green.