Create Affiliate Session
Create a session for an affiliate
Authentication Required
Requires CAN_CREATE_AFFILIATE_SESSIONS
permissions.
-
Arguments
-
Returns
| mutation createAffiliateSession($input: CreateAffiliateSessionInputType!) {
createAffiliateSession(input: $input){
affiliateSession {
link {
subdomain
contactName
contactEmail
organisation {
name
salesChannel
}
}
ipAddress
userAgent
queryParams
}
}
}
|
| # Input variables
{
"input": {
"linkId": ,
"ipAddress": "",
"userAgent": "",
"queryParams": {
"additionalQueryParams": {"additionalParams": ""},
"event": "",
"eventCreated": "",
"eventInformation": {"someInformation": ""},
"route": "",
"sessionId": "",
"successfulConversion": ,
},
"quoteShareId": ,
}
}
|
Example
| mutation createAffiliateSession($input: CreateAffiliateSessionInputType!) {
createAffiliateSession(input: $input){
affiliateSession {
link {
subdomain
contactName
contactEmail
organisation {
name
salesChannel
}
}
ipAddress
userAgent
queryParams
}
}
}
|
| # Input variables
{
"input": {
"linkId": 12,
"ipAddress": "1.1.1.1",
"userAgent": "Mozilla/5.0",
"queryParams": {
"additionalQueryParams": {"additionalParams": "MMMMMM"},
"event": "VIEWED_AFFILIATE",
"eventCreated": "2022-06-15T18:33:57.317Z",
"eventInformation": {"someInformation": "NNNNNN"},
"route": "/join/buy-now",
"sessionId": "ALPHA_NUM",
"successfulConversion": True,
},
"quoteShareId": 34,
}
}
|
| import pprint
import requests
# API_URL = "https://api.oeus-kraken.energy/v1/graphql/" # prod
API_URL = "https://api.oeus-kraken.systems/v1/graphql/" # test
JWT_TOKEN = "PLACE_JWT_TOKEN_HERE"
HEADERS = {
"Authorization": f"JWT {JWT_TOKEN}"
}
MUTATION = """
mutation createAffiliateSession($input: CreateAffiliateSessionInputType!) {
createAffiliateSession(input: $input){
affiliateSession {
link {
subdomain
contactName
contactEmail
organisation {
name
salesChannel
}
}
ipAddress
userAgent
queryParams
}
}
}
"""
VARIABLES = {
"input": {
"linkId": 12,
"ipAddress": "1.1.1.1",
"userAgent": "Mozilla/5.0",
"queryParams": {
"additionalQueryParams": {"additionalParams": "MMMMMM"},
"event": "VIEWED_AFFILIATE",
"eventCreated": "2022-06-15T18:33:57.317Z",
"eventInformation": {"someInformation": "NNNNNN"},
"route": "/join/buy-now",
"sessionId": "ALPHA_NUM",
"successfulConversion": True,
},
"quoteShareId": 34,
}
}
session = requests.Session()
session.headers.update(HEADERS)
response = session.post(
url=API_URL,
json={"query": QUERY, "variables": VARIABLES}
)
pprint.pprint(response.json())
|
const axios = require("axios")
// const apiUrl = "https://api.oeus-kraken.energy/v1/graphql/" // Prod
const apiUrl = "https://api.oeus-kraken.systems/v1/graphql/" // Test
const jwtToken = "PLACE_JWT_TOKEN_HERE"
let headers = {
"Authorization": `JWT ${jwtToken}`
}
const mutation = `
mutation createAffiliateSession($input: CreateAffiliateSessionInputType!) {
createAffiliateSession(input: $input){
affiliateSession {
link {
subdomain
contactName
contactEmail
organisation {
name
salesChannel
}
}
ipAddress
userAgent
queryParams
}
}
}
`
const variables = {
"input": {
"linkId": 12,
"ipAddress": "1.1.1.1",
"userAgent": "Mozilla/5.0",
"queryParams": {
"additionalQueryParams": {"additionalParams": "MMMMMM"},
"event": "VIEWED_AFFILIATE",
"eventCreated": "2022-06-15T18:33:57.317Z",
"eventInformation": {"someInformation": "NNNNNN"},
"route": "/join/buy-now",
"sessionId": "ALPHA_NUM",
"successfulConversion": True,
},
"quoteShareId": 34,
}
}
axios({
url: apiUrl,
method: "post",
data: {
query: mutation,
variables: variables,
},
headers: headers,
}).then((response) => {
console.log(JSON.stringify(response.data, null, 4));
});
| {
"data": {
"link": {
"subdomain": "familymart",
"contactName": "Joe",
"contactEmail": "joe@familymart.com",
"organisation": {
"name": "Octoenergy",
"salesChannel": "field sales",
},
},
}
}
|