Backbone Request Payload - rest

Hi,
I am a newbie to Backbone, My Rest Server Components Accept Only XML Requests, can Anybody show an example how do i send a xml to a rest api put request.

Backbone uses JSON by default, so to use XML you need to overwrite Backbone.sync. Take a look at this answer: How to override Backbone.sync?

Related

Why does Mojolicious have two methods to access POST body?

The Mojolicious has two methods to access POST body: body_params and json
What is the benefit of them?
UPDATE
I think, it will be more handy if body_params returns hash if body is recognized by some parser and body_type will return the name of this parser.
Thus if it were POST from form body_type will return application/x-www-form-urlencoded
I cannot tell you why this decision was made. You'd have to ask SRI for that. He added the json method in 2010.
But I can tell you why it is useful.
body_params parses requests for common form submissions, application/x-www-form-urlencoded and multipart/form-data. You use that when your action talks to an HTML form submission or similar.
json on the other hand automatically decodes JSON data from the body. This is useful for AJAXJ requests and APIs. Typically it's used in a REST context where the client sends JSON encoded information. It decodes the JSON directly, making your live easy for you.

Does Syncfusion Dashboard web data source support POST http methods?

Does Syncfusion Dashboard web data source support POST http methods?
If yes, so how set it up?
Thanks!
HTTP Post requests additional data from client to server in the message body, where message body will be like JSON, XML, TEXT etc. This may result in the creation of a new resource or the updates of existing resources or both. In contrast, HTTP Get requests include all required data in the URL. So we support HTTP Get method since POST method is not valid use case.
Regards,
Umapathy S.

http POST vs GET request for getting a document sending a XML file

I know for getting a data we have to use a GET request. But this time I have to send a XML document (who will not be stored) for getting the data. What are the best practice in this case ?
You need send a xml document to your end-point to get your interested data.
As you need a xml doc, it has to be a POST REST end-point. (On a side note, sending any file contents as part of GET parameters is a bad design practice.)

Get non file body from multipart/form-data using AWS API Gateway and Lambda

I am trying to get the form data from a multipart/form-data POST to my ASW Lambda web service via API Gateway.
The HTTP POST has Content-Type "multipart/form-data" and body that is URL encoded. File data is also sent in this post (hence the multipart, I guess).
The web service needs to integrate with a thirdparty service, so changing the format of the POST isn't really an option.
I have seen this thread talking about converting the URL encoded data to JSON object for use in Lambda, but this doesn't do the trick.
I have also tried setting the Integration Request -> Mapping Templates for content type multipart/form-data to Input passthrough. This didn't help either.
I did come across another question about uploading a file using multipart/form-data, but since I'm not interested in the file, just the body, that answer didn't help.
Below find screenshot (sorry) of the captured post via runscope.
If the goal is to use Lambda, you'll need to pass valid JSON to the function. Currently there isn't a way to JSON-ify data inside Api Gateway that comes in as non-JSON data.
Our short term fix (on our backlog) is to provide a variable in the mapping templates to grab the raw input of the request. That way you could do a simple JSON conversion using a template like:
{
"body" : "$input.body"
}
or something like that.
Check out the mapping template reference for more info: http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html
Edit 4/7 - feature has been released as $input.body

Upload data through restful service

I want to write a RESTful web service for client to upload data.
The data format is JSON
But I don't know much about it,can you give some sample code in JAVA? include the code of service and client that could demonstrate me the whole process of data uploading.
A good place to start is the Jackson Tutorials. Then look at either Jersey's JSON Support or RESTeasy's JSON Support depending on which framework you happen to be using. Data uploading is a open-ended topic since there are a number of different ways that it can be accomplished. If you POST JSON directly to the service then you can use JAXRS annotations like:
#Path("/myservice")
public class MyService {
#POST #Consumes("application/mytype+json")
public Response processPostRequest (JsonBeanType postData) {
...
}
}
The processPostRequest method will be invoked whenever a client POSTs data that includes the Content-Type: application/mytype+json HTTP header to the /myservice resource.
Another way to upload data is to send it using an HTML form. There are a bunch of examples of processing HTML forms in Java. The SO question How can I handle multipart form data post requests in my Java servlet should start you off in the right direction.