[Solved] How to get a sharing link for a file using its UUID

sharing
api
s3

#1

Hi, I put a new object into my workspace via the svc.PutObject(input) command and use the returned UUID to try and get a sharing link with Pydio Cells. This is the response from my PUT request:
CreateNode {"node": "Uuid:\"a4d703c4-acc2-4ad1-9d69-11d1c56c1f4a\" Path:\"admin/test.txt\" Type:LEAF Size:5 MTime:1543502791 Mode:511 Etag:\"5d41402abc4b2a76b9719d911017c592\" "}

But when I use that UUID to get a sharing link like so:
shareLink, err :=api.ShareService.GetShareLink(&share_service.GetShareLinkParams{UUID:"a4d703c4-acc2-4ad1-9d69-11d1c56c1f4a", Context:ctx, HTTPClient:http.DefaultClient})
I get this error:
Rest Error 404 {"error": "{\"id\":\"share\",\"code\":404,\"detail\":\"Cannot find workspace with Uuid a4d703c4-acc2-4ad1-9d69-11d1c56c1f4a\",\"status\":\"Not Found\"}"}

Do I have to put the share link first? Using the following code:
var shareLinkRest = &models2.RestShareLink{UUID:"a4d703c4-acc2-4ad1-9d69-11d1c56c1f4a"}
var shareBody = &models2.RestPutShareLinkRequest{ShareLink:shareLinkRest}
shareLink, err :=api.ShareService.PutShareLink(&share_service.PutShareLinkParams{Body:shareBody,Context:ctx, HTTPClient:http.DefaultClient})

I get the same error from my pydio cells server

When I set the root nodes (as it appears the browser frontend does) like so:
nodes:= []*models2.TreeNode{{UUID: "a4d703c4-acc2-4ad1-9d69-11d1c56c1f4a" }}
var shareLinkReq = &models2.RestShareLink{ RootNodes: nodes,}

I get this error:

