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
0
votes
1 answer

JSON:API Spec | External Identifier

We have a JSON:API that allows users to CRUD various types of resource objects. We want to introduce an enhancement to our service where a client application can access an object by calling a well-maintained external identifier, without having to…
FamLamb
  • 13
  • 3
0
votes
1 answer

Shared resources for different ResourceControllers

jsonapi-utils (jsonapi-resources) requires a serializer (resource) for each ResourceController Example class FooController < JsonapiController def create # some code end end class BarController < JsonapiController def create # some…
DenicioCode
  • 8,668
  • 4
  • 18
  • 33
0
votes
1 answer

How to save a nested one-to-many relationship in API-only Rails?

In my Rails (api only) learning project, I have 2 models, Group and Album, that have a one-to-many relationship. When I try to save the group with the nested (already existing) albums, I get the following error, ActiveRecord::RecordNotFound…
0
votes
1 answer

How to save a nested many-to-many relationship in API-only Rails?

In my Rails (api only) learning project, I have 2 models, Group and Artist, that have a many-to-many relationship with a joining model, Role, that has additional information about the relationship. I have been able to save m2m relationships before…
0
votes
2 answers

Proper way to handle a large amount of relationship resources of a resource in JSON:API format (Content-Type application/vnd.api+json)

I'm building an api and I'm trying to handle the following problem: The client sends the Accept header with application/vnd.api+json, so I reply with the resource in the JSON:API format. Given are for example the following…
Tries
  • 3
  • 5
0
votes
1 answer

Can a JSON API resource have an attribute which is a shorthand for a relationship?

I have a JSON API endpoint for retrieving the user. This resource will also be used to get the permissions of the user, for showing or hiding specific elements in our front end application. The resource looks like this: HTTP/1.1 200 OK Content-Type:…
0
votes
0 answers

JSON:API Matching Collections with its respective Includes

What exactly is the best practice for matching JSON:API data collections with their respective includes. Considering the following code below.... What if I wanted to loop through each venue and display the Owners full information for each Venue…
numerical25
  • 10,524
  • 36
  • 130
  • 209
0
votes
1 answer

Ember data model explicit inverse relationships

I’m struggling with explicit inverse relationships: https://guides.emberjs.com/release/models/relationships/#toc_explicit-inverses. If 4 instances of the blog-post model can be associated with a comment (onePost, twoPost, redPost, bluePost), why is…
andywww
  • 66
  • 3
0
votes
1 answer

Testing a Rails JSON API resource callback

How can I unit test that my JSON API resource callback is been registered as after_create, and that send_notifications is invoked, and I can expect(MyMailer).to receive(:welcome_email)? When I attempt to allow & expect MyResource#send_notifications,…
xaunlopez
  • 439
  • 1
  • 4
  • 13
0
votes
1 answer

Is it safe to remove `links.related` from JSON API response? (Ember.js)

Good day, Does removing of links.related on my JSON response will affect any Ember-Data relationship fetching? relationships": { "comments": { "links": { "related": "http://localhost:3099/api/v1/articles/1/comments" }, "data":…
JAKITOVZ
  • 41
  • 2
0
votes
1 answer

CQRS Read model with 2 resource

I have two aggregate roots: employees and company. Using CQRS I have 2 actions to create every model: CreateCompany (/company) and NewEmploy (/employe) by POST. As well, 2 actions to retrieve both GetCompany (/company/{id}) and GetEmploy…
Agustin Castro
  • 439
  • 1
  • 6
  • 20
0
votes
1 answer

Grouping the Laravel Api Resources

I'm trying to group the json response in Laravel 5.5 My table is following +------+-------+------------------------------------------------------- --------------------------------------------------+ | year | month | people …
0
votes
1 answer

Getting a status 400 (BadRequest) with jsonapi(0.9.0) on Rails 5 using Rspec-rails(3.0) request spec

I have a strange situation where a postman or curl post, work just fine, e.g below works as expected and creates a new record: curl -X POST \ -H "Content-Type: application/vnd.api+json" \ -H "Accept:…
0
votes
2 answers

How to check particular json array parameter values from jsonarray

I am suing restassured for automating my apis, here is my jsonResponse:- { "al": [{ "aid": 1464, "_r": "Bus Stand,", "_l": "spaze it park2,", "_c": ",", "_s": "Haryana,", …
0
votes
1 answer

rails doesn't know about "application/vnd.api+json" (ActionController::UnknownFormat)

How to I solve this error I get in rails development.log: ActionController::UnknownFormat (PostsController#index is missing a template for this request format and variant. request.formats: ["application/vnd.api+json"] request.variant: []): What…
american-ninja-warrior
  • 7,397
  • 11
  • 46
  • 80