Comments (13)
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.
I'm pretty sure this is fixed in the RC releases of 2.3 :)
from cachet.php.
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.
Thanks for checking this out @jbrooksuk.
from cachet.php.
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.
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.
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.
@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.
@jbrooksuk You're looking at the master branch there. This issue refers to v0.2 (tagged).
from cachet.php.
@Srthk Cachet 2.3 is out now. Is the issue still present with the latest version of Cachet?
from cachet.php.
@Srthk Did you manage to solve this issue in the end?
from cachet.php.
@DivineOmega the issue is fixed in Cachet, so this should no longer be a problem.
from cachet.php.
Hi. I haven't tried it out. But shouldn't be a problem I guess.
from cachet.php.
Related Issues (20)
- Deprecate use of email/password for API authentication
- Change license to Lesser GPL3
- Object 'save' method
- Object 'delete' method
- Reduce need to use multiple factories
- Rewrite 'Quick Start' section of readme
- Factory 'create' methods
- Tag v0.2 release
- Retrieval of individual Cachet elements by their IDs
- Full testing for Cachet 2 release
- CachetInstanceFactory::create HOT 2
- Make cachet.php PSR2 compliant
- Unit testing
- Update documentation
- Ordering always goes descending
- Subscribe on specify component - not working HOT 6
- Add ability to sort results
- Use Guzzle HOT 3
- Use factories and object classes for all Cachet elements
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cachet.php.