sp_OAMethod to make rest api call

  • yosiasz

    SSCommitted

    Points: 1699

    Greetings,

    I have a need to call a rest api against a resource. It a POST and would like to send the following as POST option

    http.post(url,

    '{

    "https": { rejectUnauthorized: settings.ssl },

    "headers": {

    "Authorization": "BASIC dfsdkfdsfyduyfiuhdfiuyu5y43=",

    "Content-Type": "application/json",

    "Accept": "application/json"

    }

    }'

    )

    Tried to this but it fails

    EXEC @ret = sp_OAMethod @token, 'open', NULL, 'POST', @url, 'false';

    EXEC @ret = sp_OAMethod @token, 'setRequestHeader', NULL, 'Authentication', @authHeader;

    EXEC @ret = sp_OAMethod @token, 'setRequestHeader', NULL, 'Content-type', @contentType;

    EXEC @ret = sp_OAMethod @token, 'setRequestHeader', NULL, 'https', '{"rejectUnauthorized":"false"}';

    EXEC @ret = sp_OAMethod @token, 'send', NULL, null;

  • Site Owners

    SSC Guru

    Points: 80373

    Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply