Skip to main content
deleted 23 characters in body
Source Link
Sahin Yanlık
  • 1.2k
  • 2
  • 12
  • 21

Url will be your end-point. It means you need to write a controller that can response your request, inside of your request there is some headers as you see. Those headers are for logging in and telling spring that you are sending json text. Also if you check your request it is "POST" so you also need to inform your controller method about this. It is good practice to catch all data with a model.

So your task should be like this.

  1. Create controller that can response to your url.
  2. Inform your controller method data is in Json format.
  3. Inform your controller method it needs to wait for "POST" request.
  4. Parse data to a model.

Let's try to do with code.

@RequestMapping(value = ReportEndpointConstantsevents.EVENT, method = RequestMethod.POST, consumes = { MediaType.APPLICATION_JSON_VALUE }, produces = { MediaType.APPLICATION_JSON_VALUE }) public Event findByQuotaWrkrIdeventAction(@RequestBody Event event){ 

}

In your case you need to define what is event. Class should be like this.

public class Quota implements Serializable{ private String name; private Date createAt; private String url; // create getter setter } 

That is all now you are able to response this request. Inside of your controller method you can do your business logic.

Url will be your end-point. It means you need to write a controller that can response your request, inside of your request there is some headers as you see. Those headers are for logging in and telling spring that you are sending json text. Also if you check your request it is "POST" so you also need to inform your controller method about this. It is good practice to catch all data with a model.

So your task should be like this.

  1. Create controller that can response to your url.
  2. Inform your controller method data is in Json format.
  3. Inform your controller method it needs to wait for "POST" request.
  4. Parse data to a model.

Let's try to do with code.

@RequestMapping(value = ReportEndpointConstants.EVENT, method = RequestMethod.POST, consumes = { MediaType.APPLICATION_JSON_VALUE }, produces = { MediaType.APPLICATION_JSON_VALUE }) public Event findByQuotaWrkrId(@RequestBody Event event){ 

}

In your case you need to define what is event. Class should be like this.

public class Quota implements Serializable{ private String name; private Date createAt; private String url; // create getter setter } 

That is all now you are able to response this request. Inside of your controller method you can do your business logic.

Url will be your end-point. It means you need to write a controller that can response your request, inside of your request there is some headers as you see. Those headers are for logging in and telling spring that you are sending json text. Also if you check your request it is "POST" so you also need to inform your controller method about this. It is good practice to catch all data with a model.

So your task should be like this.

  1. Create controller that can response to your url.
  2. Inform your controller method data is in Json format.
  3. Inform your controller method it needs to wait for "POST" request.
  4. Parse data to a model.

Let's try to do with code.

@RequestMapping(value = events.EVENT, method = RequestMethod.POST, consumes = { MediaType.APPLICATION_JSON_VALUE }, produces = { MediaType.APPLICATION_JSON_VALUE }) public Event eventAction(@RequestBody Event event){ 

}

In your case you need to define what is event. Class should be like this.

public class Quota implements Serializable{ private String name; private Date createAt; private String url; // create getter setter } 

That is all now you are able to response this request. Inside of your controller method you can do your business logic.

Source Link
Sahin Yanlık
  • 1.2k
  • 2
  • 12
  • 21

Url will be your end-point. It means you need to write a controller that can response your request, inside of your request there is some headers as you see. Those headers are for logging in and telling spring that you are sending json text. Also if you check your request it is "POST" so you also need to inform your controller method about this. It is good practice to catch all data with a model.

So your task should be like this.

  1. Create controller that can response to your url.
  2. Inform your controller method data is in Json format.
  3. Inform your controller method it needs to wait for "POST" request.
  4. Parse data to a model.

Let's try to do with code.

@RequestMapping(value = ReportEndpointConstants.EVENT, method = RequestMethod.POST, consumes = { MediaType.APPLICATION_JSON_VALUE }, produces = { MediaType.APPLICATION_JSON_VALUE }) public Event findByQuotaWrkrId(@RequestBody Event event){ 

}

In your case you need to define what is event. Class should be like this.

public class Quota implements Serializable{ private String name; private Date createAt; private String url; // create getter setter } 

That is all now you are able to response this request. Inside of your controller method you can do your business logic.