At A Glance

Overview

Our API is a key part of our product offering here at Mijireh. Our goal is to make it super easy for developers and partners to build plugins and other integrations on top of our e-Commerce platform.

We embrace the REST style of publishing APIs. We speak HTTP and JSON right now. JSON is used both for sending data to, and receiving data from, our API.

All requests must be made over HTTPS.

We are working on providing language-specific libraries for interacting with our API but for now you can browse our API using the menu on the left and use those code samples for getting started.

If you have any questions/problems, please let us know.

Authentication

Each store you have with Mijireh is assigned a unique Access Key. This access key is your primary way of communicating with our API. All current API calls are made in the context of a single store.

HTTP Basic Authentication

We use standard HTTP Basic Authentication for our API. This means our API authentication should be compatible with most existing HTTP tools and clients.

Username Only, No Password Required

Your Access Key is used as the username and you can leave the password blank.

Example Request

curl https://secure.mijireh.com/api/1/store 
     -u 801e5a9a226b97b8acc90815: 

Note the colon at the end, that is required to signal to cURL that we’re not sending the password field.

Retrieving Store Info

Sometimes you may want to retrieve general information about your store from our API. We provide a simple way to do that. We simply use the Access Key you use for authenticating with our API to return back to you some information about your store in JSON.

Definition

GET https://secure.mijireh.com/api/1/store

Example Request

curl https://secure.mijireh.com/api/1/store 
     -u 801e5a9a226b97b8acc90815: 

Example Response

{
  "name":"Test Store",
  "mode":"live",
  "status":"active",
  "time_zone":"Eastern Time (US & Canada)",
  "paid_order_count":9,
  "monthly_sales":["USD":"15.75","GBP":"3.78"],
  "total_sales":["USD":"62.83","GBP":"56.39"],
  "slurped":true
}

Creating New Orders

Using our Orders API, you can POST new orders to Mijireh using information collected from your own site. You can then redirect your buyers to your secure Mijireh Checkout page to complete the order.

Definition

POST https://secure.mijireh.com/api/1/orders

Example Request

curl https://secure.mijireh.com/api/1/orders 
     -u 801e5a9a226b97b8acc90815: 
     -d '{
           "email":"bud@abbott.com",
           "first_name":"Bud",
           "last_name":"Abbott",
           "tax":"1.25",
           "shipping":"5.35",
           "discount":"3.00",
           "total":"28.75",
           "return_url":"http://yourstore.com/receipt",
           "meta_data":{ 
                         "some-custom-message":"Hi Bud", 
                         "some-other-data":"can go here"  
                       },
           "items":[
                     {
                       "name":"Hipster Hat",
                       "price":"9.95",
                       "quantity":"2",
                       "sku":"hipster-hat"
                     },
                     {
                       "name":"Smooth Scarf",
                       "price":"5.25",
                       "quantity":"1",
                       "sku":"smooth-scarf"
                     }
                   ]
         }'

Example Response

{
   "order_number":"18EC45D172595584",
   "mode":"live",
   "status":"pending",
   "order_date":2012-04-02 14:09:20 -0500, 
   "ip_address":null, 
   "checkout_url":"https://secure.mijireh.com/checkout/18EC45D172595584"
   "email":"bud@abbott.com",
   "first_name":"Bud",
   "last_name":"Abbott",
   "tax":"1.25",
   "shipping":"5.35",
   "discount":"3.00",
   "subtotal":"22.15",
   "total":"28.75",
   "return_url":"http://yourstore.com/receipt",
   "meta_data":{ 
                 "some-custom-message":"Hi Bud", 
                 "some-other-data":"can go here"  
               },
   "items":[
             {
               "name":"Hipster Hat",
               "price":"9.95",
               "quantity":"2",
               "sku":"hipster-hat"
             },
             {
               "name":"Smooth Scarf",
               "price":"5.25",
               "quantity":"1",
               "sku":"smooth-scarf"
             }
           ]
}

