How to use POST method in Drupal 8 Views Rest Export? - rest

Drupal 8 supports REST API exports in GET method. But How can define POST method in views rest export api? #Drupal8 #views

By its nature, views deliver information from the database to the user. They are not designed to take in data.
To be able to accept POST requests, activate module RESTful Web Services and REST UI.
The Rest UI
Editing a resource in the Rest UI
Doing so, you'll create endpoints for accepting POST data.

Related

how do I call salesforce APEX From rest api

I find tons of articles explaining how to call rest apis from APEX - but I'm accessing salesforce from an integration system using the Salesforce REST API, and want to it the other way around.
ie -
I've found functionality (record merging) - that is not available from the rest API, but IS available from apex. Is there any way to run an apex statement or script from the rest API?
NOTE: I'm aware that the functionality also available from the SOAP api, but we really don't want to go near that for various reasons.
you want to REST API endpoints in APEX, so that you can call this endpoint from anywhere, Right? if so then you need to check this article.
After reading above article, you are able to create GET, POST, DELETE endpoint in your Salesforce Org and you can use this endpoints.

How to get URL from request within an action?

I'm writing a HATEOAS-driven REST API and it would be convenient to return responses from some actions with links to other resources.
As the REST API is currently implemented following a monolithic architecture, and in order to not only reduce redundancies but also simplify the job of migrating some parts to microservices, it would be nice if an action could send responses based on the URL that was routed to it.
So, does anyone know if ASP.NET core 2.1 offers any way to access the full URL that's routed to an action when a request is routed to said action?

Can one method in Symfony Controller take care of Rest and Web Request

I am developing web application using Symfony2.
Methods in Controller will be called from Web Application but at the same time I need to expose rest api for same functionality. For example Login and get data for a user.
Can one method be configured/written to server the same purpose.
Yes, you need to determine the format of your response (HTML, JSON) from the controller(s), based on a parameter from the request. Have a look at the official Routing documentation: http://symfony.com/doc/current/book/routing.html#book-routing-format-param
Now when it comes to REST applications, FOSRestBundle makes things very easy for you. It allows you to configure format agnostic controllers in bunch. This is well documented in their "The View Layer" section.

Difference between Apex REST and REST API

Can anyone tell me the difference between the REST API and APEX REST.I am new to REST concept.I am very much confused about them.
The REST API (Force.com REST API) is the generic API provided by Salesforce. On the other hand, the Apex REST API is an API written by yourself in apex to provide custom methods.
The Force.com REST API is great for things such as CRUD operations. You should write a custom Apex REST API when you want to perform more complicated actions.
REST -> architectural style for distributed hypermedia systems.
APREX REST -> Apex REST enables you to implement custom Web services in Apex and expose them through the REST architecture.
Second is used to build RESTful web services
Use the REST API most of the time. You can access your records and update them like you'd expect. But if you need to do something special, like update two records, and only have the changes saved if both updates were successful, then look at Apex REST, where you can customize what your API call does as much as you like.
More details in this interview: https://developer.salesforce.com/blogs/tech-pubs/2011/10/salesforce-apis-what-they-are-when-to-use-them.html

rest api from javascript to handle session and security

I'm developing a public rest api and want to use it for my company's web client as well (jquery). That would work since it would be on the same server.
Howerver, my question is whether rest is even supposed to be consumed by JavaScript? What about authentication and authorization and session information. Since rest is not supposed to maintain any session state.
Can I store all the state, create the response with the token etc within JavaScript?
or should I create another plain servlet layer ontop of my own rest api as a rest client which could be richer (break rest principles)
Create an extra version for the rest api that allows some less rest-like behavior (session data) and maybe even keep that private.
as a side question I'm also wondering if there's any performance difference between using say Jersey vs regular servlets processing calls? In other words, can I use Jersey as a servlet replacement (to take advantage of the format conversions).