swri-robotics / bag-database

A server that catalogs bag files and provides a web-based UI for accessing them.
Other
342 stars 71 forks source link

easier upload of bags with metadata #176

Closed ptulpen closed 2 years ago

ptulpen commented 2 years ago

Hello, currently I try to write a script to add bags with tags and metadata to the server It seems to me, that the workflow to do this is quite complicated

Is there a more simple way to do this? Easiest way would be in my option to push the metadata together with the upload, but it would for example also help to get the bag ID in the response data from uploading

danthony06 commented 2 years ago

We don't have an easier way right now. Returning the bag ID might be possible.

ptulpen commented 2 years ago

Hi, well I got further, but when updating the metadata, I get: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'bags': was expecting ('true', 'false' or 'null') at [Source: (String)" bags:[ {

I upload via curl -X POST -H "Content-Type: application/json" -d " ${newbag} " "${URL}/bags/update_csrf=${CSRF}"

The newbag looks like: bags:[ { "id": 41, "filename": "test5.bag", "path": "/bags/test/", <.....> } ]

So any idea what I do wrong? (or any existing examples?)

EDIT: there was curls missing arroung the whole bag document and quotes around the bag key {"bags" : <.....?

ptulpen commented 2 years ago

well, next issue: when updating tags that already exits, the updating completely fails:

c.g.swrirobotics.bags.BagController - Error deserializing bags: com.fasterxml.jackson.databind.JsonMappingException: Already had POJO for id (java.lang.String) [[ObjectId: key=a, type=com.fasterxml.jackson.databind.deser.impl.Prope rtyBasedObjectIdGenerator, scope=java.lang.Object]] (through reference chain: com.github.swrirobotics.support.web.BagList["bags"]->java.util.ArrayList[0]->com.github.s wrirobotics.persistence.Bag["tags"]->java.util.HashSet[2]->com.github.swrirobotics.persistence.Tag["tag"])

Is this intended behavior ? I know the documentation states (* New tags will be added, but missing tags will not be removed) but this does not sound to me that using exisiting tags should fail

EDIT: move to new issue, since topic derived

ptulpen commented 2 years ago

moved to new issue, since this topic derived to much