API Doc Subscriber

Subscriber API subscriber

GET ALL SUBSCRIBER, METHOD : GET


                            //continuing from above explanations
                            //optional header, if not defined, all contact from all list is shown
                            $headers['List-Id'] = 1;
                            //optional header
                            $headers['Offset'] = 0;
                            $client->request('GET','subscriber',[
                                'headers'=>$headers
                            ]);
                        

Result (Commentary is explanatory only)


                            //result
                            //please check status code before processing result,
                            //unless it return 200, it was not necessary to parse anything
                            //if status code is 200, please check status value in result content
                            //it it success, there will be returned data, else no data
                            //this is applied to all api
                            {
                                "code": 200,
                                "status": "success",
                                "data":[
                                    {
                                        "id": "1",
                                        "full_name": "Example",
                                        "email": "example@example.com"
                                    },
                                    {
                                        "id": "2",
                                        "full_name": "Example 1",
                                        "email": "example1@example.com"
                                    },
                                    {
                                        "id": "3",
                                        "full_name": "Example 2",
                                        "email": "example2@example.com"
                                    }
                                ],
                                //currently shown
                                "count": 3,
                                //total, by default, we only show 100 per request
                                "total": 3,
                                //change offset by adding to header, $headers['Offset'] = 101
                                "offset" : 0,
                                "message": "Get All Subscriber"
                            }
                        

GET BY ID, METHOD : GET


                            //continuing from above explanations
                            $client->request('GET','subscriber/1',[
                                'headers'=>$headers
                            ]);
                        

Result (Commentary is explanatory only)


                            //result
                            //please check status code before processing result,
                            //unless it return 200, it was not necessary to parse anything
                            //if status code is 200, please check status value in result content
                            //it it success, there will be returned data, else no data
                            //this is applied to all api
                            {
                                "code": 200,
                                "status": "success",
                                "data":
                                    {
                                        "id": "1",
                                        "full_name": "Example",
                                        "email": "example@example.com",
                                        "list":[
                                            {
                                                "id": "1",
                                                "name": "Example",
                                                "slug": "example"
                                            }
                                        ]
                                    }
                                "count": 1,
                                "message": "Get Subscriber by ID 1"
                            }
                        

GET BY ID, METHOD : GET


                            //continuing from above explanations
                            $client->request('GET','subscriber/1',[
                                'headers'=>$headers
                            ]);
                        

Result (Commentary is explanatory only)


                            //result
                            //please check status code before processing result,
                            //unless it return 200, it was not necessary to parse anything
                            //if status code is 200, please check status value in result content
                            //it it success, there will be returned data, else no data
                            //this is applied to all api
                            {
                                "code": 200,
                                "status": "success",
                                "data":
                                    {
                                        "id": "1",
                                        "full_name": "Example",
                                        "email": "example@example.com",
                                        "list":[
                                            {
                                                "id": "1",
                                                "name": "Example",
                                                "slug": "example"
                                            }
                                        ]
                                    }
                                "count": 1,
                                "message": "Get Subscriber by ID 1"
                            }
                        

CREATE SUBSCRIBER, METHOD : POST


                            //continuing from above explanations
                            //all subscriber api, create  or edit, is always use subscribed status, why bother create bounced?
                            //although this it create api, if same email exist, then it will update previous data
                            $client->request('POST','subscriber',[
                                'headers'=>$headers,
                                'form_params'=>[
                                    //optional parameter, but you should put it
                                    'full_name'=>'Update Example',
                                    //required parameter
                                    'email'=>'example@example.com,
                                    //required parameter in create but optional in update, might be array or just singular
                                    'lists'=> [2,3],
                                    //optional parameter, fields, we explain it in the update part, but you can also use it here
                                ]
                            ]);
                        

