Skip to content

Latest commit

 

History

History
231 lines (166 loc) · 3.8 KB

makeHTTPsTesting.md

File metadata and controls

231 lines (166 loc) · 3.8 KB

Make HTTP/S Request documentation and examples

This function provides the necessary flexbility to make any API call to ANYthing

Highlight text, right-click, select: Make HTTPS Request

links

Calls without "http" in url

This assumes the request is intented for the currently connected device, of which host details are already known.

K13225405: Common iControl REST API command examples

How to use postman api for external tests like post

https://www.npmjs.com/package/axios

simple url as string

/mgmt/tm/sys/clock

simple url in yaml format

url: /mgmt/tm/sys/clock

simple url in json format

{
  "url": "/mgmt/tm/sys/clock"
}

list vlans

/mgmt/tm/net/vlan/

list nodes

/mgmt/tm/ltm/node

/mgmt/tm/sys/service/stats

/mgmt/tm/sys/service/restnoded/stats /mgmt/tm/ltm/virtual/stats?expandSubcollections=true

/mgmt/tm/ltm/virtual?expandSubcollections=true

/mgmt/tm/ltm/virtual /mgmt/tm/ltm/pool/Commonbigiq.benlab.io_t443_pool?expandSubcollections=true

url post in yaml - login

url: /mgmt/shared/authn/login
method: POST
body:
    username: user1
    password: dobgispet

url post in yaml

url: /mgmt/tm/sys/config
method: POST
body:
    command: save

list sys options

/mgmt/tm/sys/

list sys ucs

/mgmt/tm/sys/ucs/

url post in json

{
    "url": "/mgmt/shared/authn/login",
    "method": "POST",
    "body": {
        "username": "todai",
        "password": "dobgispet"
    }
}

tmsh save sys config (all partitions)

url: /mgmt/tm/sys/config
method: POST
body:
  command: save
  partition: all

Calls for outside f5

The command will detect if the url has "http", if found, it considers it a fully qualified request destined for something outside of a device defined within the extension

This is based off of NodeJS AXIOS request https://www.npmjs.com/package/axios#request-config

Default HTTP method = GET

data, or body, must also include 'POST' HTTP method

Simple get

https://api.chucknorris.io/jokes/random

simple get in yaml

url: https://api.chucknorris.io/jokes/random

simple get in yaml - shows broken destination

url: https://broken.extra.io/whah

simple POST in yaml

url: 'https://postman-echo.com/post'
method: POST
data:
  hi: yo

simple POST in json

{
    "url": "https://postman-echo.com/post",
    "method": "POST",
    "data": {
        "hi": "yo"
    }
}

raw get to external F5 using basic auth - DEV

{
  "url": "https://192.168.200.131/mgmt/tm/sys/ntp",
  "auth": {
      "username": "admin",
      "password": "yayPassword!",
      "sendImmediately": "true"
  }
}

get f5 auth token

{
  "url": "https://192.168.200.131:443/mgmt/shared/authn/login",
  "method": "POST",
  "rejectUnauthorized": "false",
  "data": {
    "username":"admin",
    "password":"benrocks",
    "loginProviderName": "tmos"
  }
}

get all tokens

I think we need to make sure all the request options are getting merged with defaults appropriately

{
    "url": "https://192.168.200.131:443/mgmt/shared/authz/tokens/",
    "rejectUnauthorized": "false",
    "headers": {
        "Content-Type": "application/json",
        "X-F5-Auth-Token": "E4IYTVO27Z7MOCG66RJTD7ZHNQ"
    }
}

get nodes

{
    "url": "https://192.168.200.131:443/mgmt/tm/ltm/node",
    "rejectUnauthorized": "false",
    "headers": {
        "Content-Type": "application/json",
        "X-F5-Auth-Token": "DBZX3AKXJFBBZBNPG7RC6QS6MD"
    }
}

"validateStatus": "true",