404 error with empty message when posting to /projects/:id/time-records - activecollab

When posting the following payload to "/projects/1/time-records" I am getting a response with a 404 error code and an empty error message:
{"task_id":"1","value":"1:00","user_id":"1","job_type_id":1,"record_date":"2018-06-22"}
Is there anything obvious that I am overlooking?

Related

Randomly failed because of JSON::ParserError : 822: unexpected token

I have a REST POST API that receives json data and validates parameters. In the production environment, the API sometimes raises an exception:
JSON::ParserError : 822: unexpected token at ...
The stack trace is like:
> .../gems/ruby-2.2.10/gems/json-1.8.6/lib/json/common.rb:155:in `parse'
> .../gems/ruby-2.2.10/gems/json-1.8.6/lib/json/common.rb:155:in `parse'
> .../gems/ruby-2.2.10/gems/activesupport-4.2.10/lib/active_support/json/decoding.rb:26:in `decode'
It seems that the error occurs randomly; I cannot find any pattern.
When I try the same code with the dumped data, there is no parsing error.
I thought the error is due to running in concurrent, but I tried it in local with 1000 concurrent requests, which are far more than in the production environment, and it still works without any error.
I appreciate to throw some light.
What does the 822 mean in the error message? It does not seem to be the character position in the json data.

Failed to fetch swagger with error message: Unexpected end of JSON input

I have a Function app, which i am calling from a logic App. When ever i am adding the Action for function app, My funciton app unable to retrive. Its showing the below error
Failed to fetch swagger with error message: Unexpected end of JSON
input. Ensure you have CORS enabled on the endpoint and are calling a
valid HTTPS endpoint
I have refereed --> Stackoverflow , but its not working.
Any help is really appreciated.
.

We were unable to decode the JSON response from the Mandrill API

I am using the standard Code from: https://mandrillapp.com/api/docs/messages.php.html, require_once 'mandrill.php'; before using it and the directory is also right. But I am getting this exception the whole time, and I dont know why
Fatal error: Uncaught exception 'Mandrill_Error' with message 'We were
unable to decode the JSON response from the Mandrill API: window.NREUM||(NREUM={}),__nr_require=function(e,n,t){function
r(t){if(!n[t]){var
o=n[t]={exports:{}};e[t][0].call(o.exports,function(n){var
o=e[t][1][n];return r(o||n)},o,o.exports)}return
n[t].exports}if("function"==typeof __nr_require)return
__nr_require;for(var o=0;op;p++)u[p].apply(s,t);return
s}function a(e,n){f[e]=c(e).concat(n)}function c(e){return
f[e]||[]}function u(){return t(n)}var
f={};return{on:a,emit:n,create:u,listeners:c,_events:f}}function
r(){return{}}var
o="nr#context",i=e("gos");n.exports=t()},{gos:"7eSDFh"}],ee:[function(e,n){n.exports=e("QJf3ax")},{}],3:[function(e,n)
in
Anyone an idea?
It is possible that you get this error when the mailservice is down or has Internal server errors (500). Embed your sending code in a try/catch block and use the catch block to fall back on another mailing service.

themoviedb Search Movie 401 error

I am on themoviedb.org to understand request and response for search movie. I am received api_key. When I try to use their console on the site with api_key and query. I am getting 401 error.
The detailed error message is:
status code 7
status message invalid api key
If I use the same key in my code, I dont receive any error. Can anyone please help?
This is usually caused by Apiary expecting the API key to be sent as a header as opposed to what TMDb expects (which is just a query parameter).
If you add the 'api_key' as a query parameter to your URL instead, it should work.

Sinatra: concerning filters, halt and body on 404 error

I'm using Sinatra to develop this JSON API. The way I designed it, the error messages are also delivered in JSON in a specific format. The only difference is that they response will have a 4xx status code instead of a 2xx or 3xx. Now, the problems I encountered:
I defined a general filter where I set the response content type. Like this:
before { content_type :json }
problem is, everytime I call halt, this setting is not taken into account. I have to set it myself on the halt call in a very ugly, more verbose and error-prone way:
halt [404, {"Content-Type" => "application/json;charset=utf-8"}]
is there another way to do this?
The problem that phases me the most is: when I halt with code 404 after I catch the 404 error (see below), JSON content type and json body, strangely, I don't get any body, neither browser nor curl gets it. How come?
error 404 do
halt [404...{"bang" => "bong"....}]
end
UPDATE
Concerning the last issue, here is what it happens using curl and triggering a call which will fall in the 404 error block:
curl http://faulty_url
# curl log:
curl: (52) Empty reply from server
# sinatra log:
!! Unexpected error while processing request: Content-Length header was 221, but should be 227
127.0.0.1 - - [28/Mar/2013 11:28:47] "GET / HTTP/1.1" 404 221 0.0664
maybe this helps.
I may not understand exactly what's the output, but if you are looking to override 404 you will have to do something like below instead of error 404 do
not_found do
# Set content
{"bang" => "bong"}
end
Which version of Sinatra were you using? Looking at the recent change logs for Sinatra I see two entries in the 1.4.x releases that seem like they could be relevant:
Status, headers and body will be set correctly in an after filter when using halt in a before filter or route. (Konstantin Haase)
Setting status code to 404 in error handler no longer triggers not_found handler. (Konstantin Haase)