Create a Snippet

Estimated reading: 2 minutes 83 views
  • Now scroll down to the Create Snippet.
  • Enter an endpoint title in the Create Snippet field.

Note: Do not enter any Special Characters [!@#$%^&*_()+-=] into the title.

  • Now, click on the Save Changes button.
  • After saving the settings, REST API URL will be displayed under the Create Snippet field.
  • Here, you have to use the following URI parameters and replace the following parameters.
    • {token} : replace with your 16 digit generated token.
    • {snippet-title}: replace with a new title.
    • {var}: use for empty or enter comma separated values like, username,email etc.
    • {shortcode} : use for enable and for disable.
    • {php} : use to make it php or for empty.
    • {wptexturize} :  use to enable wptexturize or to disable.
    • {snippet-code} : write simple/plain text, HTMLPHP etc.
    • {snippet-description} : enter a short description for your snippet.
  • After replacing the parameters with new URI parameters, the URL will look like this:
  • https://wordpress-444586-2318562.cloudwaysapps.com/wp-json/post-snippets/restapiSnippet/A2DjNM62Igvkr4AM/newSnippet/fname,lname/0/1/0/snippet?snippet_code=$fname = {fname}; $lname = {lname}; echo $fname; echo $lname;&description=this is the rest api snippet
  • Now, go to your browser search tab and paste the URI.
  • Or go to the Postman, paste the URI in the Enter request URL tab.
  • Click on the Send button.
  • Your response result will be successful.
  • Your Snippet will be successfully created.
  • Go to the All Snippets section to check your newly created snippet.
  • Open your newly created snippet.

Leave a Reply

Your email address will not be published. Required fields are marked *

Share this Doc

Create a Snippet

Or copy link

CONTENTS
Scroll to Top