API User Creation

mVentory API users can be added to Magento in either one of the two following ways.

Automated user creation

A new API user can be created automatically by pressing mVentory Access button button on Customer Details page. Configuration of the Android application can be performed automatically by opening the displayed URL on your smartphone.

Manual user creation

  1. Create a customer for the intended store or Admin scope to access all stores.
  2. Fill in address information if the customer is allowed to make sales.
  3. Save and note the customer ID from the URL (e.g. http://mystore.com/index.php/admin/customer/edit/id/39/).
  4. Create a new SOAP/XML-RPC user from System -> Web Services -> SOAP/XML-RPC-Users menu. Use the following settings:
    User name – use the customer ID (the user name is always numeric)
    First name, Last name, Email – unimportant (can use any values)
    API key – this will act as the password (can be the same as the customer password or different)
  5. Select the mVentory role in the User Role tab.
  6. Save.

Now the user name (customer ID), API key and store URL can be used to configure the Android app manually, by creating a new profile with these settings.

Generating a configuration URL

Whether the API user was created automatically or manually, a configuration URL is a convenient way of automatically configuring the mVentory Android application with API user credentials.

To generate a new configuration URL, open the desired API user by navigating to System -> Web Services -> SOAP/XML-RPC-Users in Magento, open the desired user and press mVentory Access button button. A new unique URL will be displayed on the screen. This can be copied and e-mailed to the user to perform profile configuration.

For security reasons the generated URLs are valid for a set period of time only. See Lifetime of the link to the app profile (minutes) in System -> Configuration / mVentory / Phone API tab. The default value is 1440 seconds (24 hours).

Important Notes:

  • The link can only be used once. It will return a 404 error on subsequent calls. Save the user again to generate a new link.
  • When the .txt URL is requested the site auto-generates a new API key. Whatever key was saved previously, simply gets replaced by the new key.
  • There is no way to use a user-supplied API key and use the link for configuration – a new key will always be generated when the link is used.
  • Saving an XML-RPC user generates a new link, but the API key is unaffected until the link is actually used.

How configuration URL works

The generated URL will be of the form http://mystore.com/mventory-key/uvss7S%2F41txIEaMG. When this URL is opened in the browser on the mobile device, it will redirect to mventory://mystore.com/mventory-key/uvss7S%2F41txIEaMG, which is necessary for Android OS to pass it to mVentory application for handling.

The application will replace mventory scheme with http and appends .txt, so the resulting URL is http://mystore.com/mventory-key/uvss7S%2F41txIEaMG.txt. The server returns a plain text response containing lines of text in the following order:

customer id
API key
store URL

For example:

19
RandomAPIKeyGeneratedByExtension123
mystore.com/index.php

See also: API Access Control, Android App Profile Configuration.

Read more about: