Download the PHP package pdeans/miva-rest-api without Composer

On this page you can find all versions of the php package pdeans/miva-rest-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package miva-rest-api

This package is abandoned and no longer maintained.

Miva JSON API REST Wrapper

PHP library providing a RESTful interface for interacting with the Miva JSON API.

Table Of Contents

Installation

Install via Composer.

Getting Started

Web Server Setup

The web server setup assumes a standard Miva Merchant installation on the server. Issuing the composer command above will download the library files into a directory named RestApi. This directory should then be uploaded to the web server's root directory via FTP. Alternatively, the composer command may be issued directly to the web server's root directory if installing via SSH.

NOTE: The project files should NEVER be placed in a public facing directory on the web server as this can expose API credentials. Typically, this is the /httpdocs directory.

Next, within the /RestApi directory root, locate the /httpdocs directory and copy or move the /api directory and all of its contents to the root of the web server's public directory. Again, the public directory is generally /httpdocs for standard Miva Merchant installations.

The directory and file structure should resemble the following from the web server root:

Essentially, the require statement in the /httpdocs/api/index.php file should link to the project's /bootstrap/app.php path.

Configuration

All of the configuration options for the project are stored in the .env file on the project root.

Here is a breakdown of the settings relevant to the Miva Merchant JSON API:

Key Required Description
MM_STORE_CODE Yes The store code.
MM_API_URL Yes The Api endpoint URL.
MM_API_TOKEN Yes The Api access token.
MM_API_KEY Yes The Api private key.
MM_API_HTTP_HEADERS No Http headers to issue on each API request. The header name and value are separated by a colon ":". Multiple headers can be issued via comma separated list.

Example value:
MM_API_HTTP_CLIENT_OPTS No Curl options to set on the underlying http client. The curl option name and value are separated by a colon ":". Multiple options can be issued via comma separated list.

Example value:

IP Whitelisting

The web server's IP address will need to be added to the Allowed IP Address(es) list under the API Tokens configuration in the Miva Merchant admin.

Issuing Requests

The REST interface allows for making client and server sided requests to interact with Miva JSON API functions.

Request Authentication

API request authentication is handled behind the scenes based on the credentials provided to the configuration settings in the project root's .env file. Each request to a REST API endpoint will automatically issue the X-Miva-API-Authorization and Content-Type headers, as well as the Miva_Request_Timestamp and Store_Code request body parameters. For this reason, these should be omitted in the requests issued to the REST API endpoints.

Function Permissions

Each REST API endpoint maps to a specific JSON API function that must be assigned to the provided API Token in the Miva Merchant admin to enable the REST API endpoint. The API Endpoints definitions specifies the function to enable for each endpoint.

PUT And DELETE Requests

PUT and DELETE http methods that target a single resource can omit the "identifier" parameter in the JSON body provided to the endpoint. These parameters are listed in the respective section of the API Endpoints definitions.

Filtering

Filtering for list load and single load resource endpoints can be achieved through the query parameters listed below. See the API Endpoints definitions to see which filter options are supported for each individual endpoint. The filter query parameters may be combined as needed to generate the desired results.

Count

The count query parameter may be issued to limit the number of records returned for list load endpoints.

Example: ?count=15

Offset

The offset query parameter may be issued to offset the first record returned for list load endpoints. The offset value is 0 based.

Example: ?offset=5

On Demand Columns

The odc query parameter may be issued to specify the on demand columns to be included for list load and single resource load endpoints that support the filter. Multiple columns should be provided via comma separated list.

Example: ?odc=categories,CustomField_Values:*

Search

The search query parameter may be issued on list load endpoints to filter by the provided search terms. The following is the basic pattern used for issuing searches:

The search value may be provided as a comma separated list for operators that support a list of values (ex: IN).

Additionally, the value segment of the search parameter should be omitted for operators that do not require a value. Currently, these operators include:

Simple Searches

The following is an example search query string to filter results by the "code" field equal to a value of "prod1":

?search[0][values][0][field]=code&search[0][values][0][operator]=EQ&search[0][values][0][value]=prod1

AND Searches

A logical AND search can be performed by providing multiple indexes for the search[<index>] portion of the query string. The pattern should resemble the following:

If we were to provide an additional AND search condition, we would issue a new search index of 2 in this example, search[2]. This pattern should be followed for each addtional AND condition.

