MVT:Call Headers Attribute

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • paul.oreilly
    Mini Mivite

    • Aug 2010
    • 54

    #1

    MVT:Call Headers Attribute

    Hi,

    I'm trying to use mvt:call to make an api request with an Authorization header attribute:

    <mvt:call ACTION="'http://api.resellerratings.com/v1/product/reviews/reviews.json?sku=soclean2-cpap-bipap-cleaner-sanitizer-betterrest&perPage=100&page=1'" METHOD="'GET'"

    headers="'Authorization:Bearer seUQBDzxfAYggrN5RZRWXT0Bcgs382iWEP8YQA0M'">
    <mvt:eval expr= "s.callvalue " />

    </mvt:call>

    The request is denied when I access the page, but if I use that bearer token in Postman, the request returns JSON. So I'm guessing I'm going about this wrong...

    Any ideas? Do I need to pass in the Host Info in the header? If so, how do i pass in multiple header parameters?

    any help greatly appreciated.
    Paul

  • Brennan
    Super Moderator









    • Jun 2009
    • 3481

    #2
    When adding your own headers you need to end each header with a newline and carriage return.

    Here is an example:

    Code:
    <mvt:assign name="g.headers" value=" 'Authorization:Bearer seUQBDzxfAYggrN5RZRWXT0Bcgs382iWEP8YQA0M'  [COLOR=#FF0000]$ asciichar( 13 ) $ asciichar( 10 )[/COLOR]" />
    
    <mvt:call ACTION="'http://api.resellerratings.com/v1/product/reviews/reviews.json?sku=soclean2-cpap-bipap-cleaner-sanitizer-betterrest&perPage=100&page=1'" METHOD="'GET'" headers="g.headers">
    
    <mvt:eval expr= "s.callvalue" />
    
    </mvt:call>
    Brennan Heyde
    VP Product
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment

    Working...
    X