The general-purpose API
The generated code uses the Newtonsoft Json.NET NuGet Package. If the automatic NuGet package restore is enabled, these dependencies will be installed automatically. Therefore, you will need internet access for build.
- Open the solution (NeutrinoAPI.sln) file.
- Invoke the build process using
Ctrl+Shift+B
shortcut key or using theBuild
menu as shown below.
The build process generates a portable class library, which can be used like a normal class library. The generated library is compatible with Windows Forms, Windows RT, Windows Phone 8, Silverlight 5, Xamarin iOS, Xamarin Android and Mono. More information on how to use can be found at the MSDN Portable Class Libraries documentation.
The following section explains how to use the NeutrinoAPI library in a new console project.
For starting a new project, right click on the current solution from the solution explorer and choose Add -> New Project
.
Next, choose "Console Application", provide a TestConsoleProject
as the project name and click OK
.
The new console project is the entry point for the eventual execution. This requires us to set the TestConsoleProject
as the start-up project. To do this, right-click on the TestConsoleProject
and choose Set as StartUp Project
form the context menu.
In order to use the NeutrinoAPI library in the new project, first we must add a projet reference to the TestConsoleProject
. First, right click on the References
node in the solution explorer and click Add Reference...
.
Next, a window will be displayed where we must set the checkbox
on NeutrinoAPI.PCL
and click OK
. By doing this, we have added a reference of the NeutrinoAPI.PCL
project into the new TestConsoleProject
.
Once the TestConsoleProject
is created, a file named Program.cs
will be visible in the solution explorer with an empty Main
method. This is the entry point for the execution of the entire solution.
Here, you can add code to initialize the client library and acquire the instance of a Controller class. Sample code to initialize the client library and using controller methods is given in the subsequent sections.
The generated SDK also contain one or more Tests, which are contained in the Tests project. In order to invoke these test cases, you will need NUnit 3.0 Test Adapter Extension for Visual Studio. Once the SDK is complied, the test cases should appear in the Test Explorer window. Here, you can click Run All to execute these test cases.
In order to setup authentication and initialization of the API client, you need the following information.
Parameter | Description |
---|---|
userId | Your user ID |
apiKey | Your API key |
API client can be initialized as following.
// Configuration parameters and credentials
string userId = "userId"; // Your user ID
string apiKey = "apiKey"; // Your API key
NeutrinoAPIClient client = new NeutrinoAPIClient(userId, apiKey);
The singleton instance of the Imaging
class can be accessed from the API Client.
IImaging imaging = client.Imaging;
Resize an image and output as either JPEG or PNG. See: https://www.neutrinoapi.com/api/image-resize/
Task<Stream> ImageResize(
string imageUrl,
int width,
int height,
string format = "png")
Parameter | Tags | Description |
---|---|---|
imageUrl | Required |
The URL to the source image |
width | Required |
The width to resize to (in px) while preserving aspect ratio |
height | Required |
The height to resize to (in px) while preserving aspect ratio |
format | Optional DefaultValue |
The output image format, can be either png or jpg |
string imageUrl = "image-url";
int width = 137;
int height = 137;
string format = "png";
Stream result = await imaging.ImageResize(imageUrl, width, height, format);
Generate a QR code as a PNG image. See: https://www.neutrinoapi.com/api/qr-code/
Task<Stream> QRCode(
string content,
int? width = 256,
int? height = 256,
string fgColor = "#000000",
string bgColor = "#ffffff")
Parameter | Tags | Description |
---|---|---|
content | Required |
The content to encode into the QR code (e.g. a URL or a phone number) |
width | Optional DefaultValue |
The width of the QR code (in px) |
height | Optional DefaultValue |
The height of the QR code (in px) |
fgColor | Optional DefaultValue |
The QR code foreground color |
bgColor | Optional DefaultValue |
The QR code background color |
string content = "content";
int? width = 256;
int? height = 256;
string fgColor = "#000000";
string bgColor = "#ffffff";
Stream result = await imaging.QRCode(content, width, height, fgColor, bgColor);
Watermark one image with another image. See: https://www.neutrinoapi.com/api/image-watermark/
Task<Stream> ImageWatermark(
string imageUrl,
string watermarkUrl,
int? opacity = 50,
string format = "png",
string position = "center",
int? width = null,
int? height = null)
Parameter | Tags | Description |
---|---|---|
imageUrl | Required |
The URL to the source image |
watermarkUrl | Required |
The URL to the watermark image |
opacity | Optional DefaultValue |
The opacity of the watermark (0 to 100) |
format | Optional DefaultValue |
The output image format, can be either png or jpg |
position | Optional DefaultValue |
The position of the watermark image, possible values are: center, top-left, top-center, top-right, bottom-left, bottom-center, bottom-right |
width | Optional |
If set resize the resulting image to this width (in px) while preserving aspect ratio |
height | Optional |
If set resize the resulting image to this height (in px) while preserving aspect ratio |
string imageUrl = "image-url";
string watermarkUrl = "watermark-url";
int? opacity = 50;
string format = "png";
string position = "center";
int? width = 137;
int? height = 137;
Stream result = await imaging.ImageWatermark(imageUrl, watermarkUrl, opacity, format, position, width, height);
Render HTML content to PDF, JPG or PNG. See: https://www.neutrinoapi.com/api/html5-render/
Task<Stream> HTML5Render(
string content,
string format = "PDF",
string pageSize = "A4",
string title = null,
int? margin = 0,
int? marginLeft = 0,
int? marginRight = 0,
int? marginTop = 0,
int? marginBottom = 0,
bool? landscape = false,
int? zoom = 1,
bool? grayscale = false,
bool? mediaPrint = false,
bool? mediaQueries = false,
bool? forms = false,
string css = null,
int? imageWidth = 1024,
int? imageHeight = null,
int? renderDelay = 0,
string headerTextLeft = null,
string headerTextCenter = null,
string headerTextRight = null,
int? headerSize = 9,
string headerFont = "Courier",
int? headerFontSize = 11,
bool? headerLine = false,
string footerTextLeft = null,
string footerTextCenter = null,
string footerTextRight = null,
int? footerSize = 9,
string footerFont = "Courier",
int? footerFontSize = 11,
bool? footerLine = false,
int? pageWidth = null,
int? pageHeight = null)
Parameter | Tags | Description |
---|---|---|
content | Required |
The HTML content. This can be either a URL to load HTML from or an actual HTML content string |
format | Optional DefaultValue |
Which format to output, available options are: PDF, PNG, JPG |
pageSize | Optional DefaultValue |
Set the document page size, can be one of: A0 - A9, B0 - B10, Comm10E, DLE or Letter |
title | Optional |
The document title |
margin | Optional DefaultValue |
The document margin (in mm) |
marginLeft | Optional DefaultValue |
The document left margin (in mm) |
marginRight | Optional DefaultValue |
The document right margin (in mm) |
marginTop | Optional DefaultValue |
The document top margin (in mm) |
marginBottom | Optional DefaultValue |
The document bottom margin (in mm) |
landscape | Optional DefaultValue |
Set the document to lanscape orientation |
zoom | Optional DefaultValue |
Set the zoom factor when rendering the page (2.0 for double size, 0.5 for half size) |
grayscale | Optional DefaultValue |
Render the final document in grayscale |
mediaPrint | Optional DefaultValue |
Use @media print CSS styles to render the document |
mediaQueries | Optional DefaultValue |
Activate all @media queries before rendering. This can be useful if you wan't to render the mobile version of a responsive website |
forms | Optional DefaultValue |
Generate real (fillable) PDF forms from HTML forms |
css | Optional |
Inject custom CSS into the HTML. e.g. 'body { background-color: red;}' |
imageWidth | Optional DefaultValue |
If rendering to an image format (PNG or JPG) use this image width (in pixels) |
imageHeight | Optional |
If rendering to an image format (PNG or JPG) use this image height (in pixels). The default is automatic which dynamically sets the image height based on the content |
renderDelay | Optional DefaultValue |
Number of milliseconds to wait before rendering the page (can be useful for pages with animations etc) |
headerTextLeft | Optional |
Text to print to the left-hand side header of each page. e.g. 'My header - Page {page_number} of {total_pages}' |
headerTextCenter | Optional |
Text to print to the center header of each page |
headerTextRight | Optional |
Text to print to the right-hand side header of each page |
headerSize | Optional DefaultValue |
The height of your header (in mm) |
headerFont | Optional DefaultValue |
Set the header font. Fonts available: Times, Courier, Helvetica, Arial |
headerFontSize | Optional DefaultValue |
Set the header font size (in pt) |
headerLine | Optional DefaultValue |
Draw a full page width horizontal line under your header |
footerTextLeft | Optional |
Text to print to the left-hand side footer of each page. e.g. 'My footer - Page {page_number} of {total_pages}' |
footerTextCenter | Optional |
Text to print to the center header of each page |
footerTextRight | Optional |
Text to print to the right-hand side header of each page |
footerSize | Optional DefaultValue |
The height of your footer (in mm) |
footerFont | Optional DefaultValue |
Set the footer font. Fonts available: Times, Courier, Helvetica, Arial |
footerFontSize | Optional DefaultValue |
Set the footer font size (in pt) |
footerLine | Optional DefaultValue |
Draw a full page width horizontal line above your footer |
pageWidth | Optional |
Set the PDF page width explicitly (in mm) |
pageHeight | Optional |
Set the PDF page height explicitly (in mm) |
string content = "content";
string format = "PDF";
string pageSize = "A4";
string title = "title";
int? margin = 0;
int? marginLeft = 0;
int? marginRight = 0;
int? marginTop = 0;
int? marginBottom = 0;
bool? landscape = false;
int? zoom = 1;
bool? grayscale = false;
bool? mediaPrint = false;
bool? mediaQueries = false;
bool? forms = false;
string css = "css";
int? imageWidth = 1024;
int? imageHeight = 137;
int? renderDelay = 0;
string headerTextLeft = "header-text-left";
string headerTextCenter = "header-text-center";
string headerTextRight = "header-text-right";
int? headerSize = 9;
string headerFont = "Courier";
int? headerFontSize = 11;
bool? headerLine = false;
string footerTextLeft = "footer-text-left";
string footerTextCenter = "footer-text-center";
string footerTextRight = "footer-text-right";
int? footerSize = 9;
string footerFont = "Courier";
int? footerFontSize = 11;
bool? footerLine = false;
int? pageWidth = 137;
int? pageHeight = 137;
Stream result = await imaging.HTML5Render(content, format, pageSize, title, margin, marginLeft, marginRight, marginTop, marginBottom, landscape, zoom, grayscale, mediaPrint, mediaQueries, forms, css, imageWidth, imageHeight, renderDelay, headerTextLeft, headerTextCenter, headerTextRight, headerSize, headerFont, headerFontSize, headerLine, footerTextLeft, footerTextCenter, footerTextRight, footerSize, footerFont, footerFontSize, footerLine, pageWidth, pageHeight);
The singleton instance of the Telephony
class can be accessed from the API Client.
ITelephony telephony = client.Telephony;
Check if a security code from one of the verify APIs is valid. See: https://www.neutrinoapi.com/api/verify-security-code/
Task<Models.VerifySecurityCodeResponse> VerifySecurityCode(string securityCode)
Parameter | Tags | Description |
---|---|---|
securityCode | Required |
The security code to verify |
string securityCode = "security-code";
Models.VerifySecurityCodeResponse result = await telephony.VerifySecurityCode(securityCode);
Connect to the global mobile cellular network and retrieve the status of a mobile device. See: https://www.neutrinoapi.com/api/hlr-lookup/
Task<Models.HLRLookupResponse> HLRLookup(string number, string countryCode = null)
Parameter | Tags | Description |
---|---|---|
number | Required |
A phone number |
countryCode | Optional |
ISO 2-letter country code, assume numbers are based in this country. If not set numbers are assumed to be in international format (with or without the leading + sign) |
string number = "number";
string countryCode = "country-code";
Models.HLRLookupResponse result = await telephony.HLRLookup(number, countryCode);
Make an automated call to any valid phone number and playback an audio message. See: https://www.neutrinoapi.com/api/phone-playback/
Task<Models.PhonePlaybackResponse> PhonePlayback(string number, string audioUrl)
Parameter | Tags | Description |
---|---|---|
number | Required |
The phone number to call. Must be in valid international format |
audioUrl | Required |
A URL to a valid audio file. Accepted audio formats are:
|
string number = "number";
string audioUrl = "audio-url";
Models.PhonePlaybackResponse result = await telephony.PhonePlayback(number, audioUrl);
Send a unique security code to any mobile device via SMS. See: https://www.neutrinoapi.com/api/sms-verify/
Task<Models.SMSVerifyResponse> SMSVerify(
string number,
int? codeLength = 5,
int? securityCode = null,
string countryCode = null,
string languageCode = "en")
Parameter | Tags | Description |
---|---|---|
number | Required |
The phone number to send a verification code to |
codeLength | Optional DefaultValue |
The number of digits to use in the security code (must be between 4 and 12) |
securityCode | Optional |
Pass in your own security code. This is useful if you have implemented TOTP or similar 2FA methods. If not set then we will generate a secure random code |
countryCode | Optional |
ISO 2-letter country code, assume numbers are based in this country. If not set numbers are assumed to be in international format (with or without the leading + sign) |
languageCode | Optional DefaultValue |
The language to send the verification code in, available languages are:
|
string number = "number";
int? codeLength = 5;
int? securityCode = 228;
string countryCode = "country-code";
string languageCode = "en";
Models.SMSVerifyResponse result = await telephony.SMSVerify(number, codeLength, securityCode, countryCode, languageCode);
Send a free-form message to any mobile device via SMS. See: https://www.neutrinoapi.com/api/sms-message/
Task<Models.SMSMessageResponse> SMSMessage(string number, string message, string countryCode = null)
Parameter | Tags | Description |
---|---|---|
number | Required |
The phone number to send a message to |
message | Required |
The SMS message to send. Messages are truncated to a maximum of 150 characters for ASCII content OR 70 characters for UTF content |
countryCode | Optional |
ISO 2-letter country code, assume numbers are based in this country. If not set numbers are assumed to be in international format (with or without the leading + sign) |
string number = "number";
string message = "message";
string countryCode = "country-code";
Models.SMSMessageResponse result = await telephony.SMSMessage(number, message, countryCode);
Make an automated call to any valid phone number and playback a unique security code. See: https://www.neutrinoapi.com/api/phone-verify/
Task<Models.PhoneVerifyResponse> PhoneVerify(
string number,
int? codeLength = 6,
int? securityCode = null,
int? playbackDelay = 800,
string countryCode = null,
string languageCode = "en")
Parameter | Tags | Description |
---|---|---|
number | Required |
The phone number to send the verification code to |
codeLength | Optional DefaultValue |
The number of digits to use in the security code (between 4 and 12) |
securityCode | Optional |
Pass in your own security code. This is useful if you have implemented TOTP or similar 2FA methods. If not set then we will generate a secure random code |
playbackDelay | Optional DefaultValue |
The delay in milliseconds between the playback of each security code |
countryCode | Optional |
ISO 2-letter country code, assume numbers are based in this country. If not set numbers are assumed to be in international format (with or without the leading + sign) |
languageCode | Optional DefaultValue |
The language to playback the verification code in, available languages are:
|
string number = "number";
int? codeLength = 6;
int? securityCode = 228;
int? playbackDelay = 800;
string countryCode = "country-code";
string languageCode = "en";
Models.PhoneVerifyResponse result = await telephony.PhoneVerify(number, codeLength, securityCode, playbackDelay, countryCode, languageCode);
The singleton instance of the DataTools
class can be accessed from the API Client.
IDataTools dataTools = client.DataTools;
Parse, validate and clean an email address. See: https://www.neutrinoapi.com/api/email-validate/
Task<Models.EmailValidateResponse> EmailValidate(string email, bool? fixTypos = false)
Parameter | Tags | Description |
---|---|---|
Required |
An email address | |
fixTypos | Optional DefaultValue |
Automatically attempt to fix typos in the address |
string email = "email";
bool? fixTypos = false;
Models.EmailValidateResponse result = await dataTools.EmailValidate(email, fixTypos);
Parse, validate and get detailed user-agent information from a user agent string. See: https://www.neutrinoapi.com/api/user-agent-info/
Task<Models.UserAgentInfoResponse> UserAgentInfo(string userAgent)
Parameter | Tags | Description |
---|---|---|
userAgent | Required |
A user agent string |
string userAgent = "user-agent";
Models.UserAgentInfoResponse result = await dataTools.UserAgentInfo(userAgent);
Detect bad words, swear words and profanity in a given text. See: https://www.neutrinoapi.com/api/bad-word-filter/
Task<Models.BadWordFilterResponse> BadWordFilter(string content, string censorCharacter = null)
Parameter | Tags | Description |
---|---|---|
content | Required |
The content to scan. This can be either a URL to load content from or an actual content string |
censorCharacter | Optional |
The character to use to censor out the bad words found |
string content = "content";
string censorCharacter = "censor-character";
Models.BadWordFilterResponse result = await dataTools.BadWordFilter(content, censorCharacter);
A powerful unit conversion tool. See: https://www.neutrinoapi.com/api/convert/
Task<Models.ConvertResponse> Convert(string fromValue, string fromType, string toType)
Parameter | Tags | Description |
---|---|---|
fromValue | Required |
The value to convert from (e.g. 10.95) |
fromType | Required |
The type of the value to convert from (e.g. USD) |
toType | Required |
The type to convert to (e.g. EUR) |
string fromValue = "from-value";
string fromType = "from-type";
string toType = "to-type";
Models.ConvertResponse result = await dataTools.Convert(fromValue, fromType, toType);
Parse, validate and get location information about a phone number. See: https://www.neutrinoapi.com/api/phone-validate/
Task<Models.PhoneValidateResponse> PhoneValidate(string number, string countryCode = null, string ip = null)
Parameter | Tags | Description |
---|---|---|
number | Required |
A phone number. This can be in international format (E.164) or local format. If passing local format you should use the 'country-code' or 'ip' options as well |
countryCode | Optional |
ISO 2-letter country code, assume numbers are based in this country. If not set numbers are assumed to be in international format (with or without the leading + sign) |
ip | Optional |
Pass in a users IP address and we will assume numbers are based in the country of the IP address |
string number = "number";
string countryCode = "country-code";
string ip = "ip";
Models.PhoneValidateResponse result = await dataTools.PhoneValidate(number, countryCode, ip);
The singleton instance of the SecurityAndNetworking
class can be accessed from the API Client.
ISecurityAndNetworking securityAndNetworking = client.SecurityAndNetworking;
Analyze and extract provider information for an IP address. See: https://www.neutrinoapi.com/api/ip-probe/
Task<Models.IPProbeResponse> IPProbe(string ip)
Parameter | Tags | Description |
---|---|---|
ip | Required |
IPv4 or IPv6 address |
string ip = "ip";
Models.IPProbeResponse result = await securityAndNetworking.IPProbe(ip);
SMTP based email address verification. See: https://www.neutrinoapi.com/api/email-verify/
Task<Models.EmailVerifyResponse> EmailVerify(string email, bool? fixTypos = false)
Parameter | Tags | Description |
---|---|---|
Required |
An email address | |
fixTypos | Optional DefaultValue |
Automatically attempt to fix typos in the address |
string email = "email";
bool? fixTypos = false;
Models.EmailVerifyResponse result = await securityAndNetworking.EmailVerify(email, fixTypos);
The IP Blocklist API will detect potentially malicious or dangerous IP addresses. See: https://www.neutrinoapi.com/api/ip-blocklist/
Task<Models.IPBlocklistResponse> IPBlocklist(string ip)
Parameter | Tags | Description |
---|---|---|
ip | Required |
An IPv4 or IPv6 address |
string ip = "ip";
Models.IPBlocklistResponse result = await securityAndNetworking.IPBlocklist(ip);
Check the reputation of an IP address, domain name, FQDN or URL against a comprehensive list of blacklists and blocklists. See: https://www.neutrinoapi.com/api/host-reputation/
Task<Models.HostReputationResponse> HostReputation(string host, int? listRating = 3)
Parameter | Tags | Description |
---|---|---|
host | Required |
An IP address, domain name, FQDN or URL. If you supply a domain/URL it will be checked against the URI DNSBL lists |
listRating | Optional DefaultValue |
Only check lists with this rating or better |
string host = "host";
int? listRating = 3;
Models.HostReputationResponse result = await securityAndNetworking.HostReputation(host, listRating);
The singleton instance of the Geolocation
class can be accessed from the API Client.
IGeolocation geolocation = client.Geolocation;
Convert a geographic coordinate (latitude and longitude) into a real world address. See: https://www.neutrinoapi.com/api/geocode-reverse/
Task<Models.GeocodeReverseResponse> GeocodeReverse(
string latitude,
string longitude,
string languageCode = "en",
string zoom = "address")
Parameter | Tags | Description |
---|---|---|
latitude | Required |
The location latitude in decimal degrees format |
longitude | Required |
The location longitude in decimal degrees format |
languageCode | Optional DefaultValue |
The language to display results in, available languages are:
|
zoom | Optional DefaultValue |
The zoom level to respond with:
|
string latitude = "latitude";
string longitude = "longitude";
string languageCode = "en";
string zoom = "address";
Models.GeocodeReverseResponse result = await geolocation.GeocodeReverse(latitude, longitude, languageCode, zoom);
Get location information about an IP address and do reverse DNS (PTR) lookups. See: https://www.neutrinoapi.com/api/ip-info/
Task<Models.IPInfoResponse> IPInfo(string ip, bool? reverseLookup = false)
Parameter | Tags | Description |
---|---|---|
ip | Required |
IPv4 or IPv6 address |
reverseLookup | Optional DefaultValue |
Do a reverse DNS (PTR) lookup. This option can add extra delay to the request so only use it if you need it |
string ip = "ip";
bool? reverseLookup = false;
Models.IPInfoResponse result = await geolocation.IPInfo(ip, reverseLookup);
Geocode an address, partial address or just the name of a place. See: https://www.neutrinoapi.com/api/geocode-address/
Task<Models.GeocodeAddressResponse> GeocodeAddress(
string address,
string countryCode = null,
string languageCode = "en",
bool? fuzzySearch = false)
Parameter | Tags | Description |
---|---|---|
address | Required |
The address, partial address or name of a place to try and locate |
countryCode | Optional |
The ISO 2-letter country code to be biased towards (the default is no country bias) |
languageCode | Optional DefaultValue |
The language to display results in, available languages are:
|
fuzzySearch | Optional DefaultValue |
If no matches are found for the given address, start performing a recursive fuzzy search until a geolocation is found. This option is recommended for processing user input or implementing auto-complete. We use a combination of approximate string matching and data cleansing to find possible location matches |
string address = "address";
string countryCode = "country-code";
string languageCode = "en";
bool? fuzzySearch = false;
Models.GeocodeAddressResponse result = await geolocation.GeocodeAddress(address, countryCode, languageCode, fuzzySearch);
The singleton instance of the ECommerce
class can be accessed from the API Client.
IECommerce eCommerce = client.ECommerce;
Perform a BIN (Bank Identification Number) or IIN (Issuer Identification Number) lookup. See: https://www.neutrinoapi.com/api/bin-lookup/
Task<Models.BINLookupResponse> BINLookup(string binNumber, string customerIp = null)
Parameter | Tags | Description |
---|---|---|
binNumber | Required |
The BIN or IIN number (the first 6 digits of a credit card number) |
customerIp | Optional |
Pass in the customers IP address and we will return some extra information about them |
string binNumber = "bin-number";
string customerIp = "customer-ip";
Models.BINLookupResponse result = await eCommerce.BINLookup(binNumber, customerIp);
The singleton instance of the WWW
class can be accessed from the API Client.
IWWW wWW = client.WWW;
Parse, analyze and retrieve content from the supplied URL. See: https://www.neutrinoapi.com/api/url-info/
Task<Models.URLInfoResponse> URLInfo(
string url,
bool? fetchContent = false,
bool? ignoreCertificateErrors = false,
int? timeout = 20)
Parameter | Tags | Description |
---|---|---|
url | Required |
The URL to probe |
fetchContent | Optional DefaultValue |
If this URL responds with html, text, json or xml then return the response. This option is useful if you want to perform further processing on the URL content (e.g. with the HTML Extract or HTML Clean APIs) |
ignoreCertificateErrors | Optional DefaultValue |
Ignore any TLS/SSL certificate errors and load the URL anyway |
timeout | Optional DefaultValue |
Timeout in seconds. Give up if still trying to load the URL after this number of seconds |
string url = "url";
bool? fetchContent = false;
bool? ignoreCertificateErrors = false;
int? timeout = 20;
Models.URLInfoResponse result = await wWW.URLInfo(url, fetchContent, ignoreCertificateErrors, timeout);
Clean and sanitize untrusted HTML. See: https://www.neutrinoapi.com/api/html-clean/
Task<Stream> HTMLClean(string content, string outputType)
Parameter | Tags | Description |
---|---|---|
content | Required |
The HTML content. This can be either a URL to load HTML from or an actual HTML content string |
outputType | Required |
The level of sanitization, possible values are: plain-text: reduce the content to plain text only (no HTML tags at all) simple-text: allow only very basic text formatting tags like b, em, i, strong, u basic-html: allow advanced text formatting and hyper links basic-html-with-images: same as basic html but also allows image tags advanced-html: same as basic html with images but also allows many more common HTML tags like table, ul, dl, pre |
string content = "content";
string outputType = "output-type";
Stream result = await wWW.HTMLClean(content, outputType);
Browser bot can extract content, interact with keyboard and mouse events, and execute JavaScript on a website. See: https://www.neutrinoapi.com/api/browser-bot/
Task<Models.BrowserBotResponse> BrowserBot(
string url,
int? timeout = 30,
int? delay = 3,
string selector = null,
List<string> exec = null,
string userAgent = null,
bool? ignoreCertificateErrors = false)
Parameter | Tags | Description |
---|---|---|
url | Required |
The URL to load |
timeout | Optional DefaultValue |
Timeout in seconds. Give up if still trying to load the page after this number of seconds |
delay | Optional DefaultValue |
Delay in seconds to wait before capturing any page data, executing selectors or JavaScript |
selector | Optional |
Extract content from the page DOM using this selector. Commonly known as a CSS selector, you can find a good reference here |
exec | Optional Collection |
Execute JavaScript on the page. Each array element should contain a valid JavaScript statement in string form. If a statement returns any kind of value it will be returned in the 'exec-results' response. For your convenience you can also use the following special shortcut functions: sleep(seconds); Just wait/sleep for the specified number of seconds. click('selector'); Click on the first element matching the given selector. focus('selector'); Focus on the first element matching the given selector. keys('characters'); Send the specified keyboard characters. Use click() or focus() first to send keys to a specific element. enter(); Send the Enter key. tab(); Send the Tab key. Example: [ "click('#button-id')", "sleep(1)", "click('.field-class')", "keys('1234')", "enter()" ] |
userAgent | Optional |
Override the browsers default user-agent string with this one |
ignoreCertificateErrors | Optional DefaultValue |
Ignore any TLS/SSL certificate errors and load the page anyway |
string url = "url";
int? timeout = 30;
int? delay = 3;
string selector = "selector";
List<string> exec = new List<string> { "exec" };
string userAgent = "user-agent";
bool? ignoreCertificateErrors = false;
Models.BrowserBotResponse result = await wWW.BrowserBot(url, timeout, delay, selector, exec, userAgent, ignoreCertificateErrors);