24/7 Support: 800.608.6482

Navigation


Multiple Function Calls in a Single API Request

Overview

The Miva JSON API supports both single function requests as well as multiple function requests in a single call. This gives you the flexibility combine multiple requests into a single API call reducing the number of overall calls needed.

Examples

Single Request & Response

Multiple iterations of the same function

This allows you to call the same function multiple times in a single call. An example of this would be updating inventory for multiple products all within a single call.

Multiple separate function calls


Combinations are possible too:

HTTP_X_MIVA_API_TIMEOUT Header

The default timeout for a single Miva request is 60 seconds. The API supports passing in a custom header that allows you to increase this timeout for your single request. This can be useful if you are sending up bulk product/inventory updates using the multi-call format.

Example: 'X-Miva-API-Timeout': 100 would change the timeout to 100 seconds for that specific request

Note: It is much better performance wise to split the number of functions you wish to execute into manageable chuncks vs sending a single request with thousands or tens of thousnads of function to run. You don't want a single Miva process running for several minutes.

Content-Range Response Header

This header is only returned when there are multiple operations sent in a single request, ie the multi-call format is being used. If a request is submitted with multiple operations, between each operation Miva will check to see whether a timeout has occured and if one has, Miva will set the 'Content-Range' header with how many operations we were able to complete and set the Status of the http response to 206.

Example: 'Content-Range':'3/5', 'Status': 206

If your request gets a response of 206, you have the option of resubmitting the exact same request again but this time with your own request header for "Range" with the Operations you wish to run that did not get run previously because it hit a timeout.

Example: 'Range': 'Operations=4-5'

This would tell Miva to ignore the first 3 functions in the multi-call and only process the 4th and 5th functions.

This website uses cookies to identify visitors, track visitors to our website, store login session information and to remember your user preferences. By continuing to use this site you agree to our use of cookies. Learn More.

This website uses cookies. By continuing to use this site you agree to our use of cookies. Learn More.

Accept

Copyright © 1997 – 2022 Miva©, Miva Merchant©, MivaPay©, MivaCon©, Camp Miva ℠, Miva, Inc. All Rights Reserved.