How can I open Postman by excel vba?

Asked

Viewed 175 times

-1

I wonder how I can open the POSTMAN by the EXCEL VBA.

I would like to instantiate the application as an object but I do not know how to do.

Example:

Set IE = CreateObject("InternetExplorer.application")
With IE
End with
  • Your question is unclear... Postman is an application to make HTTP requests. Do you want to make HTTP requests? Do you want to access the data saved in the application? Where you read that Postman has some integration with languages or other applications?

  • @fernandosavio So, I would just open through VBA Excel the Postman. And instantiate in a variable "Object".

  • Sorry, but it still doesn’t make sense (at least for me)... Maybe you can start another process or run a binary from the VBA.. What I don’t understand is what you mean by instantiating into a variable. What kind of object would that variable be? And what could you do with this variable?

  • @fernandosavio Changing the question then, how could I put an API on Postman and loop a variable ?

  • What I want in relation to the post, is how to access through VBA the Postman, because I have a part of an API file in HTML and in it I need to keep changing a variable.

1 answer

1

I’m pretty sure Postman doesn’t provide an interface via Activex, for the CreateObject is this, a reference to a activex, soon it is impossible to have an object of something it does not support Activex.

Note that Activex is a Microsoft technology that was widely used in the past, but today it is somewhat unusual. I believe it will be able to do maximum is to use the SendKeys which I believe is specific to Office VBA:

An example of own documentation with windows calculator:

Dim ReturnValue, I 
ReturnValue = Shell("CALC.EXE", 1)    ' Inicia a calculador
AppActivate ReturnValue               ' Ativa a calculadora (janela)
For I = 1 To 100                      ' 100 repetições
    SendKeys I & "{+}", True          ' Envia o numero mais o sinal de soma
Next I 
SendKeys "=", True                    ' Obtem o total
SendKeys "%{F4}", True                ' Envia ALT+F4 para fechar a calculadora

I’m not going to formulate an example with Postman because I think it’s going to be something complex to adjust, since Postman doesn’t seem to work very well with TAB (which would be essential for using this), at least I couldn’t, but I think this will be as close as it gets, follow supported commands:

Key Code
BACKSPACE {BACKSPACE}, {BS} or {BKSP}
BREAK {BREAK}
CAPS LOCK {CAPSLOCK}
DEL or DELETE {DELETE} or {DEL}
END {END}
ENTER {ENTER} or ~
ESC {ESC}
HELP {HELP}
HOME {HOME}
INS or INSERT {INSERT} or {INS}
NUM LOCK {NUMLOCK}
PAGE DOWN {PGDN}
PAGE UP {PGUP}
LEFT ARROW {LEFT}
RIGHT ARROW {RIGHT}
UP ARROW {UP}
DOWN ARROW {DOWN}
PRINT SCREEN {PRTSC}
SCROLL LOCK {SCROLLLOCK}
TAB {TAB}
F1 {F1}
F2 {F2}
F3 {F3}
F4 {F4}
F5 {F5}
F6 {F6}
F7 {F7}
F8 {F8}
F9 {F9}
F10 {F10}
F11 {F11}
F12 {F12}
F13 {F13}
F14 {F14}
F15 {F15}
F16 {F16}

To specify keys combined with any combination of "SHIFT", "CTRL" and "ALT" keys, prefix the key code with one or more of the following codes:

Key Code
SHIFT +
CTRL ^
ALT %

However (i can’t say because I’ve never used) you can try using Postman’s own features that seem to provide scriptwriting environments to automate tasks within Postman himself, at least that’s what I thought of this page: https://www.getpostman.com/postman-features (where it says "Scripts and the Postman Sandbox"), I believe this is it:

Now if you have a specific question, for example:

how to access an html document and pick a certain variable to apply to a request in Postman?

I believe it will be a different question and that you first study the API I have indicated to you to see the possibility and then if you have difficulty ask the question.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.