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
17
votes
3 answers

How to prevent Ember Data from saving attribute (ie., Read-only attribute)

I am creating an online form builder using Ember 2.0 on the front-end and Rails 4.2 on the back-end with the json_api_resources gem. In the process of publishing a form, a user must be able to cut/paste a snippet of code into his/her webpage in…
13
votes
1 answer

Sending json api object using postman

I am using JSONAPI Specification http://jsonapi.org/format/#status And I have data like below, { "data": { "type": "tag", "id": "1", "attributes": { "name": "Test" } } } How do I make a post request to the end point…
Mauricio Junior
  • 135
  • 1
  • 2
  • 5
9
votes
2 answers

JSON API for non-resource responses

Currently, I'm working on new product and making REST API for both - public and internal needs. I started with {json:api} specification and I was pretty happy with it until I faced some questions I cannot find answers to. According to JSON API…
Arūnas Smaliukas
  • 3,231
  • 6
  • 27
  • 46
7
votes
0 answers

jsonapi-resources custom action

I need to add a custom action to my jsonapi-resources controller. This action just creates e new version of a preexistent CollectorContent model instance. My implementation (just copied from here): routes.rb jsonapi_resources :collector_contents…
masciugo
  • 1,113
  • 11
  • 19
6
votes
0 answers

How to integrate Websockets with JSON API Resources in rails and ember

Is there a way to integrate JSONAPI::Resources gem to hub all data through websockets to ember? Would also like to be able to push data out from ember to rails and have jsonapi resources pick it up and handle like a regular http request. Thank you.
Kevin Laslo
  • 367
  • 3
  • 16
5
votes
2 answers

JSON API filter included resources

The question is about JSON API specification and how properly do a request (I'm using ruby on rails and the json api resources gem but that's a general question anyway, I know how to implement it, I just want to follow the rules of JSON API at:…
beniutek
  • 1,672
  • 15
  • 32
4
votes
3 answers

Laravel API Resource: How to return infinite nested array of categories with their children?

I use Laravel 6.x and below is my response JSON. { "data": [ { "id": 1, "name": "quam", "parent_id": 0 }, { "id": 2, "name": "quia", "parent_id": 1 …
Fred II
  • 581
  • 2
  • 11
  • 23
4
votes
1 answer

Using Ransack in a Rails 5 API only application

I recently started working on a Rails 5 API only application and I included jsonapi-resources as well as ransack to easily filter the results for any given request. By default, jsonapi-resources provides basic CRUD functionality, but in order to…
Severin
  • 8,508
  • 14
  • 68
  • 117
4
votes
1 answer

Json Api Resources | response with array of objects

I am using the json api resource gem in my project. I have setup a simple resource module V1 class ExpectedPaymentResource < JSONAPI::Resource attributes :registration_id, :invoiced_amount_due, :date_due, :status, :created_at, :updated_at …
David North
  • 437
  • 1
  • 4
  • 17
4
votes
3 answers

How to implement nested resources using jsonapi-resorces gem in rails?

I have a Posts resource, and a User Rating resource. In my routes.rb, I have nested the user rating within the posts: jsonapi_resources :posts do jsonapi_resources :user_ratings end This has exposed the endpoint /posts/{id}/user-ratings…
zark0
  • 41
  • 4
4
votes
2 answers

JSONAPI resources: serialize a namespaced model

I'm trying to use JSONAPI Resources in a Rails engine and I've defined DokiCore::Tenant (the model) in doki_core/app/models/tenant.rb and DokiCore::TenantResource in doki_core/app/resources/tenant_resource.rb. When I attempt to serialize to hash, I…
typeoneerror
  • 55,990
  • 32
  • 132
  • 223
4
votes
3 answers

Context is always nil using jsonapi-resources

Using version 0.6.0 of the jsonapi-resources gem in conjuction with Doorkeeper I am having a problem seeing the current user in the context object in my resource. I am basically following the docs, however nothing I try will make the context I set…
Dhaulagiri
  • 3,281
  • 24
  • 26
3
votes
1 answer

Laravel API resource hide key

I have an API resource called FilmResource, I've appended a new attribute to the model called is_new and I've added this new attribute to the resource file, the issue is I have two endpoints that make use of this API resource and it's returning the…
user12247297
3
votes
3 answers

How to render a jsonapi-resources response in an custom controller action?

I have implemented my own object creation logic by overriding the create action in a JSONAPI::ResourceController controller. After successful creation, I want to render the created object representation. How to render this automatically generated…
Laugslander
  • 386
  • 2
  • 16
3
votes
0 answers

jsonapi - Invalid links object on create request for parent and child records

I'm trying to write an API endpoint for creating Redemptions in my app. In Rails, my model is such that Redemption has many Items (class_name: RedemptionItems). Here's my POST Body, following what I assume is the correct JSONAPI Specification…
Martin Verdejo
  • 1,229
  • 2
  • 13
  • 24
1
2 3 4 5 6 7 8