Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set Referrer #16

Open
Edofre opened this issue Jul 31, 2018 · 3 comments
Open

Cannot set Referrer #16

Edofre opened this issue Jul 31, 2018 · 3 comments
Assignees

Comments

@Edofre
Copy link

Edofre commented Jul 31, 2018

Hello, I seem to be unable to set a referrer.

The X-OpenAPI-Session-ID is set in the header request and I've also managed to get the referrer id (ADVNLxxx) from the request I make to the partnerprogramma.bol.com URL.

I've noticed that I can get the referrer ID from two URLs

Once I make the setReferrer() request from the client I get the following response:

object(stdClass)[1647]
  public 'code' => string 'CannotSetReferrer' (length=17)
  public 'message' => string 'Unable to set referrer' (length=22)

I'd like advice on what to try next.

@msomhorst
Copy link

@Edofre how did you make the request? Can you maybe share that portion of the code?

@msomhorst msomhorst self-assigned this Aug 7, 2018
@Edofre
Copy link
Author

Edofre commented Aug 7, 2018

Below you will find the code, env('BOL_API_KEY') & env('BOL_PARTNER_SITE_ID') are correct and use the correct values.

$apiClient = new \BolCom\Client(env('BOL_API_KEY'), 'json', true);

// Get and set session
$session = $apiClient->getSessionId();
$apiClient->setSessionId($session->sessionId);

// Get and set referrer
$referrerFromUrl = $this->getReferrerFromPartnerUrl();

// Here is where I can the CannotSetReferrer response
$response = $apiClient->setReferrer($referrerFromUrl);

function getReffererFromPartnerUrl() {
  $siteid = urlencode(env('BOL_PARTNER_SITE_ID'));
  $externalUrl = urlencode($this->external_url);
  $naam = $this->wishlistItem->item;

  //        $url = "http://partnerprogramma.bol.com/click/click?p=1&t=url&s={$siteid}&url={$externalUrl}&f=API";
  $url = 'http://partner.bol.com/click/click?p=1&t=url&s=' . urlencode(env('BOL_PARTNER_SITE_ID')) . '&f=API&url=' . urlencode($this->external_url);

  $headerResponse = get_headers($url);

  $location = explode(" ", $headerResponse[6]);

  $referrer = $location[1];

  return $referrer;
}

@pvankouteren
Copy link
Contributor

Did you view the comment on the docs page?

"Adds or updates the referrer of the current session. Note: Usage of this call is limited and only on request by email to d...@b...com."

So I'm not sure if the availability of the call should be enabled by the developer center of Bol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants