Initial Test

Prepare

Sign up for a free DFend account

Sign up here. You have 1,000 free requests per month. No credit card required.

If you already have a DFend account, log in here.

Locate API keys

Follow this link to find your API keys.

Open a terminal session

Find and open terminal (Mac) or Command Line (Windows) or the equivalent on your computer. We will be using cURL for this test, which normally comes preinstalled.

You can also run an equivalent test using any HTTP request testing tool, such as Postman. However, you will need to adapt the commands to the tool's interface.

Create a test Identity

Copy and paste the following multi-line command into your terminal, making sure to replace SECRET_API_KEY with your key:

curl -X POST https://api.dfend.app/identity \ -H 'Content-Type: application/json' \ -H 'x-api-key: SECRET_API_KEY' \ -d '{"userId":"test"}'

After replacing the value, press enter to run the command. See the response log, and continue to the next step assuming there was no error.

If you encounter an error that hints at Identity, please ensure that the entire command was pasted.

Send a Signal for your test Identity

From an untrusted (browser) environment

Use the tool at https://demo.dfend.app. Since you already created your test Identity, ignore that section.

The demo tool uses the DFend JS SDK, which you can add to any website or app that runs in a JavaScript environment.

From a trusted (server) environment

You can run this test on your computer. However, do not share your secret API key with anyone.

Prerequisite

Find your public IP address. Run the following command:

curl ifconfig.me

This will log your public IP address. There may be an extra % character on the end. Ignore this character. Only use the numbers and dots.

On your computer, you can also find this by searching Google for "what is my IP address".

You will use your IP address in the next step.

Send a Signal

Similar to how you created an Identity, run this multi-line command from terminal, replacing SECRET_API_KEY with your key and IP_ADDRESS with your IP address.

curl -X POST https://api.dfend.app/signal \ -H 'Content-Type: application/json' \ -H 'x-api-key: SECRET_API_KEY' \ -d '{"source":"Server","ip":"IP_ADDRESS","identifiers":{"userId":"test"}}'

Enter your IP address between the quotes, preserving them.

View in Dashboard

Congratulations, you've finished the test!

View the Identity you created here.

View the Signal you sent here.

Further testing

If you would like to trigger an anomaly, switch to a VPN on a location far from where you were initially located. Send another signal using the tool at https://demo.dfend.app for the same test Identity. Then visit the Events page under the Insights submenu in Dashboard.

Last updated