Getting Started

✨ Quick Start

Publish your first API in 5 mins

Building an API let's you create reusable logic that you can use from anywhere.

With Craftar you can define your logic by connecting lego-like blocks.

Here's how: 👇


Step 1: Sign up/Login to Craftar

If you haven't yet, you can Sign up for free.

If you already have an account, you can Log In here.


Step 2: What are we building?

We will be creating an API that can tell jokes!

The api will have the following Input and Output:

Input

Category

One of Any, Miscellaneous, Programming, Dark, Pun, Spooky, Christmas

Output

Joke

Why did the koala get rejected? Because he did not have any koalafication.


Step 3: Create API

  1. Go to dashboard click on the Create API card.
  2. Then write a name for the API, in this case Jokes API
  3. Click Create

Step 4: Create Jokes Block

  1. Right click on the canvas (white area) to open up the blocks menu
  2. Choose Fun category
  3. Choose Jokes

You should now see a Jokes block created as shown below.


Step 5: Create API Input

The left sidebar is where we define the inputs and outputs of our API

  1. Click on the icon to create an Input
  2. This opens up a right sidebar for that input
    • Change the name of Input0 to Category
    • Choose the data type as Text
    • Set the value to Pun (we'll use this to test our API)

Step 5: Create API Output

  1. Click on icon next to Outputs
  2. This opens up a right sidebar for that output
    • Change the name of Output0 to Joke
    • Choose the data type as Text

Step 6: Inputs and Outputs Block

All apis have an Inputs block and an Outputs block.

  • When you create an Input from API Settings Sidebar (Step 5), it will create a port in the Inputs block.
  • When you create an Output from API Settings Sidebar (Step 6), it create a port in the Outputs block.

All APIs start running from Inputs block and stop running at Outputs block.


Step 7: Connect Blocks: Flow

We will define the order in which blocks will run by connecting Exit to Enter.

  • Flow is defined by connecting green triangle ports.
  • Each block has it's own enter and exit ports.
    • Inputs only has Exit since logic starts here
    • Outputs only has Enter since logic ends here

To Connect left click on a triangle and then left click on the other triangle you want to connect to.

  1. Connect Exit of Inputs to Enter of Jokes Block
  2. Connect Exit of Jokes Block to Enter of Outputs Block

Logic starts at Inputs block -> Goes through Jokes Block -> Ends at Outputs Block


Step 8: Connect Blocks: Data

Our goal is to convert some Inputs to some Outputs.

Circles on each block represent data.

  • Circles on Left Side of the block indicates input data
  • Circle on Right Side of the block indicates output data
  • Each circle has a color which indicate the type of data from following
    Data Types in Craftar
  • Outputs of a block can be connected to Inputs of a block ahead of it.

To Connect left click on a circle and then left click on the other circle of the same color you want to connect to.

  1. Connect Category circle of Inputs Block to Category circle of Jokes Block
  2. Connect Full Joke circle of Jokes Block to Joke circle of Outputs Block

Step 9: Play

Click on the Play button in the Top Bar

Play let's you test your APIs and check if your connections were correct.


Step 10: Check Results

Click on Inputs Block

  1. This opens block settings panel on the right
  2. You should see the value of Category output to be Pun
  3. Which is what we entered to test.

Click on Jokes Block

  1. Inputs Section shows you the inputs that were passed to it when you clicked Play.
  2. Outputs Section shows you the outputs from running this block
  3. You should see our Pun Joke generated.

Now click on Outputs Block

  1. The value of Joke input in the Outputs block should be equal to our Joke.

Step 11: Publish API

  1. Click on the Publish button in the Top Bar
  2. This will open up Publish Settings Panel.
  3. Click on the green Publish Now Button to Go Live
  4. Your API is live now and API key is generated
  5. Request params sections shows you the data you need to call the API from anywhere.

For a quick test: Click on Run Api In Browser button


Step 12: Congrats!

🎉 You have successfully created your first API that can tell jokes!


Next Steps

Learn more about 🧠 Fundamental Concepts

Discover 🚀 Use Cases