Sử dụng
Để sử dụng API bạn cần viết một ứng dụng kết nối tới máy chủ vinaContact để gửi yêu cầu và kiểm soát phản hồi từ chương trình. Chương trình có thể viết bằng PHP hoặc sử dụng thư viện CURL.
Chứng thực
Bạn cần phải có một tài khoản sử dụng chương trình EMail Marketing. Thông tin đăng nhập này dùng trong việc xác thực yêu cầu từ chương trình của bạn.
Yêu cầu
Mỗi API request cần có một action để server biết và trả về kết quả tương ứng.
Các hành động gửi dữ liệu lên server (thêm/sửa) được yêu cầu như là một POST và các hành động lấy dữ liệu từ server được yêu cầu như là một GET.
(Ngoại trừ các hành động "xóa" chỉ đưa vào thông số là ID).
Hiện tại bạn có thể sử dụng các hành động sau:
- list_view - returns the list info. Input: List ID
- list_list - returns a list of lists. Input: comma-separated list of List IDs
- list_add - adds the list. Input: complete list settings
- list_edit - edits the list. Input: complete list settings and List ID to edit
- list_delete - deletes the list. Input: List ID
- list_delete_list - deletes a list of lists. Input: comma-separated list of List IDs
- subscriber_view - returns the subscriber info. Input: Subscriber ID or Subscriber Email
- subscriber_view_email - returns the subscriber info. Input: Subscriber Email
- subscriber_list - returns a list of subscribers. Input: comma-separated list of Subscriber IDs
- subscriber_add - adds the subscriber. Input: complete subscriber info with all lists he should belong to from now on
- subscriber_edit - edits the subscriber. Input: complete subscriber info with all lists he should belong to from now on and Subscriber ID to edit
- subscriber_delete - deletes the list. Input: Subscriber ID
- subscriber_delete_list - deletes a list of subscribers. Input: comma-separated list of Subscriber IDs
- user_view - returns the user info. Input: User ID
- user_view_email - returns the user info. Input: User email address
- user_view_username - returns the user info. Input: User username
- user_list - returns a list of lists. Input: comma-separated list of User IDs
- user_add - adds the user. Input: complete user info
- user_edit - edits the user. Input: complete user info and User ID to edit
- user_delete - deletes the list. Input: User ID
- user_delete_list - deletes a list of users. Input: comma-separated list of User IDs
- message_view - returns the message info. Input: Message ID
- message_list - returns a list of messages. Input: comma-separated list of Message IDs
- message_add - adds the message. Input: complete message settings
- message_edit - edits the message. Input: complete message settings and Message ID to edit
- message_delete - deletes the list. Input: Message ID
- message_delete_list - deletes a list of lists. Input: comma-separated list of Message IDs
- campaign_create - adds a new campaign.
- campaign_send - sends an existing campaign. Input: Campaign ID, Subscriber Email
- campaign_status - changes the campaign status. Input: Campaign ID
- campaign_delete - deletes the campaign. Input: Campaign ID
- campaign_delete_list - deletes a list of campaigns. Input: comma-separated list of Campaign IDs
- form_view - returns the subscription form info. Input: Subscription Form ID
- form_list - returns a list of subscription forms. Input: comma-separated list of Subscription Form IDs
- form_add - adds the subscription form. Input: complete subscription form settings
- form_edit - edits the subscription form. Input: complete subscription form settings and Subscription Form ID to edit
- form_delete - deletes the subscription form. Input: Subscription Form ID
- form_delete_list - deletes a list of subscription forms. Input: comma-separated list of Subscription Form IDs
Kết quả trả về:
API có thể trả về kết quả ở dạng:
- serialized format - có thể decode với hàm unserialize() trong PHP.
- JSON có thể decode với hàm json_decode() (với PHP 5.2.0 trở đi).
- XML bạn cần viết chương trình duyệt dữ liệu XML để phân tích kết quả.
Nếu bạn muốn thay đổi định dạng ra, thay đổi biến 'api_output'. Dữ liệu trả về có thể là 'serialize', 'xml' and 'json'.
Các ví dụ:
Bạn có thể liên hệ với
Địa chỉ email này đã được bảo vệ từ spam bots, bạn cần kích hoạt Javascript để xem nó.
để được cung cấp các ví dụ sử dụng API.