API Doc Subcsriber Field

Field API subscriber_field

GET ALL FIELD, METHOD : GET


                            //continuing from above explanations
                            $client->request('GET','subscriber_field',[
                                '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",
                                        "name": "Birthdate",
                                        "type": "text",
                                        "options": null,
                                        "personalization_tag": "birthdate"
                                    },
                                    {
                                        "id": "2",
                                        "name": "Phone Number",
                                        "type": "text",
                                        "options": null,
                                        "personalization_tag": "phone_number"
                                    },
                                    {
                                        "id": "3",
                                        "name": "Gender",
                                        "type": "dropdown",
                                        //json encoded options
                                        "options": "[\"M\",\"F\"]",
                                        "personalization_tag": "gender"
                                    }
                                ],
                                //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 Field"
                            }
                        


                            //continuing from above explanations
                            $client->request('GET','subscriber_field/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",
                                        "name": "Birthdate",
                                        "type": "text",
                                        "options": null,
                                        "personalization_tag": "birthdate"
                                    }
                                "count": 1,
                                "message": "Get Field by ID 1"
                            }
                        


                            //continuing from above explanations
                            $client->request('POST','subscriber_field',[
                                'headers'=>$headers,
                                'form_params'=>[
                                    //required parameter
                                    'name'=>'Gender',
                                    //required parameter, currently support text, textarea, dropdown, others will be added
                                    'type'=>'text',
                                    //optional paramter, but required if using dropdown type, an array
                                    'options'=>["M","F"],
                                    //optional
                                    'personalization_tag'=>'gender'
                                ]
                            ]);
                        

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": "3",
                                        "name": "Gender",
                                        "type": "dropdown",
                                        //json encoded options
                                        "options": "[\"M\",\"F\"]",
                                        "personalization_tag": "gender"
                                    }
                                "count": 1,
                                "message": "Field has been created"
                            }
                        

UPDATE FIELD, METHOD : PUT


                            //continuing from above explanations
                            $client->request('PUT','subscriber_field/3',[
                                'headers'=>$headers,
                                'form_params'=>[
                                    //required parameter
                                    'name'=>'Gender',
                                    //required parameter, currently support text, textarea, dropdown, others will be added
                                    'type'=>'text',
                                    //optional paramter, but required if using dropdown type, an array
                                    'options'=>["M","F"],
                                    //optional
                                    'personalization_tag'=>'gender'
                                ]
                            ]);
                        

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": "3",
                                        "name": "Gender",
                                        "type": "dropdown",
                                        //json encoded options
                                        "options": "[\"M\",\"F\"]",
                                        "personalization_tag": "gender"
                                    }
                                "count": 1,
                                "message": "Field has been updated"
                            }
                        

DELETE FIELD, METHOD : DELETE


                            //continuing from above explanations
                            $client->request('DELETE','subscriber_field/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",
                                        "name": "Birthdate",
                                        "type": "text",
                                        "options": null,
                                        "personalization_tag": "birthdate"
                                    }
                                "count": 1,
                                "message": "Delete Field by ID 1"
                            }
                        

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"
                            },
                            {
                                "code": 200,
                                "status": "error",
                                "data":[],
                                "count": 1,
                                "message": "Delete Field id 2"
                            }
                            //