Announcement

Collapse
No announcement yet.

MVT:Call Headers Attribute

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

    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


    #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'  $ asciichar( 13 ) $ asciichar( 10 )" />
    
    <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