The following is an example AND search query string that filters the results by category assignment and price criteria:

?search[0][values][0][field]=Category&search[0][values][0][operator]=IN&search[0][values][0][value]=13707,13708&search[1][values][0][field]=price&search[1][values][0][operator]=GT&search[1][values][0][value]=19.86

OR Searches

A logical OR search can be performed by providing multiple indexes for the values[<index>] portion of the query string. The pattern should resemble the following:

If we were to provide an additional OR search condition, we would issue a new values index of 2 in this example, values[2]. This pattern should be followed for each addtional OR condition.

The following is an example OR search query string that filters the results by records that match either value for the last name of a customer shipping address:

?search[0][values][0][field]=ship_lname&search[0][values][0][operator]=EQ&search[0][values][0][value]=Griffin&search[0][values][1][field]=ship_lname&search[0][values][1][operator]=EQ&search[0][values][1][value]=Star

PARENTHETICAL Comparisons

A parenthetical comparison can be performed by providing multidimensional indexes for the values[<index>] portion of the query string. The pattern should roughly resemble the following:

The parenthetical portion of the search clause is first initiated by setting the value to [] on the values index:

Next, a new index dimension is provided to the values indices with the subsequent search criteria to build the desired comparison:

Take following search query for example:

This will generate the following search filter for the API request:

Show

The show query parameter may be issued to filter list load results according to the provided value.

Example: ?show=Active

Sort

The sort query parameter may be issued to sort results by the provided column name. To sort the results in descending order, prepend the parameter value with the "-" character.

Example: ?sort=-code

Assigned / Unassigned

The assigned and unassigned query parameters may be issued to filter list load results according to their provided value.

API Endpoints

The following section defines the endpoints available for the REST API. The endpoints are based off of the public path set for the REST API's public directory files. Follwing the Web Server Setup, the base uri would be set to /api. The full url path would then be set as follows:

Availability Group Endpoints

Load Availability Groups List

Enable Function: AvailabilityGroupList_Load_Query

HTTP Method Endpoint Filters
GET /availabilitygroups count
offset
search
sort

Load Availability Group

Enable Function: AvailabilityGroupList_Load_Query

HTTP Method Endpoint Path Identifier
GET /availabilitygroups/{id} {id} = Availability Group Id

Update Availability Group Business Account Assignment

Enable Function: AvailabilityGroupBusinessAccount_Update_Assigned

HTTP Method Endpoint Path Identifier Omit Request Parameter
PUT /availabilitygroups/{id}/businessaccounts {id} = Availability Group Id AvailabilityGroup_ID

Example Request Body


Update Availability Group Customer Account Assignment

Enable Function: AvailabilityGroupCustomer_Update_Assigned

HTTP Method Endpoint Path Identifier Omit Request Parameter
PUT /availabilitygroups/{id}/customers {id} = Availability Group Id AvailabilityGroup_ID

Example Request Body


Update Availability Group Payment Method Assignment

Enable Function: AvailabilityGroupPaymentMethod_Update_Assigned

HTTP Method Endpoint Path Identifier Omit Request Parameter
PUT /availabilitygroups/{id}/paymentmethods {id} = Availability Group Id AvailabilityGroup_ID

Example Request Body


Update Availability Group Product Assignment

Enable Function: AvailabilityGroupProduct_Update_Assigned

HTTP Method Endpoint Path Identifier Omit Request Parameter
PUT /availabilitygroups/{id}/products {id} = Availability Group Id AvailabilityGroup_ID

Example Request Body


Update Availability Group Shipping Method Assignment

Enable Function: AvailabilityGroupShippingMethod_Update_Assigned

HTTP Method Endpoint Path Identifier Omit Request Parameter
PUT /availabilitygroups/{id}/shippingmethods {id} = Availability Group Id AvailabilityGroup_ID

Example Request Body


Category Endpoints

Load Categories List

Enable Function: CategoryList_Load_Query

HTTP Method Endpoint Filters
GET /categories count
odc
offset
search
show
sort

Load Category

Enable Function: CategoryList_Load_Query

HTTP Method Endpoint Path Identifier Filter
GET /categories/{id} {id} = Category Id odc

Create Category

Enable Function: Category_Insert

HTTP Method Endpoint
POST /categories

Example Request Body


Update Category

Enable Function: Category_Update