Argument Reference

  • total (required)The total for the order in the format of #.##
  • return_url (required)The URL to return to after a successful checkout takes place on the order
  • items (at least 1 required)Array of order items consisting of name (required), quantity (>=1), price (required – #.##) and sku
    (optional)

    Example

    [
      { 
        "name":"Hipster Hat", 
        "quantity": 1, 
        "price": "9.95", 
        "sku": "hipster-hat" 
      }
    ]
    
  • email (optional)The email address of the buyer for the order
  • first_name (optional)The first name of the buyer for the order
  • last_name (optional)The last name of the buyer for the order
  • meta_data (optional)Hash of arbitrary key/value pairs for storing extra information about orders. This opens up many possibilities including creating your own custom receipt pages based on this information or for showing custom messages on your checkout page.

    Example

    { 
      "some-custom-message":"Hi Bud", 
      "some-other-data":"can go here"  
    }
    
  • tax (optional)The tax on the order in the format of #.##
  • shipping (optional)The shipping cost for the order in the format of #.##
  • discount (optional)The discounts for the order in the format of #.##
  • shipping_address (optional)The shipping address for the order

    Example

    {
      "street":"123 Anystreet",
      "city":"Anytown",
      "state_province":"TX",
      "zip_code":"12345",
      "country":"US"
    }
    

Retrieving A Single Order

Retrieving information about a single order can be done by supplying the order number after authenticating with your store’s Access Key.

Definition

GET https://secure.mijireh.com/api/1/orders/18EC45D172595584

Example Request

curl https://secure.mijireh.com/api/1/orders/18EC45D172595584 
     -u 801e5a9a226b97b8acc90815:

Example Response

{
   "order_number":"18EC45D172595584",
   "mode":"live",
   "status":"pending",
   "order_date":2012-04-02 14:09:20 -0500, 
   "ip_address":null, 
   "checkout_url":"https://secure.mijireh.com/checkout/18EC45D172595584"
   "email":"bud@abbott.com",
   "first_name":"Bud",
   "last_name":"Abbott",
   "tax":"1.25",
   "shipping":"5.35",
   "discount":"3.00",
   "subtotal":"22.15",
   "total":"28.75",
   "return_url":"http://yourstore.com/receipt",
   "meta_data":{ 
                 "some-custom-message":"Hi Bud", 
                 "some-other-data":"can go here"  
               },
   "items":[
             {
               "name":"Hipster Hat",
               "price":"9.95",
               "quantity":"2",
               "sku":"hipster-hat"
             },
             {
               "name":"Smooth Scarf",
               "price":"5.25",
               "quantity":"1",
               "sku":"smooth-scarf"
             }
           ]
}

Slurp A Checkout Page

Using our Page Slurp technology we can slurp up your existing checkout page design and host it securely for your store. Normally, checkout pages can be slurped from the Checkout Pages area inside our application. This pulls the HTML from your checkout page over the web.

However, if your checkout page design is not publicly available on the internet for any reason, you can simply push the HTML content to our API as a starting point for slurping up the rest of your assets (images, stylesheets, etc.) and securely store them away for you.

Definition

POST https://secure.mijireh.com/api/1/slurps

Example Request

curl https://secure.mijireh.com/api/1/orders/18EC45D172595584 
     -u 801e5a9a226b97b8acc90815: 
     -d '{
            "url":"http://yourstore.com/checkout.html",
            "html":"<html>
                      <head></head>
                      <body>
                        {{mj-checkout-form}}
                      </body>
                    </html>",
          }'

Example Response

{ "job_id":"d2d739a8a8fb80f0" }

The job_id returned is a unique identifier for the Page Slurp job that gets run on the back-end. This is used for internal purposes for now, but may be used in the future as we continue to expand the API and our services.

Argument Reference

  • url (required)The full absolute URL for the checkout page. This is NOT used to pull the HTML for the checkout page. It is only used to properly transform relative links to assets on your server to point to our secure location.
  • html (required)The raw HTML of the checkout page you would like to have slurped. Don’t forget to include the {{mj-checkout-form}} placeholder in the HTML so that our checkout form can be rendered inside of your own checkout page’s layout.

Appendix

Access Key

The unique key associated with each store for the purposes of interacting with the API.

Address

Argument Reference

  • street (required)The street number and name of the address
  • city (required)The city of the address
  • state_province (required)The state/province of the address
  • zip_code (required)The zip/postal code of the address
  • country (required)The country of the address
  • company (optional)The company name of the address
  • apt_suite (optional)The apt/suite or “line 2” of the address
  • phone (optional)The phone number for the address