diff --git a/CHANGELOG.md b/CHANGELOG.md index de0df3a32..fbb577f38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Added - Adding mime type for geojson - Add "when" parameter in a few GET API endpoints to enable pagination [#266](https://github.com/clowder-framework/clowder/issues/266) +- Add "id" in GET metadata.jsonld endpoints [#278](https://github.com/clowder-framework/clowder/issues/278) ## 1.18.1 - 2021-08-16 diff --git a/app/util/JSONLD.scala b/app/util/JSONLD.scala index c45dca24d..3eacc7214 100644 --- a/app/util/JSONLD.scala +++ b/app/util/JSONLD.scala @@ -63,7 +63,8 @@ object JSONLD { ) //convert metadata to json using implicit writes in Metadata model - val metadataJson = resourceJson ++ toJson(metadata).asInstanceOf[JsObject] + //include metadata ID in the json + val metadataJson = JsObject(Seq("id" -> JsString(metadata.id.toString()))) ++ resourceJson ++ toJson(metadata).asInstanceOf[JsObject] //combine the two json objects and return if (contextJson.isEmpty) metadataJson else contextJson.get ++ metadataJson