Details
- 
        Type:
Monitor
 - 
        Status: Closed
 - 
            Priority:
 Major
                
             - 
            Resolution: Done
 - 
            Affects Version/s: None
 - 
            Fix Version/s: 2021
 - 
            Component/s: FIWARE-TECH-HELP
 
- 
                        HD-Chapter:IoT
 - 
                        HD-Enabler:Cepheus
 
Description
Created question in FIWARE Q/A platform on 15-03-2017 at 19:03
Please, ANSWER this question AT http://stackoverflow.com/questions/42818272/fiware-cepheus-update-failure-to-context-broker-with-error-unsupported-media-ty
Question:
Fiware Cepheus update failure to context broker with error "Unsupported Media Type"
Description:
since using  fiware cephues  i follow  the Document i  send  the configration file which is
{
        "host":"http://localhost:8080",
"in":[
    {
      "id":"Lab.*",
      "type":"Lab",
      "isPattern": true,
      "attributes":[
        { "name":"motion", "type":"double","metadata": [
          ] }
    , { "name":"priority", "type":"double","metadata": [
] },
{ "name":"controller", "type":"string"}],
      "providers":[
        "http://localhost:8081"
      ]
    }
  ],
"out":[
    {
      "id":"ControllerX",
      "type":"Controller",
      "attributes":[
    {  "name":"switch", "type":"command"
          ,"metadata": [
          ]
       }
,
          {  "name":"number", "type":"double"
          ,"metadata": [
] }
]
,
"brokers":[
{ "url":"http://147.27.60.58:1026", "serviceName": "try1", "servicePath": "/try1", "authToken": "token" }      ]
    }
  ],
"statements":[
    " INSERT INTO Controller  SELECT controller as id  , 'ON' as switch, (CASE  WHEN (C is null AND motion = 1) THEN 1 WHEN (C is null AND motion = 3) THEN 0 WHEN (C is not null AND motion = 1) THEN C.number+1 WHEN (motion = 0 AND C.number >= 1) THEN C.number-1 ELSE C.number END) as number FROM  Lab as  L unidirectional LEFT OUTER JOIN Controller.std:groupwin(id).std:lastevent() as C ON controller=C.id  GROUP BY controller HAVING (priority = 0 AND motion = 1) or (priority = 1) or (priority = 0 AND motion = 3 AND C.number > 0)   "
,
" INSERT INTO Controller SELECT controller as id ,C.switch as switch, C.number-1 as number FROM Lab as L unidirectional LEFT OUTER JOIN Controller.std:groupwin(id).std:lastevent() as C ON controller=C.id GROUP BY controller HAVING motion = 0 AND C.number > 1 AND (priority=0) "
,
 " INSERT INTO Controller  SELECT controller as id ,  'OFF'  as switch ,(CASE WHEN (motion = 0 AND C.number >= 1) THEN C.number-1 WHEN (motion=1 AND C is null) THEN 1 WHEN (C is null AND motion = 3) THEN 0 WHEN (motion = 1 AND C is not null) THEN C.number+1 ELSE C.number END) as number FROM  Lab as L unidirectional LEFT OUTER JOIN Controller.std:groupwin(id).std:lastevent() as C ON controller=C.id GROUP BY controller HAVING (priority = 0 AND C.number = 1 AND motion = 0 ) or (priority = 2)  or (priority = 0 AND motion = 3 AND C.number = 0)
" 
    ]
}
and its successfuly sent with status code 200
but when sending update
(curl 194.177.207.78:8081/v1/updateContext/ -s -S --header 'Content-Type: application/json' \
 -header 'Accept: application/json' -d @ | python -mjson.tool ) <<EOF
    { "contextElements": [
            {
                "type": "Lab",
                "isPattern": "false",
                "id": "FCI-Lab",
                "attributes": [
                       
,
{ "name": "priority", "type": "double", "value": 0 }
,
{ "name": "controller", "type": "string", "value": "Controller12" }                ]
            }
        ],
        "updateAction": "UPDATE"
    }
EOF
I cant find  entity  in  context brocker
when checking  Cepheus-cep logs  i  got
2017-03-15 18:04:45.871  INFO 1059 — [http-nio-8080-exec-8] c.o.cepheus.cep.EsperEventProcessor      : EventIn: Event{type='Lab', values={cont$
2017-03-15 18:04:45.872  INFO 1059 — [http-nio-8080-exec-8] c.orange.cepheus.cep.EventSinkListener   : EventOut: Controller / number_unit:null$
2017-03-15 18:04:45.888  WARN 1059 — [I/O dispatcher 2] o.s.web.client.AsyncRestTemplate         : Async POST request for "http://147.27.60.58$
2017-03-15 18:04:45.888  WARN 1059 — [I/O dispatcher 2] c.orange.cepheus.cep.EventSinkListener   : UpdateContext failed for http://147.27.60.5$
2017-03-15 18:08:53.941  INFO 1059 — [http-nio-8080-exec-10] c.o.cepheus.cep.EsperEventProcessor      : EventIn: Event{type='Lab', values={con$
2017-03-15 18:08:53.943  INFO 1059 — [http-nio-8080-exec-10] c.orange.cepheus.cep.EventSinkListener   : EventOut: Controller / number_unit:nul$
2017-03-15 18:08:53.962  WARN 1059 — [I/O dispatcher 2] o.s.web.client.AsyncRestTemplate         : Async POST request for "http://147.27.60.58$
2017-03-15 18:08:53.962  WARN 1059 — [I/O dispatcher 2] c.orange.cepheus.cep.EventSinkListener   : UpdateContext failed for http://147.27.60.5$
017-03-15 18:09:05.417  WARN 1059 — [I/O dispatcher 2] o.s.web.client.AsyncRestTemplate         : Async POST request for "http://147.27.60.58$
$7.60.58:1026: org.springframework.web.client.HttpClientErrorException: 415 *Unsupported Media Type*
2017-03-15 18:09:39.377  INFO 1059 — [taskScheduler-1] c.o.cepheus.cep.SubscriptionManager      : Launch of the periodic subscription task at $
2017-03-15 18:14:39.378  INFO 1059 — [taskScheduler-1] c.o.cepheus.cep.SubscriptionManager      : Launch of the periodic subscription task at $
what does it mean by Unsupported Media Type in the logs and how to solve this error ?
 we  really need  help as  fast as possible.
Hi,
error "org.springframework.web.client.HttpClientErrorException: 415 Unsupported Media Type"
this error occurs when we forget the header in the curl command :
curl -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ [...]Best Regards