What Is Api Mapping?

I want to get our inventory and order details from Overstock.com SOFS API to our PHP and MySQL web based application. But their integration analyst always asks me have you completed mapping?

I do not have much experience in API integration what i have done so far in API is I have access credentials of Amazon MWS API and can easily make requests and response from their system to our PHP application.

But here for Overstock.com I am confused what exactly API mapping is?

Someone please give me little hint to proceed.

2

2 Answers

Just for an example of a simple mapping scheme,

As I said this is what I think of when I hear mapping, they may mean something different.

$data = [
    'fname' => 'John', 
    'lname' => 'Doe',
];

$map = [
    'lname' => 'last',
    'fname' => 'first'
];

//create a blank array in the order of your mapping
$blank = array_fill_keys(array_keys($map), '');

//order their array to match the blank array, which matches the mapping
$ordered = array_replace($blank, $data);

//merge your keys with the array ordered to match the mapping order
$output = array_combine($map, $ordered);

Outputs:

Array
(
    [last] => Doe
    [first] => John
)

You can see it online here

Notice also I intentionally changed the order of the array, to show that order doesn't matter. This also has the benifit of filling in any missing data. So an example of that would be this ( with the same code above ):

$data = [
    'fname' => 'John', 
    'lname' => 'Doe',
    //middle name data is missing
];

$map = [
    'lname' => 'last',
    'fname' => 'first',
    'mname' => 'middle'
];

Outputs ( quotes to show empty string):

Array
(
    [last] => Doe
    [first] => John
    [middle] => ''
)

It's a very simple, strait forward method that is easy to add new fields to later. So I just wanted to share that with you it that is indeed what they mean.

The only thing I would add, is don't be afraid to ask what they mean by mapping. Some terminological is somewhat different from place to place. What's the worst they could say, that you are a moron (sarcasm, I don't mean to say you are only that they wont likely say that) ... lol ... no they will probably just say you need to map their fields to your web applications fields. It's generally in their interest to get you using their API, or what would be the point of having one. So they are inclined to help you as a consumer of their service.

In the case of the Oasis Integration team, Mapping is the testing that they require you go through where they provide some test XML files with sample orders and you are required to map these to your data and then post an Order Acknowledgement.

I know this is not a common use of "mapping" but they mean, you have mapped Overstock fields to your data fields successfully and have completed the test API calls they require for Production API access.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.

Share this article
Twitter Facebook Pinterest