Red Hat Support Tool (RHST) Deprecation Guide
The Red Hat Support Tool (RHST) is a command line utility shipped in RHEL 6, 7 and 8, which allows users to interact with our Case Management APIs. One of its primary use-cases is the ability to programmatically upload attachments to support cases and Secure FTP.
Owing to it's low usage, Red Hat Support Tool has been deprecated in RHEL 8 and will not be shipped in RHEL 9 onwards. However, this doesn't affect the support and maintenance of the tool in RHEL 6/7/8, and we shall continue to maintain and push relevant updates / bug-fixes to the tool till the maintenance support phase.
The article contains the curl command equivalent of the API based RHST commands.
Pre-Requisites
- Install
jq, which is used to filter the curl response.
1.listproducts - command to list products
curl -u <customer_portal_id> -X GET 'https://api.access.redhat.com/support/v2/products' | jq ".[].name"
Example,
curl -u jane.doe -X GET 'https://api.access.redhat.com/support/v2/products' | jq ".[].name"
2.listversions - command to list versions of a product
curl -u <customer_portal_id> -X GET 'https://api.access.redhat.com/support/v2/products/<urlencoded_product_name>/versions' | jq ".[].name"
Example -
Product: Red Hat Enterprise Linux
curl -u jane.doe -X GET 'https://api.access.redhat.com/support/v2/products/Red%20Hat%20Enterprise%20Linux/versions' | jq ".[].name"
3.listattachments - command to list attachments for the specified support case
curl -u <customer_portal_id> -X GET 'https://api.access.redhat.com/support/v1/cases/<case_number>/attachments' | jq '. | [.| map(.) | .[] | {fileName: .fileName, uuid: .uuid, description: .description, size_in_bytes: .size}]'
Example,
curl -u jane.doe -X GET 'https://api.access.redhat.com/support/v1/cases/02290113/attachments' | jq '. | [.| map(.) | .[] | {fileName: .fileName, uuid: .uuid, description: .description, size_in_bytes: .size}]'
4.listentitlements - command to list your current entitlements
curl -u <customer_portal_id> -X GET 'https://api.access.redhat.com/support/v1/entitlements?showAll=False' | jq '. | [.| map(.) | .[] | {Name: .name, ServiceLevel: .serviceLevel, SLA: .slaProcessId, SupportLevel: .supportLevel, StartDate: .startDate, EndDate: .endDate}]'
Example,
curl -u jane.doe -X GET 'https://api.access.redhat.com/support/v1/entitlements?showAll=False' | jq '. | [.| map(.) | .[] | {Name: .name, ServiceLevel: .serviceLevel, SLA: .slaProcessId, SupportLevel: .supportLevel, StartDate: .startDate, EndDate: .endDate}]'
5.listcasegroups - command to list case groups
curl -u <customer_portal_id> -X GET 'https://api.access.redhat.com/support/v1/accounts/casegroups' | jq ".[].name"
Example,
curl -u jane.doe -X GET 'https://api.access.redhat.com/support/v1/accounts/casegroups' | jq ".[].name"
To get details of a particular case group
curl -u <customer_portal_id> -X GET 'https://api.access.redhat.com/support/v1/accounts/casegroups/<case_group>'
Example,
curl -u jane.doe -X GET 'https://api.access.redhat.com/support/v1/accounts/casegroups/74975'
6.listcases - command to list your open support cases.
The listcases command comes with various sub-options, which are available as the POST data to be sent in the request. They are as below -
sortField- Sort cases by a particular field. Available fields to sort by are:caseNumber,createdDate,lastModifiedDate,severity,status.sortOrder- For sorting the result in a particular order. Available values -ASC,DESC.onlyUngrouped- true, for Including ungrouped cases in results else false.includeClosed- Show closed cases. Available values -true,false.groupNumber- Show the cases for a particular case group in your account.maxResultsand offset are used to limit the results.
NOTE 1 . - To filter the response, append the below given "jq" as in the curl as shown below
| jq '.cases | [.| map(.) | .[] | {Case_Number: .caseNumber, Summary: .summary, Severity: .severity, Status: .status, GroupName: .groupName, GroupNumber: .groupNumber}]'
Example,
curl -u <customer_portal_id> -X POST https://api.access.redhat.com/support/v1/cases/filter -H 'accept: application/json' -H 'content-type: application/json' -d '{"maxResults": 50, "offset": 0, "sortField": "<sortField>", "sortOrder": "<sortOrder>", "onlyUngrouped": <onlyUngrouped>, "includeClosed":<includeClosed>}' | jq '.cases | [.| map(.) | .[] | {Case_Number: .caseNumber, Summary: .summary, Severity: .severity, Status: .status, GroupName: .groupName, GroupNumber: .groupNumber}]'
Note 2. Cases can also be filtered by casegroups by passing the groupNumber in the filter request. Refer example 2, 3 below
Use following curl to get the list of the case groups(their groupNumbes) in your account -
curl -u <customer_portal_id> -X GET 'https://api.access.redhat.com/support/v1/accounts/casegroups'
Example,
curl -u jane.doe -X GET 'https://api.access.redhat.com/support/v1/accounts/casegroups'
Example 1. Default RHST behaviour
curl -u jane.doe -X POST https://api.access.redhat.com/support/v1/cases/filter -H 'accept: application/json' -H 'content-type: application/json' -d '{"maxResults": 50, "offset": 0, "sortField": "caseNumber", "sortOrder": "DESC", "onlyUngrouped": false, "includeClosed":false}'
Example 2. For filtering by case groupNumber
curl -u jane.doe -X POST https://api.access.redhat.com/support/v1/cases/filter -H 'accept: application/json' -H 'content-type: application/json' -d '{"maxResults": 50, "offset": 0, "sortField": "severity", "sortOrder": "DESC", "onlyUngrouped": false, "includeClosed":false, "groupNumber": "74975"}'
Example 3. For filtering by multiple case groupNumbers
curl -u jane.doe -X POST https://api.access.redhat.com/support/v1/cases/filter -H 'accept: application/json' -H 'content-type: application/json' -d '{"includeClosed": false, "maxResults": 50, "offset": 0, "sortField": "caseNumber", "sortOrder": "DESC", "groupNumbers": ["74973", "74975"], "onlyUngrouped": false}'
7.getcase - command to find a specific case by number.
- redhat-support-tool getcase
Case Number 012345678
Case Type: Defect / Bug
Severity: 4 (Low)
Status: Waiting on Red Hat
Alternate ID:
:
Summary: <case summary>
Description
===============================================================================
<case description block>
Case Discussion
===============================================================================
Comment: #N
:
Recommendations
===============================================================================
:
To retrieve similar output you will need to perform three separate curl commands, one for the case header information, one for comments, and one for the recommendation section.
- To get all case header details.
curl -u <customer_portal_id> -X GET 'https://api.access.redhat.com/support/v1/cases/<case_number>' | jq '{Case_Number: .caseNumber, Case_Type: .caseType, Severity: .severity , Status: .status, Alternate_Id: .alternateId, Product: .product, Version: .version , Support_level: .entitlementSla, Owner: .contactName, Red_Hat_owner: .ownerId, Group: .groupNumber,Opened: .createdDate, Opened_by: .createdById, Last_updated_at: .lastModifiedDate, Last_updated_by: .lastModifiedById, Summary: .summary, Description: .description}'
Example,
curl -u jane.doe -X GET 'https://api.access.redhat.com/support/v1/cases/02290113' | jq '{Case_Number: .caseNumber, Case_Type: .caseType, Severity: .severity , Status: .status, Alternate_Id: .alternateId, Product: .product, Version: .version , Support_level: .entitlementSla, Owner: .contactName, Red_Hat_owner: .ownerId, Group: .groupNumber,Opened: .createdDate, Opened_by: .createdById, Last_updated_at: .lastModifiedDate, Last_updated_by: .lastModifiedById, Summary: .summary, Description: .description}'
Example output:
{
"Case_Number": "01234567",
"Case_Type": "Defect/Bug",
"Severity": "4 (Low)",
"Status": "Closed",
"Alternate_Id": null,
:
"Summary": "<case summary>",,
"Description": "case description block"
}
- Get case discussions (case comments)
curl -u <customer_portal_id> -X GET 'https://api.access.redhat.com/support/v1/cases/<case_number>' | jq '.comments | [.| map(.) | .[] | {comment: .commentBody, Author: .lastModifiedById, Date: .lastModifiedDate}]'
Example,
curl -u jane.doe -X GET 'https://api.access.redhat.com/support/v1/cases/02290113' | jq '.comments | [.| map(.) | .[] | {comment: .commentBody, Author: .lastModifiedById, Date: .lastModifiedDate}]'
Example output:
{
"comment": "Lorem \n ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna \n aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo \nconsequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. \n \n Lorem ipsum dolor sit amet, \n consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur \n sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
"Author": "Last, First",
"Date": "2022-06-24T14:23:40Z"
},
- To get case recommendations
curl -u <customer_portal_id> -X GET 'https://api.access.redhat.com/support/v1/cases/<case_number>' | jq '.caseResourceLinks | [.| map(.) | .[] | {title: .title, link: .resourceViewURI}]'
Example,
curl -u jane.doe -X GET 'https://api.access.redhat.com/support/v1/cases/02290113' | jq '.caseResourceLinks | [.| map(.) | .[] | {title: .title, link: .resourceViewURI}]'
8.addattachment - command to add an attachment to a case.
Refer to the Red Hat Secure FTP - User Guide . There is no upload size limit for SFTP.
For https uploads, refer to the following. Please note this has a size limit of 1GB.
curl -u <customer_portal_id> -F "file=@<path_to_file>" -F "description=<description>" -X POST https://api.access.redhat.com/support/v1/cases/<case_number>/attachments/ -D -
Example,
curl -u jane.doe -F "file=@/tmp/my_sosreport" -F "description=Sosreport for case" -X POST https://api.access.redhat.com/support/v1/cases/02290113/attachments/ -D -
9.getattachment - command to find a specific attachment by uuid.
For downloading an attachment, there are two steps involved :-
-
Fetch the download link
curl -u <customer_portal_id> -X GET 'https://api.access.redhat.com/support/v1/cases/<case_number>/attachments' | jq '.[]| select(.uuid=="<attachment_uuid>")' | jq .link
Please note if there is any issue with the jq, then call the listattachments command curl and check the “link” field for your attachment uuid.
-
Download the attachment from that link. The file can be downloaded from any options as below -
- Saves the file by
uuid.
curl --fail -L -O -u <customer_portal_id> -X GET <link_obtained_from_above_curl>- Saves file by given filename and location in the
-o
curl --fail -L -u <customer_portal_id> -X GET <link_obtained_from_above_curl> -o <your_filename>- Saves the file by the same name as uploaded on the case.
wget --content-disposition --user <customer_portal_id> --ask-password <link_obtained_from_above_curl> - Saves the file by
Examples.
-
Fetch the download link as below
curl -u jane.doe -X GET 'https://api.access.redhat.com/support/v1/cases/02290113/attachments' | jq '.[]| select(.uuid=="6ec52168-f043-47d7-853a-65cf38d5bdc1")' | jq .link -
Download the attachment with the link obtained from above curl using either of the below given
curl/wget.curl --fail -L -O -u jane.doe -X GET https://attachments.access.redhat.com/hydra/rest/cases/02290113/attachments/6ec52168-f043-47d7-853a-65cf38d5bdc1 curl --fail -L -u jane.doe -X GET https://attachments.access.redhat.com/hydra/rest/cases/02290113/attachments/6ec52168-f043-47d7-853a-65cf38d5bdc1 -o /tmp/downloaded_file wget --content-disposition --user jane.doe --ask-password https://attachments.access.redhat.com/hydra/rest/cases/02290113/attachments/6ec52168-f043-47d7-853a-65cf38d5bdc1
10.modifycase
For modifying a case, we have the following options in RHST .
-
Modify severity
a. Find the severities
curl -u <customer_portal_id> -X GET 'https://api.access.redhat.com/support/v1/cases/metadata/severities' | jq .items Example, curl -u jane.doe -X GET 'https://api.access.redhat.com/support/v1/cases/metadata/severities' | jq .items
b. Now, modify the case
```
curl -u <customer_portal_id> -X PUT https://api.access.redhat.com/support/v1/cases/<case_number> -d '{"severity": "<Severity_obtained_from_above_curl>"}'
Example,
curl -u jane.doe -X PUT https://api.access.redhat.com/support/v1/cases/02290113 -d '{"severity": "3 (Normal)"}'
```
-
Modify the Case type
a. Find the case types
curl -u <customer_portal_id> -X GET 'https://api.access.redhat.com/support/v1/cases/metadata/types' | jq .items Example, curl -u jane.doe -X GET 'https://api.access.redhat.com/support/v1/cases/metadata/types' | jq .itemsb. Modify the case type
curl -u <customer_portal_id> -X PUT https://api.access.redhat.com/support/v1/cases/<case_number> -d '{"caseType": "<Casetype_obtained_from_above_curl>"}' Example, curl -u jane.doe -X PUT https://api.access.redhat.com/support/v1/cases/02290113 -d '{"caseType": "Defect / Bug"}' -
Modify Status
a. Find the different statuses
curl -u <customer_portal_id> -X GET 'https://api.access.redhat.com/support/v1/cases/metadata/statuses' | jq .items Example, curl -u jane.doe -X GET 'https://api.access.redhat.com/support/v1/cases/metadata/statuses' | jq .itemsb. Now, modify the case status
curl -u <customer_portal_id> -X PUT https://api.access.redhat.com/support/v1/cases/<case_number> -d '{"status": "<Status_obtained_from_above_curl>"} Example, curl -u jane.doe -X PUT https://api.access.redhat.com/support/v1/cases/02290113 -d '{"status": "Waiting on Red Hat"}' -
Modify alternate
id.curl -u <customer_portal_id> -X PUT https://api.access.redhat.com/support/v1/cases/<case_number> -d '{"alternateId": "<alternate_id>"}' Example, curl -u jane.doe -X PUT https://api.access.redhat.com/support/v1/cases/02290113 -d '{"alternateId": "1234"}' -
Modify product
Products can be found from listproducts command curl.
curl -u <customer_portal_id> -X PUT https://api.access.redhat.com/support/v1/cases/<case_number> -d '{"product": "<product>", "version":"<version>"}' Example, curl -u jane.doe -X PUT https://api.access.redhat.com/support/v1/cases/02290113 -d '{"product": "Red Hat Enterprise Linux", "version":"8.0"}' -
Modify version
Versions for a specific product can be found from the listversions command curl.
curl -u <customer_portal_id> -X PUT https://api.access.redhat.com/support/v1/cases/<case_number> -d '{"product":"<product>","version":"<version>"}' Example, curl -u jane.doe -X PUT https://api.access.redhat.com/support/v1/cases/02290113 -d '{"product":"Red Hat Enterprise Linux","version":"8.0"}'
11.opencase - command to open a new support case.
- To see the recommendations before opening the case .
curl -u <customer_portal_id> -X POST 'https://api.access.redhat.com/support/search/recommendations' --header 'Accept: application/json' --header 'Content-Type: application/json' -d '{ "product":"<product>", "version":"<version>", "summary":"<summary_for_case>"}' | jq '.response.docs | [.| map(.) | .[] | {url: .view_uri, Title: .allTitle}]'
Example,
curl -u jane.doe -X POST 'https://api.access.redhat.com/support/search/recommendations' --header 'Accept: application/json' --header 'Content-Type: application/json' -d '{ "product":"Red Hat Enterprise Linux", "version":"8.1", "summary":"Test summary"}' | jq '.response.docs | [.| map(.) | .[] | {url: .view_uri, Title: .allTitle}]'
- To open a support case .
curl -u <customer_portal_id> -X POST https://api.access.redhat.com/support/v1/cases -H 'accept: application/json' -H 'content-type: application/json' -d '{"summary": "<summary", "description": "<description>", "product": "<product>","version": "<version>","caseType": "<caseType","severity": "<severity>"}'
Note- To open a support case along with a casegroup, refer example 2 below
Example 1.
curl -u jane.doe -X POST https://api.access.redhat.com/support/v1/cases -H 'accept: application/json' -H 'content-type: application/json' -d '{"summary": "Test Summary", "description": "This is test description for new case created", "product": "Red Hat Enterprise Linux","version": "7.9","caseType": "Defect / Bug","severity": "3 (Normal)"}'
Example 2. - If you want to use the casegroup (Example,. - 74975) while opening a case.
curl -u jane.doe -X POST https://api.access.redhat.com/support/v1/cases -H 'accept: application/json' -H 'content-type: application/json' -d '{"summary": "Test Summary", "description": "This is test description for new case created", "product": "Red Hat Enterprise Linux","version": "7.9","caseType": "Defect / Bug","severity": "3 (Normal)", "groupNumber": "74975"}'
12.addcomment - command to add a comment to a case.
curl -u <customer_portal_id> -X POST https://api.access.redhat.com/support/v1/cases/<case_number>/comments -H 'accept: application/json' -H 'content-type: application/json' -d '{"caseNumber": "<case_number>", "commentBody": "<Comment_text>"}'
Example,
curl -u jane.doe -X POST https://api.access.redhat.com/support/v1/cases/02290113/comments -H 'accept: application/json' -H 'content-type: application/json' -d '{"caseNumber": "02290113", "commentBody": "This is my comment text"}'
13.kb - command to find a knowledge base solution by ID
Please first check the /solutions endpoint. If the response from this is 404, then check the /articles endpoint. Hence, both curls are given below.
- Check for solutions
curl -u <customer_portal_id> -X GET 'https://api.access.redhat.com/support/v1/solutions/<solution_id>' | jq -r '{Title: .title, Issue: .issue.text, Environment: .environment.text, Resolution: .resolution.text, Last_Modified_on: .lastModifiedDate}'
Example,
curl -u jane.doe -X GET 'https://api.access.redhat.com/support/v1/solutions/61546' | jq -r '{Title: .title, Issue: .issue.text, Environment: .environment.text, Resolution: .resolution.text, Last_Modified_on: .lastModifiedDate}'
- Check for articles.
curl -u <customer_portal_id> -X GET 'https://api.access.redhat.com/support/v1/articles/<article_id>' | jq '{Title: .title, URL: .viewURI, Created_at: .createdDate, Last_Modified_Date: .lastModifiedDate, Body: .body.text}'
Example,
curl -u jane.doe -X GET 'https://api.access.redhat.com/support/v1/articles/3724231' | jq '{Title: .title, URL: .viewURI, Created_at: .createdDate, Last_Modified_Date: .lastModifiedDate, Body: .body.text}'
14.search - command to search the entire knowledge base for solutions
curl -u <customer_portal_id> -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ "start":0, "rows":50, "q":"<text_to_be_searched>", "expression":"fq=documentKind%3A%22Solution%22"}' 'https://api.access.redhat.com/support/search/v2/kcs' | jq '.response.docs | [.| map(.) | .[] | {url: .view_uri, Title: .allTitle, Abstract: .abstract}]'
Example, Search term - “libvirt error code: 1, message: internal error HTTP response code 404" .
curl -u jane.doe -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ "start":0, "rows":50, "q":"libvirt error code: 1, message: internal error HTTP response code 404", "expression":"fq=documentKind%3A%22Solution%22"}' 'https://api.access.redhat.com/support/search/v2/kcs' | jq '.response.docs | [.| map(.) | .[] | {url: .view_uri, Title: .allTitle, Abstract: .abstract}]'
15.diagnose - command to send text to Red Hat for analysis.
curl -u <customer_portal_id> -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ "summary": "<plain_text_for_analysis>"}' https://api.access.redhat.com/support/search/recommendations | jq '.response.docs | [.| map(.) | .[] | {url: .view_uri, Title: .allTitle}]'
This gives top 10 recommendations.
Example, text to be diagnosed - libvirt error code: 1, message: internal error HTTP response code 404.
curl -u jane.doe -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ "summary": "libvirt error code: 1, message: internal error HTTP response code 404"}' https://api.access.redhat.com/support/search/recommendations | jq '.response.docs | [.| map(.) | .[] | {url: .view_uri, Title: .allTitle}]'
Using Proxy configuration in the curls
If the user has a proxy configured, then the --proxy option can be used in the curl commands. Given below is a example with the addattachment command curl with authenticated and unauthenticated proxy.
Proxy - http://localhost:8080
curl -u jane.doe --proxy http://localhost:8080 -F "file=@/home/jane/my_sosreport" -X POST https://api.access.redhat.com/support/v1/cases/02290113/attachments/ -D -
If a user has a authenticated proxy(http://localhost:8080), specify it’s username(rstuser) and password(rstpassword) in as below
curl -u jane.doe --proxy rstuser:rstpassword@localhost:8080 -F "file=@/home/jane/my_sosreport" -X POST https://api.access.redhat.com/support/v1/cases/02290113/attachments/ -D -
General Note
- If you run into
jqrelated errors for example as below, please run your curl without jq to check the curl response first -
jq: error (at <stdin>:0, ): Cannot iterate over null (null)ORq: error (at <stdin>:0): Cannot index array with string)