Result (Commentary is explanatory only)


                            //result
                            //please check status code before processing result,
                            //unless it return 200, it was not necessary to parse anything
                            //if status code is 200, please check status value in result content
                            //it it success, there will be returned data, else no data
                            //this is applied to all api
                            {
                                "code": 200,
                                "status": "success",
                                "data":
                                    {
                                        "id": "1",
                                        "full_name": "Example",
                                        "email": "example@example.com",
                                        "list":[
                                            {
                                                "id": "1",
                                                "name": "Example",
                                                "slug": "example"
                                            },
                                            {
                                                "id": "2",
                                                "name": "Example 2",
                                                "slug": "example-2"
                                            },
                                            {
                                                "id": "3",
                                                "name": "Example 3",
                                                "slug": "example-3"
                                            }
                                        ]
                                    }
                                "count": 1,
                                "message": "Create Subscriber"
                            }
                        

UPDATE SUBSCRIBER, METHOD : PUT


                            //continuing from above explanations
                            //all subscriber api, create  or edit, is always use subscribed status, why bother create bounced?
                            //although this it create api, if same email exist, then it will update previous data
                            $client->request('PUT','subscriber/1',[
                                'headers'=>$headers,
                                'form_params'=>[
                                    //optional parameter, but you should put it
                                    'full_name'=>'Update Example',
                                    //required parameter
                                    'email'=>'example@example.com,
                                    //optional parameter, lists, might be array or just singular
                                    'lists'=> [2,3],
                                    //optional parameter, fields, we explain it in the update part, but you can also use it here
                                    'fields'=>[
                                        'birthdate'=>"1 January 1970"
                                    ]
                                ]
                            ]);
                        

Result (Commentary is explanatory only)


                            //result
                            //please check status code before processing result,
                            //unless it return 200, it was not necessary to parse anything
                            //if status code is 200, please check status value in result content
                            //it it success, there will be returned data, else no data
                            //this is applied to all api
                            {
                                "code": 200,
                                "status": "success",
                                "data":
                                    {
                                        "id": "1",
                                        "full_name": "Example",
                                        "email": "example@example.com",
                                        "list":[
                                            {
                                                "id": "1",
                                                "name": "Example",
                                                "slug": "example"
                                            },
                                            {
                                                "id": "2",
                                                "name": "Example 2",
                                                "slug": "example-2"
                                            },
                                            {
                                                "id": "3",
                                                "name": "Example 3",
                                                "slug": "example-3"
                                            }
                                        ],
                                        "fields":[
                                            {
                                                "name": "Birthdate",
                                                "personalization_tag": "birthdate",
                                                "value": "1 January 1970"
                                            }
                                        ]
                                    }
                                "count": 1,
                                "message": "Update Subscriber ID 1"
                            }
                        

DELETE SUBSCRIBER, METHOD : DELETE


                            //continuing from above explanations
                            //required header
                            $headers['List-Id']=3;
                            $client->request('DELETE','subscriber/1',[
                                'headers'=>$headers
                            ]);
                        

Result (Commentary is explanatory only)


                            //result
                            //please check status code before processing result,
                            //unless it return 200, it was not necessary to parse anything
                            //if status code is 200, please check status value in result content
                            //it it success, there will be returned data, else no data
                            //this is applied to all api
                            {
                                "code": 200,
                                "status": "success",
                                "data":
                                    {
                                        "id": "1",
                                        "full_name": "Example",
                                        "email": "example@example.com",
                                        "list":[
                                            {
                                                "id": "1",
                                                "name": "Example",
                                                "slug": "example"
                                            },
                                            {
                                                "id": "2",
                                                "name": "Example 2",
                                                "slug": "example-2"
                                            }
                                        ],
                                        "fields":[
                                            {
                                                "name": "Birthdate",
                                                "personalization_tag": "birthdate",
                                                "value": "1 January 1970"
                                            }
                                        ]
                                    }
                                "count": 1,
                                "message": "Delete Subscriber ID 1 from list ID 3"
                            }
                        

ERROR EXAMPLE


                            //Possible error
                            //The code value, in response body is the same with status code in result header
                            {
                                "code": 400,
                                "status": "error",
                                "message": "Malformed request"
                            },
                            {
                                "code": 403,
                                "status": "error",
                                "message": "Forbidden access"
                            },
                            {
                                "code": 500,
                                "status": "error",
                                "message": "Something unexpected happen"
                            }
                            //