Skip to main content

We are trying to connect our UniVerse (11.3.1.6022 running on AIX 7.2) to Klavyio to send emails.

The following works fine from Postman but the authorization line fails from U2 BASIC.  We have tried multiple variations with no luck.

Seems like the SETREQUESTHEADER does not support this AUTH.CODE value.

Any ideas are appreciated.

Here are the essential code lines:

POSTURL = ENDPOINT                 <-- actual web address
POSTTYPE = "POST"
CONTENTTYPE = "application/vnd.api+json"
TOKEN = BRAND.API.KEY            <-- proper key for specific web brand 
AUTH.VALUE = "Klaviyo-API-Key ":TOKEN
 
RESULT = CREATEREQUEST(POSTURL, POSTTYPE, REQ_HANDLE)
returns RESULT=0
RESULT = SETREQUESTHEADER(REQ_HANDLE, "Content-Type", CONTENTTYPE)
returns RESULT=0
RESULT = SETREQUESTHEADER(REQ_HANDLE, "Accept", CONTENTTYPE)
returns RESULT=0
RESULT = SETREQUESTHEADER(REQ_HANDLE, "Host", "a.klaviyo.com")
returns RESULT=0
RESULT = SETREQUESTHEADER(REQ_HANDLE, "Authorization", AUTH.VALUE)
returns RESULT=2


------------------------------
Nelson Schroth
president
C3CompleteShop LLC
Harrison OH US
------------------------------

We are trying to connect our UniVerse (11.3.1.6022 running on AIX 7.2) to Klavyio to send emails.

The following works fine from Postman but the authorization line fails from U2 BASIC.  We have tried multiple variations with no luck.

Seems like the SETREQUESTHEADER does not support this AUTH.CODE value.

Any ideas are appreciated.

Here are the essential code lines:

POSTURL = ENDPOINT                 <-- actual web address
POSTTYPE = "POST"
CONTENTTYPE = "application/vnd.api+json"
TOKEN = BRAND.API.KEY            <-- proper key for specific web brand 
AUTH.VALUE = "Klaviyo-API-Key ":TOKEN
 
RESULT = CREATEREQUEST(POSTURL, POSTTYPE, REQ_HANDLE)
returns RESULT=0
RESULT = SETREQUESTHEADER(REQ_HANDLE, "Content-Type", CONTENTTYPE)
returns RESULT=0
RESULT = SETREQUESTHEADER(REQ_HANDLE, "Accept", CONTENTTYPE)
returns RESULT=0
RESULT = SETREQUESTHEADER(REQ_HANDLE, "Host", "a.klaviyo.com")
returns RESULT=0
RESULT = SETREQUESTHEADER(REQ_HANDLE, "Authorization", AUTH.VALUE)
returns RESULT=2


------------------------------
Nelson Schroth
president
C3CompleteShop LLC
Harrison OH US
------------------------------

Nelson,

My expectation is that this should work, though the STATUS value of 2 indicates an invalid parameter so it is worth checking if this needs a BEARER tag explicitly set:

Setting the Bearer tag
Use the following syntax to set the Bearer tag:
ret = setRequestHeader("Authorization", "Bearer value-calc-by-OAuth2-alg")
This syntax creates an HTTP request with the header "Authorization: Bearer value-calc-by-OAuth2-alg".
The syntax requires that Bearer be specified as it is input and is case sensitive.  .

Hoping this helps

JJ



------------------------------
John Jenkins
Thame, Oxfordshire
------------------------------


We are trying to connect our UniVerse (11.3.1.6022 running on AIX 7.2) to Klavyio to send emails.

The following works fine from Postman but the authorization line fails from U2 BASIC.  We have tried multiple variations with no luck.

Seems like the SETREQUESTHEADER does not support this AUTH.CODE value.

Any ideas are appreciated.

Here are the essential code lines:

POSTURL = ENDPOINT                 <-- actual web address
POSTTYPE = "POST"
CONTENTTYPE = "application/vnd.api+json"
TOKEN = BRAND.API.KEY            <-- proper key for specific web brand 
AUTH.VALUE = "Klaviyo-API-Key ":TOKEN
 
RESULT = CREATEREQUEST(POSTURL, POSTTYPE, REQ_HANDLE)
returns RESULT=0
RESULT = SETREQUESTHEADER(REQ_HANDLE, "Content-Type", CONTENTTYPE)
returns RESULT=0
RESULT = SETREQUESTHEADER(REQ_HANDLE, "Accept", CONTENTTYPE)
returns RESULT=0
RESULT = SETREQUESTHEADER(REQ_HANDLE, "Host", "a.klaviyo.com")
returns RESULT=0
RESULT = SETREQUESTHEADER(REQ_HANDLE, "Authorization", AUTH.VALUE)
returns RESULT=2


------------------------------
Nelson Schroth
president
C3CompleteShop LLC
Harrison OH US
------------------------------

Nelson,

If Bearer keyword suggestion does not work during the submitRequest (I tested and it returned 0 for the setREquestHeader), then you could also try the DIRECT keyword like so:

 RESULT = SETREQUESTHEADER(REQ_HANDLE, "Authorization", "DIRECT ":AUTH.VALUE)

this also returns 0 in my test but I cannot go on to test the request. 

Regards,

Dave



------------------------------
Dave Weinstein
Associate Technical Support Engineer
Rocket Internal - All Brands
------------------------------