Wrong "color is missing" error by API?

Endpoint is https://api.lifx.com/v1/lights/all/effects/breathe

Request is

array(5) {
  ["from_color"]=>
  string(42) "hue:193.63 saturation:0.64 brightness:0.05"
  ["color"]=>
  string(41) "hue:193.63 saturation:0.64 brightness:0.5"
  ["period"]=>
  int(1)
  ["cycles"]=>
  string(2) "10"
  ["persist"]=>
  bool(true)
}

Response :frowning:

{
  "error": "color is missing",
  "errors": [
    {
      "field": "color",
      "message": [
        "is missing"
      ]
    }
  ]
}

Obviously the color parameter is set. So I assume the API wants to tell me something different, but what?


When running the example on https://api.developer.lifx.com/docs/breathe-effect with the same settings it works. It does not show “color is missing”! Why?

1 Like

Hi powtac,

Since color is the only required body parameter of that endpoint, I’d guess your body is not being sent correctly, or it’s being sent with an incorrect content-type header.

If you’re sending the body as form data, Content-Type should be “application/x-www-form-data”, or if you’re sending it as json, Content-Type should be “application/json” as in the the example you screenshot.

The return message says color is missing - sending/detecting a wrong Content-Type should raise another kind of error?