diff options
author | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-11-06 14:56:39 +0100 |
---|---|---|
committer | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-11-06 16:00:04 +0100 |
commit | 1a780af75f5e8a012efc3546e656d3c889e4d2a1 (patch) | |
tree | a90179797af0bb59c85e256ef326b3979d506896 /lib/apiv1 | |
parent | 853532297622e8be4fad46bcde9a52c15e7fb0fe (diff) |
Used uuid of SDK ID and support short ID name if not ambiguous.
Diffstat (limited to 'lib/apiv1')
-rw-r--r-- | lib/apiv1/sdks.go | 6 |
1 files changed, 2 insertions, 4 deletions
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") |