HTTP Method Endpoint Path Identifier Omit Request Parameter
PUT /categories/{id} {id} = Category Id Category_ID

Example Request Body


Delete Category

Enable Function: Category_Delete

HTTP Method Endpoint Path Identifier
DELETE /categories/{id} {id} = Category Id

Load Category Products List

Enable Function: CategoryProductList_Load_Query

HTTP Method Endpoint Path Identifier Filters
GET /categories/{id}/products {id} = Category Id count
odc
offset
search
show
sort
assigned
unassigned

Update Category Product Assignment

Enable Function: CategoryProduct_Update_Assigned

HTTP Method Endpoint Path Identifier Omit Request Parameter
PUT /categories/{id}/products {id} = Category Id Category_ID

Example Request Body


Load Category Subcategories List

Enable Function: CategoryList_Load_Parent

HTTP Method Endpoint Path Identifier
GET /categories/{id}/subcategories {id} = Category Id

Coupon Endpoints

Load Coupons List

Enable Function: CouponList_Load_Query

HTTP Method Endpoint Filters
GET /coupons count
offset
search
sort

Load Coupon

Enable Function: CouponList_Load_Query

HTTP Method Endpoint Path Identifier
GET /coupons/{id} {id} = Coupon Id

Create Coupon

Enable Function: Coupon_Insert

HTTP Method Endpoint
POST /coupons

Example Request Body


Update Coupon

Enable Function: Coupon_Update

HTTP Method Endpoint Path Identifier Omit Request Parameter
PUT /coupons/{id} {id} = Coupon Id Coupon_ID

Example Request Body


Delete Coupons

Enable Function: CouponList_Delete

HTTP Method Endpoint
DELETE /coupons

Example Request Body


Load Coupon Price Group List

Enable Function: CouponPriceGroupList_Load_Query

HTTP Method Endpoint Path Identifier
GET /coupons/{id}/pricegroups {id} = Coupon Id

Update Coupon Price Group Assignment

Enable Function: CouponPriceGroup_Update_Assigned

HTTP Method Endpoint Path Identifier Omit Request Parameter
PUT /coupons/{id}/pricegroups {id} = Coupon Id Coupon_Id

Example Request Body


Customer Endpoints

Load Customers List

Enable Function: CustomerList_Load_Query

HTTP Method Endpoint Filters
GET /customers count
offset
search
sort

Load Customer

Enable Function: CustomerList_Load_Query

HTTP Method Endpoint Path Identifier
GET /customers/{id} {id} = Customer Id

Create Customer

Enable Function: Customer_Insert

HTTP Method Endpoint
POST /customers

Example Request Body


Update Customer

Enable Function: Customer_Update

HTTP Method Endpoint Path Identifier Omit Request Parameter
PUT /customers/{id} {id} = Customer Id Customer_ID

Example Request Body


Delete Customer

Enable Function: Customer_Delete

HTTP Method Endpoint Path Identifier
DELETE /customers/{id} {id} = Customer Id

Load Customer Addresses List

Enable Function: CustomerAddressList_Load_Query

HTTP Method Endpoint Filters
GET /customers/{id}/addresses count
offset
search
sort

Load Customer Price Groups List

Enable Function: CustomerPriceGroupList_Load_Query

HTTP Method Endpoint Filters
GET /customers/{id}/pricegroups count
offset
search
sort
assigned
unassigned

Note Endpoints

Load Notes List

Enable Function: NoteList_Load_Query

HTTP Method Endpoint Filters
GET /notes count
offset
search
sort

Load Note

Enable Function: NoteList_Load_Query

HTTP Method Endpoint Path Identifier
GET /notes/{id} {id} = Note Id

Create Note

Enable Function: Note_Insert

HTTP Method Endpoint
POST /notes

Example Request Body


Update Note

Enable Function: Note_Update

HTTP Method Endpoint Path Identifier Omit Request Parameter
PUT /notes/{id} {id} = Note Id Note_ID

Example Request Body

Delete Note

Enable Function: Note_Delete

HTTP Method Endpoint Path Identifier
DELETE /notes/{id} {id} = Note Id

Order Endpoints

Load Orders List

Enable Function: OrderList_Load_Query

HTTP Method Endpoint Filters
GET /orders count
odc
offset
search
sort

Load Order

Enable Function: OrderList_Load_Query

