Skip to content

Magento 2

Before you begin

In order to use the features in this section you need to have an active Spojit account. If you don't have an account you can checkout out the pricing and register here. If you already have an account you can login here.


Magento 2 empowers thousands of retailers and brands with the best eCommerce platforms and flexible cloud solutions to rapidly innovate and grow.

Tip

Full documentation of Magento 2 resources and configuration is available at Magento 2 API Documentation.


Magento 2 Authorization

The following authorization configuration needs to filled out in order to connect with Magento 2:

Option Description Default Required
URL The main URL of your Magento 2 instance (i.e. https://www.mymagentostore.com). - TRUE
Store Code The store code you wish to access. Default refers to your default store. default TRUE
Access Token The permanent Access Token. - TRUE

The following example configuration shows you how to configure the authorziation for Magento 2:

Magento 2 Authorization Configuration

Tip

Create an integration in Magento 2 admin to get your access token: Magento 2 Create Integration in admin. Please note: no Callback URL or Identity Link URL is required when addin a new integration.

Important

This service uses Version 1 (V1) of the Magento 2 Rest API by default and will append this and the store code to the URL automatically. Please add the paths accordingly without the reference to /rest/{{ store_code }}/V1/:

Correct Incorrect
/bundle-products/options/types /rest/default/V1/bundle-products/options/types

Important

  • This service has a built in JSON parser and will automatically convert to the proper format. Requests will automatically contain required headers and authorization configuration so they do not need to be added.
  • The following (below) is a general guide on how to use the methods for this service. The examples use the JSONPlaceholder fake online REST API. Please refer to the system documentation above for full path and schema information.

GET

When the GET configuration is selected the service will retrieve a resource from a given URL.

Option Description Default Required
Method Select "get" to retrieve a resource. - TRUE
API Url The full URL of the resource . - TRUE
Headers The request headers are not required as a request can be made without them. If added the Header Key and Header Value is required for each. - FALSE
Header Key The name of the header key. - TRUE
Header Value The value of the header. - TRUE
Example configuration and mapping

The following example shows you how to configure the Rest Service to get data from a resource. It also contains an example header for an OAuth authorization bearer token.

Rest Service GET Configuration

The GET method doesn't require any service data setup.

In this example the following output will be generated automatically by this service after it is run:

{
    "data": {
        "userId": 1,
        "id": 1,
        "title": "delectus aut autem",
        "completed": false
    },
    "metadata": {
        "statusCode": 200
    }
}

POST

When the POST configuration is selected the service will create a resource at a given location.

Option Description Default Required
Method Select "post" to create a resource. - TRUE
API Url The full URL of the resource . - TRUE
Headers The request headers are not required as a request can be made without them. If added the Header Key and Header Value is required for each. - FALSE
Header Key The name of the header key. - TRUE
Header Value The value of the header. - TRUE
Example configuration and mapping

The following example shows you how to configure the Rest Service to create a resource.

Rest Service POST Configuration

The schema can be whatever the resource excepts and for this example we are going to create an OBJECT schema with the specified fields:

Rest Service POST Schema

Given the following source data from another service:

{
  "data": {
      "user_id": 1,
      "my_id": 1,
      "the_title": "delectus aut autem",
      "finished": false
  }
}

We can map the applicable fields with the schema object:

Rest Service POST Mapping

In this example the following output will be generated automatically by this service after it is run:

{
    "data": {
        "userId": 1,
        "id": 1,
        "title": "delectus aut autem",
        "completed": false
    },
    "metadata": {
        "statusCode": 201
    }
}

PUT

When the PUT configuration is selected the service will update a resource at a given location.

Option Description Default Required
Method Select "put" to update a resource. - TRUE
API Url The full URL of the resource . - TRUE
Headers The request headers are not required as a request can be made without them. If added the Header Key and Header Value is required for each. - FALSE
Header Key The name of the header key. - TRUE
Header Value The value of the header. - TRUE
Example configuration and mapping

The following example shows you how to configure the Rest Service to update a resource.

Rest Service PUT Configuration

The schema can be whatever the resource excepts and for this example we are going to create an OBJECT schema with the specified fields:

Rest Service PUT Schema

Given the following source data from another service:

{
  "data": {
      "user_id": 1,
      "my_id": 1,
      "the_title": "delectus aut autem",
      "finished": false
  }
}

We can map the applicable fields with the schema object:

Rest Service PUT Mapping

In this example the following output will be generated automatically by this service after it is run:

{
    "data": {
        "userId": 1,
        "id": 1,
        "title": "delectus aut autem",
        "completed": false
    },
    "metadata": {
        "statusCode": 200
    }
}

DELETE

When the DELETE configuration is selected the service will delete a resource from a given URL.

Option Description Default Required
Method Select "delete" to delete a resource. - TRUE
API Url The full URL of the resource . - TRUE
Headers The request headers are not required as a request can be made without them. If added the Header Key and Header Value is required for each. - FALSE
Header Key The name of the header key. - TRUE
Header Value The value of the header. - TRUE
Example configuration and mapping

The following example shows you how to configure the Rest Service to delete a resource:

Rest Service DELETE Configuration

The DELETE method doesn't require any service data setup.

Many services will not return any data after a resource is deleted but if data is returned it could possiblly look like this:

{
    "data": {
        "userId": 1,
        "id": 1,
        "title": "delectus aut autem",
        "completed": false
    },
    "metadata": {
        "statusCode": 204
    }
}
Back to top