018-11-29T18:55:48.981Z INFO http: panic serving 10.138.0.2:58010: runtime error: invalid memory address or nil pointer dereference
goroutine 13667 [running]:
net/http.(*conn).serve.func1(0xc45f4e66e0)
/usr/local/go/src/net/http/server.go:1726 +0xd0
panic(0x279e020, 0x78aef80)
/usr/local/go/src/runtime/panic.go:502 +0x229
github.com/pydio/cells/idm/share/rest.(*SharesHandler).PutShareLink(0xc422c1f500, 0xc45d224b10, 0xc45cecbb20)
/opt/teamcity/agent/work/b7c550f2c973b54c/src/github.com/pydio/cells/idm/share/rest/rest.go:295 +0x3e8
reflect.callMethod(0xc454a26a80, 0xc4549d6d38)
/usr/local/go/src/reflect/value.go:663 +0x181
reflect.methodValueCall(0xc45d224b10, 0xc45cecbb20, 0xc45d224ab0, 0xc4506b7700, 0xc45d224ae0, 0xc45d224b10, 0xc45cecbb20, 0xc454a0dbf0, 0x7, 0xc45cea71c4, …)
/usr/local/go/src/reflect/asm_amd64.s:29 +0x33
github.com/pydio/cells/vendor/github.com/emicklei/go-restful.(*Container).dispatch(0xc42334fb00, 0x6425800, 0xc422bdc620, 0xc4506b7700)
/opt/teamcity/agent/work/b7c550f2c973b54c/src/github.com/pydio/cells/vendor/github.com/emicklei/go-restful/container.go:282 +0xa57
github.com/pydio/cells/vendor/github.com/emicklei/go-restful.(*Container).(github.com/pydio/cells/vendor/github.com/emicklei/go-restful.dispatch)-fm(0x6425800, 0xc422bdc620, 0xc4506b7700)
/opt/teamcity/agent/work/b7c550f2c973b54c/src/github.com/pydio/cells/vendor/github.com/emicklei/go-restful/container.go:120 +0x48
net/http.HandlerFunc.ServeHTTP(0xc454a20820, 0x6425800, 0xc422bdc620, 0xc4506b7700)
/usr/local/go/src/net/http/server.go:1947 +0x44
net/http.(*ServeMux).ServeHTTP(0xc454a26c30, 0x6425800, 0xc422bdc620, 0xc4506b7700)
/usr/local/go/src/net/http/server.go:2340 +0x130
github.com/pydio/cells/vendor/github.com/emicklei/go-restful.(*Container).ServeHTTP(0xc42334fb00, 0x6425800, 0xc422bdc620, 0xc4506b7700)
/opt/teamcity/agent/work/b7c550f2c973b54c/src/github.com/pydio/cells/vendor/github.com/emicklei/go-restful/container.go:297 +0x4d
github.com/pydio/cells/common/service.PolicyHttpWrapper.func1(0x6425800, 0xc422bdc620, 0xc4506b7400)
/opt/teamcity/agent/work/b7c550f2c973b54c/src/github.com/pydio/cells/common/service/policy.go:96 +0xc78
net/http.HandlerFunc.ServeHTTP(0xc454a1cd80, 0x6425800, 0xc422bdc620, 0xc4506b7400)
/usr/local/go/src/net/http/server.go:1947 +0x44
github.com/pydio/cells/common/service.JWTHttpWrapper.func1(0x6425800, 0xc422bdc620, 0xc4506b6000)
/opt/teamcity/agent/work/b7c550f2c973b54c/src/github.com/pydio/cells/common/service/jwt.go:108 +0x175
net/http.HandlerFunc.ServeHTTP(0xc457845400, 0x6425800, 0xc422bdc620, 0xc4506b6000)
/usr/local/go/src/net/http/server.go:1947 +0x44
github.com/pydio/cells/common/service/context.HttpSpanHandlerWrapper.func1(0x6425800, 0xc422bdc620, 0xc4591fff00)
/opt/teamcity/agent/work/b7c550f2c973b54c/src/github.com/pydio/cells/common/service/context/span.go:148 +0xa3
net/http.HandlerFunc.ServeHTTP(0xc457845420, 0x6425800, 0xc422bdc620, 0xc4591fff00)
/usr/local/go/src/net/http/server.go:1947 +0x44
github.com/pydio/cells/common/service/context.HttpMetaExtractorWrapper.func1(0x6425800, 0xc422bdc620, 0xc4591ffe00)
/opt/teamcity/agent/work/b7c550f2c973b54c/src/github.com/pydio/cells/common/service/context/http-to-meta.go:115 +0xa8
net/http.HandlerFunc.ServeHTTP(0xc457845440, 0x6425800, 0xc422bdc620, 0xc4591ffe00)
/usr/local/go/src/net/http/server.go:1947 +0x44
github.com/pydio/cells/common/service.NewConfigHttpHandlerWrapper.func1(0x6425800, 0xc422bdc620, 0xc4591ffd00)
/opt/teamcity/agent/work/b7c550f2c973b54c/src/github.com/pydio/cells/common/service/config.go:92 +0xaf
net/http.HandlerFunc.ServeHTTP(0xc457845480, 0x6425800, 0xc422bdc620, 0xc4591ffd00)
/usr/local/go/src/net/http/server.go:1947 +0x44
github.com/pydio/cells/common/service.NewLogHttpHandlerWrapper.func1(0x6425800, 0xc422bdc620, 0xc4591ffc00)
/opt/teamcity/agent/work/b7c550f2c973b54c/src/github.com/pydio/cells/common/service/log.go:72 +0x109
net/http.HandlerFunc.ServeHTTP(0xc4578492f0, 0x6425800, 0xc422bdc620, 0xc4591ffc00)
/usr/local/go/src/net/http/server.go:1947 +0x44
net/http.(*ServeMux).ServeHTTP(0xc42334a360, 0x6425800, 0xc422bdc620, 0xc4591ffc00)
/usr/local/go/src/net/http/server.go:2340 +0x130
net/http.serverHandler.ServeHTTP(0xc427c3bee0, 0x6425800, 0xc422bdc620, 0xc4591ffc00)
/usr/local/go/src/net/http/server.go:2697 +0xbc
net/http.(*conn).serve(0xc45f4e66e0, 0x6428a40, 0xc45b9fb400)
/usr/local/go/src/net/http/server.go:1830 +0x651
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2798 +0x27b
2018-11-29T18:55:48.989Z INFO http: proxy error: EOF

What am I missing?
thanks,
Ian


#2

I had to set all of the parameters in the RestShareLink like this:
var shareLinkReq = &models2.RestShareLink{ RootNodes: nodes, Permissions:accesTypes,Label:"test.txt", PoliciesContextEditable:true, ViewTemplateName:"pydio_unique_strip", Description:"This is a veryyyyy interesting text file we have here"}


#3

So you solved this one?


#4

Yes, sorry, is there a way to mark it as solved? I would love your input on this: Can't add a custom filename to a presigned put request


#5