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
0 answers

JSONAPI::Resources. Refactoring JSONAPI::Processor

I inherited a JSONAPI::Processor from 2017 (now is Jul/2023): module Api module V2 class GivingNumberSearchProcessor < JSONAPI::Processor def create_resource data = params[:data] search = GivingNumberSearch.new( …
aarkerio
  • 2,183
  • 2
  • 20
  • 34
0
votes
1 answer

Laravel - data_get() with wildcards to return also the keys of returned items

I am working on an API proxy that will accept request, pass it on to a server, and then filter the response such that the requester only receives subset of the response. Given the following JSON form of response data: "images": [ { …
0
votes
0 answers

How to Resolve Empty Relationships in jsonapi Format with a Custom Normalizer in API Platform

I'm using API Platform with jsonapi format and a custom normalizer to resolve entities and their relationships. In my custom item normalizer, I'm using the Symfony\Component\Serializer\Normalizer\NormalizerInterface class. However, I'm having…
shayan
  • 15
  • 1
  • 4
0
votes
0 answers

How to use firebase with laravel resource?

I have an API endpoint to return all the messages. I am using resources for that. From my local database I can do that very conveniently. Now I have switched to firebase for realtime connection. So my resource is not working. can anyone help me out…
0
votes
0 answers

Manage has_and_belongs_to_many with JsonApiResource

I have a relation has_and_belongs_to_many between class Consultant and class Company with join_table OtherCompaniesOtherConsultants. I would like to give the possibility to modify the OtherCompanies of a Consultant from the RecruiterResource (I have…
Axel_vdbl
  • 59
  • 8
0
votes
2 answers

JSONAPI URL requirements for new resource

According to JSON API V1 specification and its recommendations, I know the URLs for collection of resources should be something like /photos. And the URL for reading, updating, or deleting a single resource that already exists in the database should…
0
votes
2 answers

laravel api collection property name does not exist on this collection instance

when i use api resource collection in postman with type GET it returns Property [name] does not exist on this collection instance i dont know why although i wrote everything correct please help i make a collection folder and it returns info note :…
0
votes
1 answer

Laracel api resource Conditional Attributes not working, when processing Auth::check()

'likedPosts' => $this->when(Auth::check(), function () { return $this->likedPosts; }), When the current user is logged in or when Auth::check() returns true, the resource response should appear. But it's not…
James Wong
  • 155
  • 2
  • 14
0
votes
1 answer

Serialize model for custom jsonapi resource in rails

When I make a request to a custom route in my rails project using jsonapi-resources, I get: NoMethodError: undefined method `each_key' for nil:NilClass 0) ArticlesController when requesting latest_article succeeds Failure/Error:…
Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268
0
votes
1 answer

Sort data in api resource by an item

I have this database structure : public function up() { Schema::create('skills', function (Blueprint $table) { $table->id(); $table->string('name',50); $table->integer('level'); …
0
votes
1 answer

retrofit response.body!! Kotlin android studio

I have a problem with a retrofit with Kotlin the code is as follows: MainActivity.kt val apiInterface = ApiInterface.create().getCountry() apiInterface.enqueue( object : Callback>{ override fun onResponse(call:…
0
votes
1 answer

Sorting Data Coming from Resource in laravel

I want to sort data that is coming from Api resource on the basis of their rating that is coming from the resource. I have been working on the SortByDesc method but it's not giving proper results. public function reviewlist() { $post =…
0
votes
0 answers

CanCanCan gem in Rails app: Wrong interpretation of conditions on a specific relationship and unexpected deprecation warning

This is a follow-up to another question as I noticed my problem is far more general than described there. In a Rails app which uses JSONAPI::Resources and CanCanCan, I have a Caption model (belongs_to :video) and a Video model (has_many :captions).…
0
votes
0 answers

Laravel add new properties to returned API resource object does not work

I have below Laravel controller methods, I need to customize the returned result, but I have problem as below: public function getCart(CartProductsRequest $request) { try { $carts = json_decode($request->cart); …
Alaa Hameed
  • 13
  • 1
  • 5
0
votes
1 answer

JSONAPI relationship names and foreign-key column names in rails

I got started following https://github.com/cerebris/peeps for writing a backend for an ember app. My trouble kind of starts that I want to use owner_id as a foreign-key column to the User table and in the resource, I want the relationship to be…
wirrbel
  • 3,173
  • 3
  • 26
  • 49