plnaicfortify Absent Member.
Absent Member.
8939 views

Need help with using SSC REST API bulk endpoint

Jump to solution

I'm having trouble successfully using the SSC REST API bulk endpoint.  I don't understand how to provide the request.information.  Can anyone talk me through its use, in specific detail?

The Bulk Endpoint Details page says "The POST data needed to perform the request contains a list of request URIs."  I'm using the Chrome App Postman, and I seem to successfully hit the bulk endpoint (at least Postman reports a 200 response), but there is not response data.

I've simplified my test case to only contain a single request in the json array of requests.

{

    "requests": [

        {

            "uri": "https://XXXX:YYYY/ssc/api/v1/projects?q=name:\"ZZZZZZ\"",

            "verb": "GET",

            "postData": null

        }

    ]

}

I've tried specifying the request as a json string in the raw request body, but receive no response data.  I've also tried specifying the request as a form field, with key "requests" and value the one-element array of requests: again, no response data.

I am able to successfully hit other endpoints, including performing the simplified single request that the bulk endpoint does not handle.

Can anyone point me in the right direction?  Thanks in advance.

Pete

Labels (1)
0 Likes
1 Solution

Accepted Solutions
andersonshatch Honored Contributor.
Honored Contributor.

Re: Need help with using SSC REST API bulk endpoint

Jump to solution

I think the issue is that you need to supply the method under key "httpVerb", not just "verb" -- the documentation is at fault here. I'll check if it's still wrong in version 17.10 which is out soon, and if it is, I'll open a bug.

Trying your request against my SSC version 16.20 gives me a 400 Bad Request response, which is half useful to explain the fault (unfortunately, it doesn't yield helpful validation to point out the missing required key)

Changing it to "httpVerb": "GET" does yield a response.

POST to /api/v1/bulk

Request body:

{

    "requests": [

        {

            "uri": "https://HOST:PORT/ssc/api/v1/projects",

            "httpVerb": "GET"

        }

    ]

}

Response:

{

    "data": [

        {

            "request": {

                "uri": "https://HOST:PORT/ssc/api/v1/projects",

                "httpVerb": "GET"

            },

            "responses": [

                {

                    "body": {

                        "data": [

                            {

                                "_href": "https://HOST:PORT/ssc/api/v1/projects/1",

                                "createdBy": "admin",

                                "name": "webgoat"

                                "description": "",

                                "id": 1,

                                "creationDate": "2017-03-31T12:04:28.000+0000",

                                "issueTemplateId": "Prioritized-HighRisk-Project-Template"

                            }

                        ],

                        "count": 1,

                        "responseCode": 200

                    },

                    "requestUrl": "https://HOST:PORT/ssc/api/v1/projects"

                }

            ]

        }

    ],

    "count": 1,

    "successCount": 1,

    "responseCode": 200

}

Hope that helps...

-Josh

Fortify L3 Support Engineer

0 Likes
6 Replies
andersonshatch Honored Contributor.
Honored Contributor.

Re: Need help with using SSC REST API bulk endpoint

Jump to solution

I think the issue is that you need to supply the method under key "httpVerb", not just "verb" -- the documentation is at fault here. I'll check if it's still wrong in version 17.10 which is out soon, and if it is, I'll open a bug.

Trying your request against my SSC version 16.20 gives me a 400 Bad Request response, which is half useful to explain the fault (unfortunately, it doesn't yield helpful validation to point out the missing required key)

Changing it to "httpVerb": "GET" does yield a response.

POST to /api/v1/bulk

Request body:

{

    "requests": [

        {

            "uri": "https://HOST:PORT/ssc/api/v1/projects",

            "httpVerb": "GET"

        }

    ]

}

Response:

{

    "data": [

        {

            "request": {

                "uri": "https://HOST:PORT/ssc/api/v1/projects",

                "httpVerb": "GET"

            },

            "responses": [

                {

                    "body": {

                        "data": [

                            {

                                "_href": "https://HOST:PORT/ssc/api/v1/projects/1",

                                "createdBy": "admin",

                                "name": "webgoat"

                                "description": "",

                                "id": 1,

                                "creationDate": "2017-03-31T12:04:28.000+0000",

                                "issueTemplateId": "Prioritized-HighRisk-Project-Template"

                            }

                        ],

                        "count": 1,

                        "responseCode": 200

                    },

                    "requestUrl": "https://HOST:PORT/ssc/api/v1/projects"

                }

            ]

        }

    ],

    "count": 1,

    "successCount": 1,

    "responseCode": 200

}

Hope that helps...

-Josh

Fortify L3 Support Engineer

0 Likes
Trusted Contributor.. stephen.b.burri Trusted Contributor..
Trusted Contributor..

Re: Need help with using SSC REST API bulk endpoint

Jump to solution

While the documentation can use a little help, I find a working example the best.  The SSC HTML5 interface is calling the API, so when there is something I want to do, I go to were the GUI is doing it, then capture the packages that are sent (Fiddler, F12 developer tools, etc).  This is what I have found to be the most helpful when coming up with API syntax.

0 Likes
plnaicfortify Absent Member.
Absent Member.

Re: Need help with using SSC REST API bulk endpoint

Jump to solution

Josh, thanks for your quick response.  I updated my request body to use "httpVerb" but still get a 200 response with no content.  I'm attempting this using Postman, so I'm starting to think I'm not using that tool correctly in this case.  (It does work as expected for non ".../api/v1/bulk" requests.)  I'm going to try another test client to see if I can discover the disconnect.  Now that I have the proper keyword "httpVerb", it's probably down to user error.  Thanks!

0 Likes
plnaicfortify Absent Member.
Absent Member.

Re: Need help with using SSC REST API bulk endpoint

Jump to solution

Stephen, thanks for the suggestion. I did indeed use the chrome developer tools to explore the api.  In this specific case, however, I haven't been able to find an example call to "../bulk" in the web UI.  Do you know of a page where a ".../bulk" request occurs?  Thanks!

0 Likes
andersonshatch Honored Contributor.
Honored Contributor.

Re: Need help with using SSC REST API bulk endpoint

Jump to solution

Go to an application version and select the "issues" button -- that'll kick off a bulk request.

E.g. https://hostname:port/ssc/html/ssc/index.jsp#!/version/2/fix (where 2 is an application version ID)

0 Likes
plnaicfortify Absent Member.
Absent Member.

Re: Need help with using SSC REST API bulk endpoint

Jump to solution

Success using ".../bulk"!  Thank you Josh and Stephen for the help.  It definitely made a different to use "httpVerb" instead of "verb". 

Also, I was probably also using the Postman REST client incorrectly for POSTs somehow.  After changing my request to use httpVerb, my responses in Postman were still empty. I noticed a "Update Request" button, which I then clicked, and then hit the Send button, and miraculously the responses in Postman now contained the expected data.  Don't know if the "Update Request" click had any effect, or if I'm missing something else.  I think this part is totally on me as an inexperienced Postman user.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.