In this post, I will try to guide your first steps using the Partner API of SAP Precision Marketing.

This is targeted to SPM evaluation users and I assume you have already gone through this: Getting started with the SPM evaluation

The Partner API is the programatic interface to manage your retailer instance, you can create stores and offers and all other artefacts via this API.

The Partner Portal Interface allows you to use a friendly interface for many actions (create stores, create campaigns and offers) however you should consider using Partner API if you need to integrate with other systems, or if you have too many stores or offers that becomes unmanageable manually via the interface.

The API is a RESTFUL interface and as per SPM v2.5 there are no SDKs (unlike the Device API).

For this tutorial I recommend you use the Partner API with the developer-ID/secret authentication method, that is simpler for the developer as it requires less steps to make the call, you may consider later using the developer-ID/certificate authentication method depending on your security requirements (see the product documentation for more).

The full documentation of the partner API is available here: https://help.sap.com/spm  select the Partner Services API Documentation

Now let’s get started,

Create a developer-Id and a secret

If you already have a Developer ID and secret then you may skip this section.

❗ Note that the Device API and the Partner API have different developer_ids, if you are unsure keep reading.


Log in the Partner Portal using the retailer Admin

go to the API credential tab.

click create Partner API Key and select the developer secret option.

enter a secret password/phrase and save, the system will generate a partner API key for you to use in conjunction with the secret.


Keep the developer-ID and secret safely, you will use them for all your subsequent calls to the Partner API



Get the Google Chrome REST Advanced client


In this tutorial we will use the Google REST Advanced client to make the REST calls, it will be up to you to then make these calls from whatever development languages that Support REST.

install the REST Advanced client from the Chrome Web Store



Generate a TransactionID


All calls to the Partner API must include a TransactionID, this transactionID is valid for only 1 call and expires after a few minutes.

therefore you will need to generate a new key each time.

To Generate a transactionID you need to make a GET call to https://sprpartnerapisstaging.hana.ondemand.com/partnerapi/v1/rest/transactionid/<developerid>


Start the Chrome REST Advanced client fill the fields as shown here

Screen Shot 2014-04-03 at 3.28.48 PM.png

press the send button you will get the transactionID as part of the response:


Screen Shot 2014-04-03 at 3.32.23 PM.png

Make your first request


Now we’re going to request Company information using the TransactionID that we got.

Let’s use the GET company call


the url looks like this (using the transactionID that you generated in the previous section)

https://sprpartnerapisstaging.hana.ondemand.com/partnerapi/v1/rest/company/?_transactionid=928292b4-0b2c-4861-88ce-b5309…


and you will need to add your developerID and secret in the header of the call as shown below:

Screen Shot 2014-04-03 at 3.56.24 PM.png

Hit the send button and you will see some information about your tenant in the response.


Screen Shot 2014-04-03 at 5.37.56 PM.png


if you do, then congrats, you just succeeded with your first call !!

The other calls are constructed in a similar way, let’s proceed.



Create your first stores


I’ll now guide you to create your first stores via the API.

the main advantage over the User Interface is to create the stores in a batch call from a csv file.

I attached a sample csv file to this page for reference, avoid using Excel to edit it as it inserts unwanted metadata, prefer something neutral such as notepad or equivalent.


Check the documentation for a full description of all the fields at https://help.sap.com/spm  select the Partner Services API Documentation (Section: Create stores)



Generate a new transactionID as shown previously and use it in the URL

enter the  your developerID and secret in the header of the call

attach the csv file as Payload 

choose multipart/form-data

Method: POST


your screen would look like this.


Screen Shot 2014-04-03 at 4.11.05 PM.png

press the send button, you should get an OK back.



Get all stores


Now let’s check that the stores were actually created successful let’s make a GET stores call now.


We will use the same URL for stores (with a new transactionID), and select the GET method.

put the credentials in the header as before.


it should look like:


Screen Shot 2014-04-03 at 4.28.06 PM.png


hit the send button and you should get the response as shown below:

Screen Shot 2014-04-03 at 4.51.29 PM.png



Want to do more?


Well, you now have the basics… the other calls are constructed in the same way, you will fine a list of all the REST calls in the Partner API doc available here: https://help.sap.com/spm  select the Partner Services API Documentation



Give it a try and share your feedback.

enjoy!




To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply