From 1a780af75f5e8a012efc3546e656d3c889e4d2a1 Mon Sep 17 00:00:00 2001 From: Sebastien Douheret Date: Mon, 6 Nov 2017 14:56:39 +0100 Subject: Used uuid of SDK ID and support short ID name if not ambiguous. --- lib/apiv1/sdks.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'lib/apiv1/sdks.go') diff --git a/lib/apiv1/sdks.go b/lib/apiv1/sdks.go index 52af506..f67a0ef 100644 --- a/lib/apiv1/sdks.go +++ b/lib/apiv1/sdks.go @@ -2,7 +2,6 @@ package apiv1 import ( "net/http" - "strconv" "github.com/gin-gonic/gin" common "github.com/iotbzh/xds-common/golib" @@ -15,12 +14,11 @@ func (s *APIService) getSdks(c *gin.Context) { // getSdk returns a specific Sdk configuration func (s *APIService) getSdk(c *gin.Context) { - id, err := strconv.Atoi(c.Param("id")) + id, err := s.sdks.ResolveID(c.Param("id")) if err != nil { - common.APIError(c, "Invalid id") + common.APIError(c, err.Error()) return } - sdk := s.sdks.Get(id) if sdk.Profile == "" { common.APIError(c, "Invalid id") -- cgit 1.2.3-korg