Page 1 of 1
How to use api via http request
Posted: 22 Jun 2017 19:53
by Indiboy
I want to use API
Here is the documentation
https://dirtymarkup.com/docs
How do i use it via automagic premium?
Re: How to use api via http request
Posted: 22 Jun 2017 20:14
by Martin
Hi,
You can use an action HTTP Request:
URL:
https://dirtymarkup.com/api/html
Request Method:
POST
Content Type:
application/x-www-form-urlencoded
Form Field List:
code=<html>test,indent=2
Store response in variable
The response seems to be a JSON so you can extract the formatted text using an action
Script:
Code: Select all
formatted_text=fromJSON(response)["clean"];
Please note that the form field list needs to be properly formatted in case the code contains commas and other special characters. You can prepare the form field list in a script by populating a variable list and then use {list,listformat,comma} to create the form field list. Example script:
Code: Select all
list = newList();
addElement(list, "code="+your_code);
addElement(list, "line-length=120");
Regards,
Martin