← Back to team overview

dhis2-devs-core team mailing list archive

Re: ApiVersioning redux

 

Hi Morten,

this problem surfaced when I added an endpoint for updating custom forms by
POSTing json to /api/*/dataSets/{uid}/form

This after discussing with Halvdan, I annotated the endpoint with the
following version:

@ApiVersion( value = ApiVersion.Version.ALL, exclude = ApiVersion.Version.V23 )

I would expect this to mean that the endpoint should work for default and
24, but not for 23. In practice however, the endpoint works for 23 as well.

To be painfully explicit, I would expect this to work:

curl -u admin:district :8080/api/dataSets/BfMAe6Itzgt/form -X POST -H
'content-type: application/json' -d '{"display":"NORMAL"}' -v
As well as this:

curl -u admin:district :8080/api/24/dataSets/BfMAe6Itzgt/form -X POST -H
'content-type: application/json' -d '{"display":"NORMAL"}' -v
But *not* this:

curl -u admin:district :8080/api/23/dataSets/BfMAe6Itzgt/form -X POST -H
'content-type: application/json' -d '{"display":"NORMAL"}' -v

This is not really a problem in this case of course. But I guess that
adding new endpoints that shouldn't work on older versions will be a pretty
common use case for API versioning, so this is probably a useful test case.


Nicolay Ramm
Front end developer, DHIS 2
University of Oslo
https://www.dhis2.org

On Thu, Jun 9, 2016 at 10:07 AM, Morten Olav Hansen <morten@xxxxxxxxx>
wrote:

> Hi Halvdan
>
> This should be fixed now, the issue was that even though @RequestMapping
> will default to GET (if not method is set) the annotation doesn't default
> to GET. I'm now mapping method = {} to method = GET internally, which means
> that your issues should be gone.
>
> I think there will be similar issues if you want and endpoint for
> application/json to have a different version than application/xml, but I
> think that is taking this versioning a bit far.
>
> --
> Morten Olav Hansen
> Senior Engineer, DHIS 2
> University of Oslo
> http://www.dhis2.org
>
> On Thu, Jun 9, 2016 at 12:51 PM, Morten Olav Hansen <morten@xxxxxxxxx>
> wrote:
>
>>
>> On Thu, Jun 9, 2016 at 12:45 PM, Morten Olav Hansen <morten@xxxxxxxxx>
>> wrote:
>>
>>> Not 100% sure what you mean here, we already have POST/PUT with
>>> different methods on / vs /24 etc (for same mapping)... but I will try it
>>> out, maybe there are some bugs there
>>>
>>
>> Hm, I made some tests around this now.. and I see there are some issues,
>> will try to fix today or tomorrow (working on it now)
>>
>> --
>> Morten Olav Hansen
>> Senior Engineer, DHIS 2
>> University of Oslo
>> http://www.dhis2.org
>>
>
>
> --
> Mailing list: https://launchpad.net/~dhis2-devs-core
> Post to     : dhis2-devs-core@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs-core
> More help   : https://help.launchpad.net/ListHelp
>
>

Follow ups

References