Announcement

Collapse
No announcement yet.

Including an API Key in an HTTP Header

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Including an API Key in an HTTP Header

    In a non-merchant application, we use a translation tool, DeepL. They have deprecated the ability to include our API key in an auth_key query parameter. They say:

    Going forward, you will need to authorize any API request, to any endpoint, by including your API key in an HTTP header named Authorization, like this:

    Authorization: DeepL-Auth-Key [yourAuthKey]
    We are unclear if this is something that we can do with our MivaScript application. Any thoughts on how to do this would be very helpful.
    ---------------------------------
    Robin McDermott, CQE
    Director of Training
    QualityTrainingPortal.com

    #2
    Something like this should work
    Code:
     
    <MvASSIGN NAME="l.crlf" VALUE="{ asciichar(13) $ asciichar(10) }">
    <MvCall action="{ 'https://www.checkthis.com/letmein' }" method="GET" CONTENT-TYPE="application/json" HEADERS="{ 'Authorization: DeepL-Auth-Key  ' $ YOURAPIKEY $ l.crlf }" fields="" FLAGS="noparse">
        <MvAssign name="l.results" value="{ callvalue }">
    </MvCall>
    William Gilligan - Orange Marmalade, Inc.
    www.OrangeMarmaladeinc.com

    Comment


      #3
      Thanks Bill. I should have also said that they require using Post and not Get. Would it work the same?
      ---------------------------------
      Robin McDermott, CQE
      Director of Training
      QualityTrainingPortal.com

      Comment


        #4
        Yes - that should work as well. Just switch out the method to POST. If sending some JSON, switch it to RAW.
        William Gilligan - Orange Marmalade, Inc.
        www.OrangeMarmaladeinc.com

        Comment


          #5
          Thanks Bill!!!
          ---------------------------------
          Robin McDermott, CQE
          Director of Training
          QualityTrainingPortal.com

          Comment

          Working...
          X