How to get contact form 7 fields via the rest API?

Question

I have a form created via contact form 7. I am using the Rest API to get its data. So far, this is what i get when i make an authenticated call to the forms /contact-form-7/v1/contact-forms/6 endpoint.

{
    "id": 6,
    "slug": "contact-form-1",
    "title": "Contact form 1",
    "locale": "en_US",
    "properties": {
        "form": "<label> Your Name (required)n    [text* your-name] </label>nn<label> Your Email (required)n    [email* your-email] </label>nn<label> Subjectn    [text your-subject] </label>nn<label> Your Messagen    [textarea your-message] </label>nn[submit "Send"]",
        "mail": {
            "subject": "Site "[your-subject]"",
            "sender": "Site <mbz@gmail.com>",
            "body": "From: [your-name] <[your-email]>nSubject: [your-subject]nnMessage Body:n[your-message]nn-- nThis e-mail was sent from a contact form on Site (http://localhost:8000)",
            "recipient": "mbz@gmail.com",
            "additional_headers": "Reply-To: [your-email]",
            "attachments": "",
            "use_html": 0,
            "exclude_blank": 0
        },
        "mail_2": {
            "active": false,
            "subject": "Site "[your-subject]"",
            "sender": "Site <mbz@gmail.com>",
            "body": "Message Body:n[your-message]nn-- nThis e-mail was sent from a contact form on Site (http://localhost:8000)",
            "recipient": "[your-email]",
            "additional_headers": "Reply-To: mbz@gmail.com",
            "attachments": "",
            "use_html": 0,
            "exclude_blank": 0
        },
        "messages": {
            "mail_sent_ok": "Thank you for your message. It has been sent.",
            "mail_sent_ng": "There was an error trying to send your message. Please try again later.",
            "validation_error": "One or more fields have an error. Please check and try again.",
            "spam": "There was an error trying to send your message. Please try again later.",
            "accept_terms": "You must accept the terms and conditions before sending your message.",
            "invalid_required": "The field is required.",
            "invalid_too_long": "The field is too long.",
            "invalid_too_short": "The field is too short.",
            "invalid_date": "The date format is incorrect.",
            "date_too_early": "The date is before the earliest one allowed.",
            "date_too_late": "The date is after the latest one allowed.",
            "upload_failed": "There was an unknown error uploading the file.",
            "upload_file_type_invalid": "You are not allowed to upload files of this type.",
            "upload_file_too_large": "The file is too big.",
            "upload_failed_php_error": "There was an error uploading the file.",
            "invalid_number": "The number format is invalid.",
            "number_too_small": "The number is smaller than the minimum allowed.",
            "number_too_large": "The number is larger than the maximum allowed.",
            "quiz_answer_not_correct": "The answer to the quiz is incorrect.",
            "captcha_not_match": "Your entered code is incorrect.",
            "invalid_email": "The e-mail address entered is invalid.",
            "invalid_url": "The URL is invalid.",
            "invalid_tel": "The telephone number is invalid."
        },
        "additional_settings": null
    }
}

As you can see the form field under properties is unreadable. So my question is, how do i get the fields to give me a response something like this:

{
 "form": [
  {
   type: "text",
   label: "Your Name",
   id: "your-name"
  },
  {
   type: "email",
   label: "Your Email",
   id: "your-email"
  }
 ]
}

and so on!

Please help!

0
, , , Enthusiast 2 years 2019-10-29T12:02:45-05:00 0 Answers 121 views 0

Leave an answer

Browse
Browse