rest
32 TopicsError in REST https call to get the Auth token
Hi All, I am using F5 14.1.5.6 version of F5 and trying to get auth token from /mgmt/shared/authn/login But getting 401 error, please find the detailed error message. Can any one help me with this issue. [{"code":401,"message":"Unable to process request /tm/auth/source. Service is unavailable.","referer":"10.3.4.112","restOperationId":343185765,"kind":":resterrorresponse"}]Solved151Views0likes1CommentCert Invalid Parameter
I am getting a 400 response from the /mgmt/tm/sys/crypto/cert endpoint. The body I am passing is: {"command":"install","name":"testdomain","from-local-file":"/var/config/rest/downloads/testdomain.key"} . The file exists and if I remove the file, I get an error that the file could not be copied, so I think this actually is copying this file. The response body is: Key management library returned bad status: -4, Invalid Parameter . Any help would be really appreciated. I am following the instruction here, but I am using token auth: https://devcentral.f5.com/questions/upload-ssl-keys-certs-via-icontrol-rest-api This could be related to the issue I am having with uploading files, I opened a question here: https://devcentral.f5.com/questions/unable-to-upload-file-through-icontrol-rest-interface-49232Solved933Views0likes5CommentsREST API Equivalent for "tmsh show cm device-group Sync-Failover"
Hi! I found the REST API for the TMSH command mentioned in the subject line: /mgmt/tm/cm/device-group/~Common~Sync-Failover?expandSubcollections=true But I can't find the following values that comes with the CLI: Time Since Last Sync (HH:MM:SS) CID Originator CID Time (UTC) LSS Originator LSS Time (UTC) Please advise Thanks J.302Views0likes1CommentPowerShell - How to modify system iFile?
I use PowerShell to upload a text file containing a number of parameters that I want to use in an existing iRule. Through the web-gui I have already created an iFile named 'iFileApiKeys'. In PowerShell I use this procedure to upload the text file: $length = "0-" + ($fileContent.Length - 1) + "/" + $fileContent.Length $headers = @{ "Content-Range" = $length} $uploadResult = Invoke-WebRequest $URL -Method POST -Headers $headers -InFile $filePathPlusTextfile - ContentType "multipart/form-data" -TimeoutSec 20 -Credential $mycreds | ConvertFrom-Json Write-Host "Upload Result:" Write-Host $uploadResult According to the 'uploadResult' the file ends up in the folder:'var/config/rest/downloads/iFileApiKeys.txt' on my F5 LTM Using 'SuperPutty' I can via tmos (tmsh) modify the existing system iFile by executing: `tmos> modify /sys file ifile iFileApiKeys source-path file:///var/config/rest/downloads/iFileApiKeys.txt My problem is that I can't seem to find the correct PowerShell command to achieve the same result as the tmos (tmsh) command does. I want to use and actually think I should use: `Invoke-Webrequest -Method Put` I've been trying to emulate an example taken from a Jason Rahm post on this site: https://devcentral.f5.com/articles/getting-started-with-icontrol-working-with-the-system-20592 Like this: $sysIfilePath = "/mgmt/tm/sys/file/ifile/iFileApiKeys" `$sysPath = "https://" + $host_address + $sysIfilePath $updateresult = Invoke-WebRequest -Method Put -Uri $sysPath -Headers $headers -Credential $mycreds -Body $body But this command fails unfortunately, My assumption is that I don't fill $headers and/or $body with the correct values. When executing a GET for my sys iFile object the result is: ``{"kind":"tm:sys:file:ifile:ifilestate","name":"iFileApiKeys","fullPath":"iFileApiKeys","generation":10970077,"selfLink":"https://localhost/mgmt/tm/sys/file/ifile/iFileApiKeys?ver=13.1.0.2","chec ksum":"SHA1:878:52a261b5a113db5c9421a54e1e8b5685e7da7a4d","createTime":"2018-11-26T22:52:08Z","createdBy":"per.eriksson","lastUpdateTime":"2018-12-08T19:49:15Z","mode":33188,"revision":24,"size" :878,"sourcePath":"file:///var/config/rest/downloads/iFileApiKeys.txt","updatedBy":"per.eriksson"} Anyone out there that can point me in the right direction on how to update my sys iFile using PowerShell? Thank you! /Per760Views0likes2CommentsHow can I list distributed applications using the Python SDK?
I am trying to get a list of distributed applications using the Python SDK. I can do this via REST/Postman by drilling down to /mgmt/tm/gtm/distributed-app. However when I drill down to gtm using the Python SDK, there is no "distributed-app" class to call. I see the following... {'_meta_data': {'container': , 'bigip': , 'icr_session': , 'icontrol_version': '', 'uri': 'https://beiglb1:443/mgmt/tm/gtm/', 'minimum_version': '11.5.0', 'allowed_commands': [], 'required_command_parameters': set(), 'exclusive_attributes': [], 'object_has_stats': True, 'minimum_additional_parameters': set(), 'allowed_lazy_attributes': [, , , , , , , , , ]}} As you can see I can access my wide ips/pools, servers, data_centers, etc... from here just fine, but I cannot see my distributed apps. Any ideas on how to access them via Python SDK, or do I have to use REST?384Views0likes1CommentREST API access right
Hi all, We're running F5 LTM (version 14.1.4.x) and sorry for any newbie question. We're trying to perform some tasks through REST API to the LTM: 1. Check system status, e.g. curl -ks -H "Content-Type: application/json" -u admin:admin "https://192.168.1.1/mgmt/tm" -d "{\"command\":\"show\", \"utilCmdArgs\":\"-c 'cm failover-status'\"}" 2. Perform failover, e.g. curl -ks -H "Content-Type: application/json" -u admin:admin "https://192.168.1.1/mgmt/tm" -d "{\"command\":\"run\", \"utilCmdArgs\":\"-c 'sys failover standby'\"}" We don't want to expose admin password in any script, while authentication token seems only valid for 10 hours at most and not suitable to be used in cronjobs.We create user for this specific purpose with user role Resource Administrator who can perform the task through ssh or GUI. However, both commands can run as that specific user (testuser1) in tmsh interactively, but fail when running through curl with error: {"code":401,"message":"Authorization failed: user=https://localhost/mgmt/shared/authz/users/testuser1 resource=/mgmt/tm verb=POST uri:http://localhost:8100/mgmt/tm referrer:192.168.1.8 sender:192.168.1.8","referer":"192.168.1.8","restOperationId":2225072,"kind":":resterrorresponse"} I'm afraid we've something missed or setting up based on wrong concept... Would anyone please help? Thanks and Rgds /st wong1.3KViews0likes6CommentsRunning BASH commands via REST API
I am trying to run bash commands via the REST API but am getting an error. When trying to use the following syntax I am getting a 403 running with Admin authentication... GET: https://F5LTM/mgmt/tm/util/bash Output: {"code":403,"message":"Operation is not allowed on component /util/bash.","errorStack":[]} Does anyone know if this is possible, or have any syntax examples of how to run bash commands? I assume you need to submit a post request, but I am not sure how to structure the syntax in the body of the request and cannot find any examples.3.8KViews1like3CommentsUnable to Upload File Through iControl REST Interface
I am attempting to upload a file through the iControl REST interface using iControl BIG-IP v12 getting a response code 400 with a response body of: {"remainingByteCount":0,"usedChunks":{"0":5},"totalByteCount":5,"localFilePath":"/var/config/rest/downloads/test.txt","temporaryFilePath":"/var/config/rest/downloads/tmp/test.txt","generation":0,"lastUpdateMicros":1475011484946186} I am using token auth. I am at a loss as to why this is giving back a 200, any help would be greatly appreciated. I can answer any questions that will help give us clues. Here are the headers that I have: Content-Type: "text/plain" Content-Range: "0-4/5" Content-Length: "5" Transfer-Encoding: "chunked" And the response debug data: server: "com.f5.rest.common.RestRequestSender" x-frame-options: "SAMEORIGIN" pragma: "no-cache" cache-control: "no-store, no-cache, must-revalidate" expires: "-1" content-length: "231" content-type: "text/plain; charset=ISO-8859-1" content-range: "0-4/5" local-ip-from-httpd: "xxx.xxx.xxx.xxx" accept-encoding: "gzip;q=1.0,deflate;q=0.6,identity;q=0.3" x-forwarded-server: "localhost.localdomain" x-forwarded-proto: "http" x-forwarded-host: "xxx.xxx.com" x-content-type-options: "nosniff" x-xss-protection: "1; mode=block" content-security-policy: "default-src 'self' 'unsafe-inline' 'unsafe-eval'" strict-transport-security: "max-age=16070400; includeSubDomains" connection: "close"604Views0likes4Comments