format response api code example

Example 1: api response format

{  aps: {    alert: {      "loc-key":  "REQUEST_FORMAT",      "loc-args": [@message]    },    sound:      "default",    id:         @id,    request_id:  @request_id,    push_type:  push_type,    payload:    @payload  },  pn_gcm: {    data: {      message: @message,    }  }}

Example 2: api response format

{    "success": true,    "message": "Category deleted successfully",    "data": {}}

Example 3: api response format

public class Student
{
    public int Id { get; set; }
    public string Name { get; set; }
}

public class StudentController : ApiController
{
    public Student Post(Student student)
    {
        // save student into db
        var insertedStudent = SaveStudent(student);

        return insertedStudent;
    }
}

Tags:

Java Example