HTTP Method Endpoint Path Identifier Filter
GET /orders/{id} {id} = Order Id odc

Create Order

Enable Function: Order_Create

HTTP Method Endpoint
POST /orders

Example Request Body


Delete Order

Enable Function: Order_Delete

HTTP Method Endpoint Path Identifier
DELETE /orders/{id} {id} = Order Id

Update Order Customer Information

Enable Function: Order_Update_Customer_Information

HTTP Method Endpoint Path Identifier Omit Request Parameter
PUT /orders/{id}/customers {id} = Order Id Order_ID

Example Request Body


Create Order Item

Enable Function: OrderItem_Add

HTTP Method Endpoint Path Identifier
POST /orders/{id}/items {id} = Order Id

Example Request Body


Update Order Item

Enable Function: OrderItem_Update

HTTP Method Endpoint Path Identifiers Omit Request Parameters
PUT /orders/{id}/items/{line_id} {id} = Order Id
{line_id} = Line Item Id
Order_ID
Line_ID

Example Request Body


Cancel Order Items

Enable Function: OrderItemList_Cancel

HTTP Method Endpoint Path Identifier Omit Request Parameter
PUT /orders/{id}/items/cancel {id} = Order Id Order_ID

Example Request Body


Delete Order Items

Enable Function: OrderItemList_Delete

HTTP Method Endpoint Path Identifier Omit Request Parameter
PUT /orders/{id}/items/delete {id} = Order Id Order_ID

Example Request Body


Backorder Order Items

Enable Function: OrderItemList_Backorder

HTTP Method Endpoint Path Identifier Omit Request Parameter
PUT /orders/{id}/items/backorder {id} = Order Id Order_ID

Example Request Body


Load Orders Custom Fields List

Enable Function: OrderCustomFieldList_Load

HTTP Method Endpoint
GET /orders/customfields

Update Order Custom Field Values

Enable Function: OrderCustomFields_Update

HTTP Method Endpoint Path Identifier Omit Request Parameter
PUT /orders/{id}/customfields {id} = Order Id Order_ID

Example Request Body


Order Queue Endpoints

Load Order Queue List

Enable Function: QueueOrderList_Load_Query

HTTP Method Endpoint Path Identifier Filters
GET /orderqueues/{code} {code} = Queue Code count
odc
offset
search
sort

Create Order Queue Acknowledgement

Enable Function: OrderList_Acknowledge

HTTP Method Endpoint
POST /orderqueues

Example Request Body


Payment Endpoints

Capture Order Payment

Enable Function: OrderPayment_Capture

HTTP Method Endpoint Path Identifier Omit Request Parameter
PUT /payments/{id}/capture {id} = Order Payment Id OrderPayment_ID

Example Request Body


Refund Order Payment

Enable Function: OrderPayment_Refund

HTTP Method Endpoint Path Identifier Omit Request Parameter
PUT /payments/{id}/refund {id} = Order Payment Id OrderPayment_ID

Example Request Body


Void Order Payment

Enable Function: OrderPayment_VOID

HTTP Method Endpoint Path Identifier Omit Request Parameter
PUT /payments/{id}/void {id} = Order Payment Id OrderPayment_ID

Example Request Body


Price Group Endpoints

Load Price Groups List

Enable Function: PriceGroupList_Load_Query

HTTP Method Endpoint Filters
GET /pricegroups count
offset
search
sort

Load Price Group

Enable Function: PriceGroupList_Load_Query

HTTP Method Endpoint Path Identifier Filters
GET /pricegroups/{id} {id} = Price Group Id count
odc
offset
search
show
sort
assigned
unassigned

Load Price Group Products List

Enable Function: PriceGroupProductList_Load_Query

HTTP Method Endpoint Path Identifier
GET /pricegroups/{id}/products {id} = Price Group Id

Update Price Group Product Assignment

Enable Function: PriceGroupProduct_Update_Assigned

HTTP Method Endpoint Path Identifier Omit Request Parameter
PUT /pricegroups/{id}/products {id} = Price Group Id PriceGroup_ID

Example Request Body


Update Price Group Customer Assignment

Enable Function: PriceGroupCustomer_Update_Assigned

HTTP Method Endpoint Path Identifier Omit Request Parameter
PUT /pricegroups/{id}/customers {id} = Price Group Id PriceGroup_ID

