In laravel when using Route::resource() the controller contains 7 methods. I am unsure what the differences are between the edit and update methods / resources.
GET /resource/{resource}/edit edit resource.edit
PUT/PATCH /resource/{resource} update resource.update
In my understanding of REST, it seems laravels update implementation is fairly standard while the edit route I can't see to think of a scenario to use it when returning resources as JSON.
The difference is that edit is used to return the HTML form that is used to edit the resource values (notice that it responds to GET requests), while updateis the "action" that the edit form will be submitting to, and it responds to PUT or PATCH requests.
Related
I am attempting to clear or update the RadDataForm fields in NativeScript after having submitted the form contents to a backend server. Unfortunately, I do not see a straightforward way to do this in the documentation or from different questions that people have asked on this site.
I have attempted to:
1) update the referenced object contents
2) update the referenced object contents and call the reload() method
3) access the EntityProperty value and modify it directly
but have had no success.
How can this be done?
Updating form by modifying the source property is still a open feature request. The workaround is to replace the source object with updated values as discussed in the same issue.
I'm using claudia-api-builder and attempting to write tests using jasmine-node. I'm using the proxyRouter on my API using this tutorial https://claudiajs.com/tutorials/testing-locally.html, and I can pass path parameters fine as demonstrated. However, I can't find what the key is for the body of the request.
For example it says
You can fill in the other properties (eg queryStringParameters)
according to what the test expects
But I can't find anywhere that lists the possible properties. The API Gateway Proxy Object link also doesn't seem to go to anything useful, as the sample doesn't seem to include a body.
Does anybody know what the key I should be using is? Thanks!
Worked it out - somewhat embarrassingly it's just body.
I have managed to setup a Smartform for update / delete purposes. Binding works alright, fields are visible but all of them are read only. Of course, form editable attribute is set to true.
OData model looks good:
creatable, updatable, and deletable flags are checked for the entity set
All fields have the creatable flag
All fields, except the keys, have the updatable flag in entity type.
Backend methods are in place and tested in the gateway client. Followed the steps required to clear the server cache (without being sure it's required) but situation remains the same.
Is there something that I'm missing or a place that I forgot to have a look here?
Solution found and had nothing to do with my coding. It was all about closing SAP Personal Web IDE, stopping and restarting the Orion service, logging in again and just rerunning the application. Form behaves now as supposed without alerting a single line of code...
I am trying to imeplement a rest controller in grails 2.3.7. I have a simple controller, same actions as of a scaffolded one, nothing special.
My problem is I am not able to call show, update, delete and save actions via:
GET to localhost:8080/proj/domain/1
PUT/DELETE to localhost:8080/proj/domain/1
POST to localhost:8080/proj/domain
However it works when I add this to the url in UrlMappings.groovy
"/$controller/$action?/$id?(.$format)?"{
action = [POST:"save",GET:'show',DELETE:"delete"]
}
Im following with the grails doc's '8.1.5 Implementing REST controllers'. Based on my understanding of it, it should work without doing further configurations outside of the controller. Is modifying the url mappings necessary?
Yes adding a REST controller requires you to add a URL mapping for the resource, defining it as either singular or multi resource. Example:
“/foo”(resource:”foo”)
Or
“/foos”(resources:”foo”)
You can run url-mappings-report to see the URL mappings this produces
I have #list value in my controller and i have view where i m adding products.Form looks like product_name and Add Button.I need to add all thees values to #list thought ajax request using coffe script or some other way, where i will not submit whole form.
How to achieve that? Thanks.
Your question sounds quite strange...
First, any CoffeScript source will be compiled to Javascript, which is downloaded on the client side (in the browser). Your controller is running server-side, so it is only addressable through HTTP requests.
Nevertheless, an #list attribute is not persistent between two HTTP requests, so you will have to persist any change if you need to accumulate data, as you state in your question.
To achieve the AJAX call, I would recommend to use JQuery's helpers: http://api.jquery.com/jQuery.ajax/, or shortcuts like http://api.jquery.com/jQuery.get/, http://api.jquery.com/jQuery.getJSON/, ...
The rest is Rails routing, as can be teached in http://guides.rubyonrails.org/action_controller_overview.html#methods-and-actions and http://guides.rubyonrails.org/routing.html.
Hope this helps.