jsonapi-resources

Sending json api object using postman

末鹿安然 提交于 2021-02-04 15:00:27
问题 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 using postman chrome extension ? I am trying to make a call but I cannot get the params. Obs. I already set my Content-Type as application/vnd.api+json Thanks ! 回答1: Select METHOD POST Then under Body chose raw here is a screenshot on/json 来源: https://stackoverflow.com/questions

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

我们两清 提交于 2019-12-21 20:36:32
问题 I have implemented my own object creation logic by overriding the create action in a JSONAPI::ResourceController controller. After successful creation, I want to show the created object representation. How to render this automatically generated JSON API response, using the jsonapi-resources gem? Calling the super method does also trigger the default resource creation logic, so this does not work out for me. class Api::V1::TransactionsController < JSONAPI::ResourceController def create

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

爷,独闯天下 提交于 2019-12-04 12:51:45
I have implemented my own object creation logic by overriding the create action in a JSONAPI::ResourceController controller. After successful creation, I want to show the created object representation. How to render this automatically generated JSON API response, using the jsonapi-resources gem? Calling the super method does also trigger the default resource creation logic, so this does not work out for me. class Api::V1::TransactionsController < JSONAPI::ResourceController def create @transaction = Transaction.create_from_api_request(request.headers, params) # render automatic generated JSON

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

允我心安 提交于 2019-11-30 22:11:25
问题 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 order to 'ajax in' the form they have configured. Thus the 'embed-snippet' attribute of the Form model should be read-only. I do not want the contents of the snippet field to be sent back to the server when the user makes a change to the form and re