Skip to content

[Troubleshooting tip] How to test via cURL to debug issues with CLI or ZE #4162

Open
@zFernand0

Description

1. Slack conversation link (if any)

N/A

2. Choose a title

Troubleshoot your z/OSMF connectivity

3. Symptom

Whenever there is an error which might be related to SAF and/or z/OSMF configuration or connectivity issues, it often surfaces in the Zowe CLI or Zowe Explorer as non-user-friendly error.

4. Solution

Try using an unrelated application (like cURL) to submit the request and see if the same error happens 😋

Here are some details for that the troubleshooting content might look like:

If you have `cURL` I'd love to see the output of this command:

"""
curl -ik 'https://<HOST>:<PORT>/zosmf/restjobs/jobs?owner=*&prefix=izusvr1&exec-data=Y' -H 'X-CSRF-ZOSMF-HEADER: TRUE' -H 'Authorization: Basic <BASE64-CREDENTIALS>'
"""

### Windows users
If you do not have `cURL`, we came up with a series of commands to run in PowerShell. 

"""
$headers=@{}
$headers.Add("X-CSRF-ZOSMF-HEADER", "TRUE")
$headers.Add("Authorization", "<BASE64-CREDENTIALS>")
$response = Invoke-WebRequest -Uri 'https://<HOST>:<PORT>/zosmf/restjobs/jobs?owner=*&prefix=izusvr1&exec-data=Y' -Method GET -Headers $headers

$response.StatusCode
$response.Content
$response.Headers
"""

Please:
-   Replace <HOST> with your hostname or IP address to z/OSMF
- Replace <PORT> with the port number where z/OSMF is configured
- Replace <BASE64-CREDENTIALS> with the base64 encoded credentials
<USER>:<PASSWORD>

In order to get the base64 encoded credentials, you could run the following commands in PowerShell, or go to an online base64 encoder : )

"""
$stringToEncode = "USERID:P4SSW0RD"
$bytes = [System.Text.Encoding]::UTF8.GetBytes($stringToEncode)
$encodedString = [Convert]::ToBase64String($bytes)
$encodedString
"""

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

2025area: cliThis issue is related to Zowe Command Line Interface (CLI)area: zowe-explorerIssues related to the VSC extension Zowe Explorer

Type

No type

Projects

  • Status

    New Issues

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions