4. Examples

Example 1. List Cases

This example returns all cases from the logged-in user's account.
$ curl https://api.access.redhat.com/rs/cases

Example 2. Filter by last update date

$ curl https://api.access.redhat.com/rs/cases?startDate=2010-01-01&endDate=2010-12-31

Example 3. List Case Comments

This example lists case comments for case 0000000.
Replace 0000000 with the number of a case to which you have access.
$ curl https://api.access.redhat.com/rs/cases/0000000/comments

Example 4. Create a Case

The POST operation is used in this example, which creates a case under the RHEL 6 product using the default group, severity level, and type.
$ curl -X POST -H 'Content-Type: application/xml' --data

  '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

   <case xmlns="http://www.redhat.com/gss/strata">

     <summary>Example Case</summary>

     <description>Example created with cURL</description>

     <product>Red Hat Enterprise Linux</product><version>6.0</version>

   </case>'

  https://api.access.redhat.com/rs/cases

Example 5. Update a Case

The PUT method is used here to update data on an existing case. Most fields can be updated in this way.
Case 000000's product is changed to GFS.
$ curl -X PUT -H 'Content-Type: application/xml' --data

  '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

   <case xmlns="http://www.redhat.com/gss/strata">

     <product>GFS</product><version>6.0</version>

   </case>'

  https://api.access.redhat.com/rs/cases/0000000

Example 6. Escalate a Case for Management Attention

This will escalate a case for management attention:

$ curl -X PUT -H 'Content-Type: application/xml' --data

  '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

   <case xmlns="http://www.redhat.com/gss/strata">

     <escalated>true</escalated>

   </case>'

  https://api.access.redhat.com/rs/cases/0000000

Example 7. Add a New Case Comment

This example uses the POST method to add a new comment to case 0000000.
$ curl -X POST -H 'Content-Type: application/xml' --data

  '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

   <comment xmlns="http://www.redhat.com/gss/strata">

     <text>Test comment!  This can contain lots of information, etc.</text>

   </comment>'

  https://api.access.redhat.com/rs/cases/0000000/comments

Example 8. Add a File Attachment to a Case

File attachments are unique because they carry no XML payload. This example uses a form-encoded POST to transmit a file named test.txt to case 0000000.
$ curl -X POST -F 'file=@test.txt' https://api.access.redhat.com/rs/cases/0000000/attachments