Code Monkey home page Code Monkey logo

Comments (13)

DivineOmega avatar DivineOmega commented on September 25, 2024

Hi.

Just took a look into this. The truncated Bad Request you are getting is probably:

{
    "errors": [
        {
            "id": "1c2fc534-9e21-427c-8682-b8db7901b60d",
            "status": 400,
            "title": "Bad Request",
            "detail": "The request cannot be fulfilled due to bad syntax.",
            "meta": {
                "details": [
                    "The status format is invalid."
                ]
            }
        }
    ]
}

This is pretty strange, as the Cachet documentation says the status should be an integer when updating an incident. In fact, using the try it out form on the documentation page also fails with the same error. See here: https://docs.cachethq.io/docs/update-an-incident

So it looks like you're doing everything correctly.

@jbrooksuk Have we stumbled upon an Cachet API bug or a bit of outdated documentation?

from cachet.php.

jbrooksuk avatar jbrooksuk commented on September 25, 2024

I'm pretty sure this is fixed in the RC releases of 2.3 :)

from cachet.php.

DivineOmega avatar DivineOmega commented on September 25, 2024

For future reference, you can get the full un-truncated messages by surrounding your code segment with a try catch block similar to what's below.

try {
  $incident->status = 1;
  $incident->save();
} catch (Exception $e) {
  // Output full response body contents
  var_dump($e->getResponse()->getBody()->getContents());
}

from cachet.php.

DivineOmega avatar DivineOmega commented on September 25, 2024

Thanks for checking this out @jbrooksuk.

from cachet.php.

Srthk avatar Srthk commented on September 25, 2024

I'm still on v2.1.2 of Cachet, I haven't tried any RC release of 2.3. But ideally, it should still work as I'm able to achieve the same using cURL.

from cachet.php.

jbrooksuk avatar jbrooksuk commented on September 25, 2024

I'm still on v2.1.2 of Cachet, I haven't tried any RC release of 2.3. But ideally, it should still work as I'm able to achieve the same using cURL.

The bug is in Cachet though, so how are you able to do it in cURL?

from cachet.php.

Srthk avatar Srthk commented on September 25, 2024

cURL is working fine for me. I'm running something like this -

$data = array('id' => 2, 'status' => 3, 'message' => 'hello world');

$url = "status.xyz.com/api/v1/incidents";
$url .= "/" . $data['id'];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'X-Cachet-Token: ' . $token
    ));
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$response = curl_exec($ch);

from cachet.php.

jbrooksuk avatar jbrooksuk commented on September 25, 2024

@DivineOmega https://github.com/DivineOmega/cachet.php/blob/master/src/Models/Incident.php you're missing the component status field from here?

from cachet.php.

DivineOmega avatar DivineOmega commented on September 25, 2024

@jbrooksuk You're looking at the master branch there. This issue refers to v0.2 (tagged).

from cachet.php.

DivineOmega avatar DivineOmega commented on September 25, 2024

@Srthk Cachet 2.3 is out now. Is the issue still present with the latest version of Cachet?

from cachet.php.

DivineOmega avatar DivineOmega commented on September 25, 2024

@Srthk Did you manage to solve this issue in the end?

from cachet.php.

jbrooksuk avatar jbrooksuk commented on September 25, 2024

@DivineOmega the issue is fixed in Cachet, so this should no longer be a problem.

from cachet.php.

Srthk avatar Srthk commented on September 25, 2024

Hi. I haven't tried it out. But shouldn't be a problem I guess.

from cachet.php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.