Home » Connect to a Selligent API endpoint in R

Connect to a Selligent API endpoint in R

  • by
  • 2 min read

Selligent is an ecosystem of marketing tools, mostly known for it’s marketing automation platform formerly known as Campaign. I was never a big fan of Selligent because it used to be a very closed ecosystem. However, it made available a wide range of APIs recently, allowing you to query its data.

Security-wise, you need two things:

  • An API key and secret
  • Permissions to query a specific endpoint

You should be able to acquire both from an administrator within your organization.

Next, querying the endpoints. There is an API explorer which you can find over here:

https://<YOUR_SUBDOMAIN>.slgnt.eu/Portal/Api/swagger/ui/index

However, we’re interested in querying the data from R, aren’t we? Here’s a straightforward way to connect to the different Selligent endpoints. For example, in the following query, I’m requesting information regarding a specific organization within our Selligent Marketing Cloud.

library(httr)
sel_key = "<YOUR_API_KEY>"
sel_secret = "<YOUR_API_SECRET>"

GET('https://<YOUR_SUBDOMAIN>.slgnt.eu/Portal/Api/organizations/<ORG>', 
    add_headers(.headers = c(`X-ApiKey` = paste0(sel_key,':',sel_secret))))

If you receive an error 401, it can mean at least two things:

  • Your key and secret are not correct
  • The endpoint has not been made available to you

If you receive an error 500, you are trying to connect to an endpoint that doesn’t exist. If you receive an error 404, you’ve entered an organization that doesn’t exist within the subdomain.

To find you organization, click the dropdown to the left of your profile picture and name. This should list all the organizations that you have access to. By the way, if your organization contains spaces, that’s not a problem: you can add spaces in the GET request.

Say thanks, ask questions or give feedback

Technologies get updated, syntax changes and honestly… I make mistakes too. If something is incorrect, incomplete or doesn’t work, let me know in the comments below and help thousands of visitors.

Leave a Reply

Your email address will not be published. Required fields are marked *