Questions tagged [jsend]

10 questions
10
votes
5 answers

Ruby Grape JSON-over-HTTP API, custom JSON representation

I have a small prototype subclass of Grape::API as a rack service, and am using Grape::Entity to present my application's internal objects. I like the Grape::Entity DSL, but am having trouble finding out how I should go beyond the default JSON…
Neil Slater
  • 26,512
  • 6
  • 76
  • 94
7
votes
2 answers

How to catch global exceptions in laravel 5 generated by the tymondesigns/jwt-auth package?

I am working on a RESTful application using Laravel 5 and I am trying to catch exceptions and generate an appropriate response. I am also using the tymondesigns/jwt-auth package so that all the API responses are in JSend JSON format. Right now I am…
Rohan
  • 13,308
  • 21
  • 81
  • 154
6
votes
1 answer

In the JSend specification, what is the difference between a fail and an error?

According to https://labs.omniti.com/labs/jsend, Fail: When an API call is rejected due to invalid data or call conditions Error: When an API call fails due to an error on the server Can this be interpreted as 4xx errors (such as a 404) should…
chintogtokh
  • 803
  • 1
  • 10
  • 25
3
votes
3 answers

Converting JSON response to POJO with Retrofit using JSend format?

I have to work with an API which using JSend format. Long story short it is using HTTP status codes which indicates status like: 200 is Success 406 is Unauthorized Which is good because I can determine from this whether my API request is succeed…
Adam Varhegyi
  • 11,307
  • 33
  • 124
  • 222
3
votes
2 answers

jquery ajax custom error handler

I am writing an backbone js web app on top of an JSON server that returns JSON responses in JSend specification format. Here are a few examples of that format: GET /posts { "status": "success", "data": { "posts" [ {"id": 1, "title": "A…
onlineracoon
  • 2,932
  • 5
  • 47
  • 66
2
votes
1 answer

jsend protocol Swagger defiition

The Jsend protocol is a simple 'standard' of how to format json responses in a REST API. https://github.com/omniti-labs/jsend I am generating Swagger documentation using https://github.com/swaggo/swag but am having great trouble working out how to…
richp10
  • 820
  • 8
  • 20
2
votes
1 answer

Should I use JSend for wrapping json ajax responses, or is there a more standard standard?

I'm setting up a json-over-http service. The responses should have some meta-data, primarily for success/failure. That could be done via http headers, but putting it in the json is nicer (it makes the meta-data available even if some higher-up part…
Daniel Winterstein
  • 2,418
  • 1
  • 29
  • 41
1
vote
0 answers

How to get response from django rest api in jsend format?

I am a complete beginner in django and django rest framework. I want to get the response in the jsend format where success ,fail, error message and status code is displayed. Any video tutorial or blog tutorial will help a lot. The main problem is I…
1
vote
1 answer

Using JSend with Angular 2 requests

I want to make some http requests and return always status 200, because if I return other status the browser console will log it, and I want to avoid that. I read about JSend, and I want to know if there is anyway to catch it response doing…
Motomine
  • 4,205
  • 5
  • 20
  • 23
-2
votes
1 answer

java jpa json standard

First, thank you very much for reading this question. I have a JPA project and everything works fine, the json that i get with the controller is of this form: {"id": 1, "name": "Canada"},{"id": 2, "name": "USA"} All its fine but i would like to get…
George
  • 7
  • 4