Stream: implementers
Topic: post bundle
roberto carlos diaz justicia (Mar 09 2017 at 17:19):
Hello, I am trying to create a resource for the valueset
{
"resourceType": "Bundle",
"id": "5aae6613-025a-4466-8c08-024e4683e64e",
"meta": {
"lastUpdated": "2017-03-09T11:45:47.159Z"
},
"type": "transaction",
"total": 1,
"link": [
{
"relation": "self",
"url": "http://wlsadmin:80/hncat/fhir/ValueSet?_format=xml&identifier=sexo"
}
],
"entry": [
{
"fullUrl": "http://wlsadmin:80/hncat/fhir/ValueSet/sexo",
"resource": {
"resourceType": "ValueSet",
"id": "sexo",
"name": "Genero",
"status": "active",
"date": "2016-06-02T13:09:27Z",
"description": "Generos",
"codeSystem": {
"system": "http://indra.hn.es/fhir/codesystems/Género",
"concept": [
{
"code": "unknown",
"display": "Desconocido"
},
{
"code": "male",
"display": "Hombre"
},
{
"code": "other",
"display": "Indeterminado"
},
{
"code": "female",
"display": "Mujer"
}
]
}
},
"request": {
"fhir_comments": [
" now, details about the action to take with the resource "
],
"method": "POST",
"_method": {
"fhir_comments": [
" POST to [base]/sexo - that's a create "
]
},
"url": "sexo",
"_url": {
"fhir_comments": [
" actually, in a transaction, you don't specify the [base], \n so [base]/sexo becomes just 'sexo': "
]
}
}
}
]
}
But Hapi Fhir server get me this error:
Error during processing: Unexpected element in entry: response :
{
"resourceType": "Bundle",
"id": "6db1c088-f530-4e68-b9fd-25624242ec6e",
"type": "transaction-response",
"link": [
{
"relation": "self",
"url": "http://localhost:8080/healthdata/fhir"
}
],
"entry": [
{
"response": {
"status": "201 Created",
"location": "ValueSet/1959/_history/1",
"etag": "1",
"lastModified": "2017-03-09T16:53:22.851+01:00"
}
}
]
}
Despite the error, the resource has been created, the problem is that I do not create it with the ID that I have specified: 'sex' if not with a serial number: 1958
Why do you give me that mistake?
How can I define the id that I want?
Thanks
roberto carlos diaz justicia (Mar 09 2017 at 17:19):
edit
Lloyd McKenzie (Mar 09 2017 at 18:37):
Method of POST always results in a server-assigned id. If you want the client to assign the id, you'll need to use PUT. (Though not all servers will support that ability.)
Last updated: Apr 12 2022 at 19:14 UTC