Questions tagged [jsonapi-resources]

JSONAPI-Resources is a Ruby library to write clients and servers for the JSONAPI standard.

JSONAPI-Resources is a Ruby library to write clients and servers for the JSON API standard.

JSONAPI may be regarded as a set of best practices for writing JSON-based APIs, or as an actual standard. JR's github page serves as its home page and the author's blog contains some introductory postings.

111 questions
1
vote
1 answer

What is the JSON:API standard of sending extra information about the resource?

I have an endpoint that responds with data to be filled in a sortable table. But some columns are not sortable columns and I want to communicate those columns in my response using JSON:API specifications. I didn't find much information about these…
HSLM
  • 1,692
  • 10
  • 25
1
vote
1 answer

Laravel JSON format is coming wrong by using groupBy function

I have created an API resource which is returning selected subject and categories of the specific tutor by using groupBy method, the issue is, groupBy method is not sending the response as I am expecting. Please find the current and expected…
1
vote
1 answer

How to override a PATCH request using JSONAPI::Resources

How do I intercept the update action and override it in the resource.rb file, not in the controller.
1
vote
2 answers

React setState reading as undefined after filtering through API response

I'm trying to filter an api response in React to certain news items, but when I call the setState function my console is throwing the error that it cannot setState of property undefined. I'm new to React so excuse me if this is an obvious fix. …
Rolo
  • 17
  • 1
  • 5
1
vote
0 answers

Rails JSONAPI-Resources shows last page link but page-count is null

I have a Rails 5.1 app using the jsonapi-resources gem. In the config I set: config.top_level_links_include_pagination = true config.top_level_meta_include_page_count = true which results in the following output: "meta": { "page-count":…
Severin
  • 8,508
  • 14
  • 68
  • 117
1
vote
0 answers

JSON API Resource Controller for Abstract Resource in Rails

I'm using Jsonapi-resource for my Rails API. I have a User model which has a boolean account_manager as an attribute. I want to have a separate controller/endpoints for the account managers. The index action should return all users that are account…
JonSayer
  • 181
  • 1
  • 16
1
vote
1 answer

What should be the API Response for already performed or unneeded operations

What response (code + content) should I return when my JsonAPI is requested to perform some operation that has already been done or does not make sense ? Example : suppose I want to request an article publication. The article draft is updated…
Cyril Duchon-Doris
  • 12,964
  • 9
  • 77
  • 164
1
vote
0 answers

Katharsis: How to set resource type for jpa entity?

I'm using Katharsis with spring boot for my project, and my problem is with Katharsis-jpa. It seems katharsis ignore @JsonApiResource annotations or does not apply mapping for the type specified. I've currently two classes : One is my entity…
1
vote
1 answer

JSONAPI Resource: has_one/many with polymorphic associations

I have a model Order that has addresses like this: has_many :pick_up_addresses, -> { where(address_type: Address.address_types[:pick_up]) }, as: :addressable, class_name: 'Address', dependent: :destroy has_one :destination_address, …
user3281384
  • 511
  • 1
  • 7
  • 17
1
vote
1 answer

Apply multiple filters JSON API Resources

just a simple question which I am unable to figure out. I want to apply multiple filters in rails JsonApiResources. Here's the resources code I've. filters :start_date, :end_date, apply: -> (records, value, _options){ byebug …
Mj1992
  • 3,404
  • 13
  • 63
  • 102
1
vote
1 answer

jsonapi-resources conditionally disable paginator

I use jsonapi-resources gem in my Rails app. One of my resources is using pagination. There are cases when I want to disable the pagination and make sure that user will get back all the results. I tried custom implementation with some custom filter,…
Michal Bryxí
  • 1,166
  • 1
  • 11
  • 18
1
vote
0 answers

Rails4; service class with JSON-API resources

I've been struggling to apply JSON-API resources with service object. Here is my rough draft, class V1::AccountCreateController < JSONAPI::ResourceController def create # Form object for the parameter validation form =…
Toshi
  • 6,012
  • 8
  • 35
  • 58
1
vote
0 answers

Rails 5: Devise registrations with jsonapi-resources returns 404

I'm building a Rails 5 JSON API with the jsonapi-resources gem. I've found it simple to use, except since I tried to pair it with Devise. I keep getting a 404 error. I've tried to pair a Users::RegistrationResource with a Devise…
1
vote
1 answer

jsonapi-resources; wrong self link

I configured json-resouce-api. But the self link generated by json-resource-api is wrong. The code seems to checks the module hierarchy of the resource class and completely ignores how rails generates the routes. routes.rb require…
Toshi
  • 6,012
  • 8
  • 35
  • 58
1
vote
2 answers

JSONAPI Resource routes not showing up

I am trying to use JSONAPI Resource gem to create an API for my rails application. I want to be able to leverage normal rails routing with my controllers and have a namespaced API as well. So far I have something like # sitting in…
Ryan-Neal Mes
  • 6,003
  • 7
  • 52
  • 77