Example Request Body


Product Endpoints

Load Products List

Enable Function: ProductList_Load_Query

HTTP Method Endpoint Filters
GET /products count
odc
offset
search
show
sort

Load Product

GET /products/{id}

Enable Function: ProductList_Load_Query

HTTP Method Endpoint Path Identifier Filter
GET /products/{id} {id} = Product Id odc

Create Product

POST /products

Enable Function: Product_Insert

HTTP Method Endpoint
POST /products

Example Request Body

{
    "Product_Code": "new-product",
    "Product_SKU": "555182",
    "Product_Name": "New Product",
    "Product_Description": "New descripion",
    "Product_Page_Title": "New Product",
    "Product_Price": 5.29,
    "Product_Cost": 1.27,
    "Product_Weight": 3.58,
    "Product_Inventory": 26,
    "Product_Taxable": true,
    "Product_Active": true,
    "CustomField_Values": {
        "customfields": {
            "marco": "polo"
        }
    }
}

Update Product

PUT /products/{id}

Enable Function: Product_Update

HTTP Method Endpoint Path Identifier Omit Request Parameter
PUT /products/{id} {id} = Product Id Product_ID

Example Request Body

{
    "Product_Code": "new-new-product",
    "Product_Name": "New New Product",
    "Product_Description": "New new descripion",
    "Product_Page_Title": "New New Product",
    "Product_Price": 5.55
}

Delete Product

DELETE /products/{id}

Enable Function: Product_Delete

HTTP Method Endpoint Path Identifier
DELETE /products/{id} {id} = Product Id

Adjust Product List Inventory

POST /products/inventory

Enable Function: ProductList_Adjust_Inventory

HTTP Method Endpoint
POST /products/inventory

Example Request Body

{
    "Inventory_Adjustments": [
        {
            "product_code": "new-new-product",
            "adjustment": 9
        },
        {
            "product_code": "psteezy-deluxe",
            "adjustment": 50
        },
        {
            "product_code": "blk-shirt",
            "adjustment": -100
        }
    ]
}

Create Product Image

POST /products/{id}/images

Enable Function: ProductImage_Add

HTTP Method Endpoint Path Identifier Omit Request Parameter
POST /products/{id}/images {id} = Product Id Product_ID

Example Request Body

{
    "Filepath": "graphics/00000001/B1009.001.png",
    "ImageType_ID": 0
}

Delete Product Image

DELETE /products/images/{id}

Enable Function: ProductImage_Delete

HTTP Method Endpoint Path Identifier
DELETE /products/images/{id} {id} = Product Image Id

Load Product Variants List

GET /products/{id}/variants

Enable Function: ProductVariantList_Load_Product

HTTP Method Endpoint Path Identifier
GET /products/{id}/variants {id} = Product Id

Provisioning Endpoints

Domain Level Provisioning

POST /provisioning/domain

Enable Function: Provision_Domain

HTTP Method Endpoint
POST /provisioning/domain

Example Request Body

{
   "xml": "<User_Add><Name>miva_merchant<\/Name><Password>password<\/Password><Administrator>Yes<\/Administrator><\/User_Add>"
}

Store Level Provisioning

POST /provisioning/store

Enable Function: Provision_Store

HTTP Method Endpoint
POST /provisioning/store

Example Request Body

{
   "xml": "<Product_CustomField module=\"baskinv\" field=\"total_inv\" product=\"test\">500</Product_CustomField>"
}

Shipment Endpoints

Create Order Shipment

POST /shipments

Enable Function: OrderItemList_CreateShipment

HTTP Method Endpoint
POST /shipments

Example Request Body

{
    "Order_Id": 97209,
    "line_ids": [9513, 9514]
}

Update Order Shipments

PUT /shipments

Enable Function: OrderShipmentList_Update

HTTP Method Endpoint
PUT /shipments

Example Request Body

{
    "Shipment_Updates": [
        {
            "shpmnt_id": 287,
            "mark_shipped": true,
            "tracknum": "12345",
            "tracktype": "UPS",
            "cost": "5.00"
        }
    ]
}


All versions of miva-rest-api with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.3
laravel/lumen-framework Version 5.7.*
pdeans/miva-api Version ^1.0
vlucas/phpdotenv Version ~2.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package pdeans/miva-rest-api contains the following files

Loading the files please wait ....