Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
zFernand0 opened this issue Feb 6, 2025 · 2 comments
Open
Assignees
Labels
2025 area: cli This issue is related to Zowe Command Line Interface (CLI) area: zowe-explorer Issues related to the VSC extension Zowe Explorer
Milestone

Comments

@zFernand0
Copy link
Member

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
"""
@zFernand0 zFernand0 added area: cli This issue is related to Zowe Command Line Interface (CLI) area: zowe-explorer Issues related to the VSC extension Zowe Explorer labels Feb 6, 2025
@github-project-automation github-project-automation bot moved this to New Issues in Zowe CLI Squad Feb 6, 2025
@anaxceron anaxceron self-assigned this Feb 10, 2025
@anaxceron anaxceron added the 2025 label Feb 10, 2025
@anaxceron anaxceron added this to the 3.2 milestone Feb 10, 2025
@t1m0thyj
Copy link
Member

@zFernand0 Is this related to the following article? https://docs.zowe.org/stable/troubleshoot/cli/cli-use-curl-to-troubleshoot/

@zFernand0
Copy link
Member Author

That's perfect!
Ideally we would add some Powershell native methods 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2025 area: cli This issue is related to Zowe Command Line Interface (CLI) area: zowe-explorer Issues related to the VSC extension Zowe Explorer
Projects
Status: New Issues
Status: New Issues
Development

No branches or pull requests

4 participants