Starting a Process from Outside of Questetra BPM Suite (Error-handling Chapter)

An error returned from the API!

I suppose that you will surely encounter such a situation while you are dealing with the API of Message Start Event (HTTP). Or perhaps it may be “I do not know why, but it does not work”. In this article, I will explain the error returned by the API of Message Start Event (HTTP).

How to check on errors

Please check the HTTP status code and the error message returned by the API when “the Process is not started even though Message Start Event (HTTP) was accessed”. You can roughly tell where the error occurred with the HTTP status code, and the API error message points out the correction point when the client (user) side has a deficiency.

To look into HTTP status code

For curl command

You can display the response header returned from Message Start Event(HTTP) if you use -i option.

$ curl -i https://example.questetra.net/... 

For example, a response header is as below.

HTTP/1.1 200 200
Date: Wed, 16 Jan 2019 05:46:50 GMT
Server: Apache
Pragma: no-cache
Cache-Control: no-store
Expires: Thu, 01 Jan 1970 00:00:00 GMT
X-Q-Access-ID: {SERVER NAME ("example" in the above)}
Content-Type: text/plain;charset=UTF-8
Content-Language: en
Content-Length: 3
Vary: Accept-Encoding
P3P: CP="CAO PSA OUR"

In this case, data transmission was successful as the HTTP status code is 200, “OK”. Whereas, cases with 400’s and 500’s are errors. In the following cases, for example, the HTTP status code 400 “Bad Request” has returned from the Message Start Event (HTTP) API.

HTTP/1.1 400 400
Date: Fri, 18 Jan 2019 07:49:58 GMT
Server: Apache
Pragma: no-cache
Cache-Control: no-store
Expires: Thu, 01 Jan 1970 00:00:00 GMT
X-Q-Access-ID: shichijo-onmae-134
Content-Disposition: inline
Content-Type: text/xml;charset=UTF-8
Content-Language: en
P3P: CP="CAO PSA OUR"
Connection: close
Transfer-Encoding: chunked

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><message-start-event-errors><error><key>q_selects</key><detail>Select more than one.</detail></error></message-start-event-errors>

For the meaning of each HTTP status code, refer to “Major HTTP status code list“.

For Python 3 (utilizing Request package)

The code example shown in Python chapter has been designed the HTTP status code to be stdout.。

try:
    r = requests.post(url, data=params, files=files) # POST 送信
    r.raise_for_status()
    print('Headers: ')
    print(r.request.headers)
    print('Status Code: {0}'.format(r.status_code))
    print(r.text)
except requests.exceptions.HTTPError as e: # Catching HTTP error
    print('Error')
    print('Status Code: {0}'.format(r.status_code))
    print(r.text)
except requests.exceptions.Timeout as e: # Cathing Timeout
    print('Timeout')

As you see in the code, the Response object that requests.post () returns contains status code in the instance variable, status_code. In the code example, if there is no HTTP error, the stdout is as follows.

Headers: 
{'User-Agent': 'python-requests/2.21.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'Content-Length': '72753', 'Content-Type': 'multipart/form-data; boundary=bf3a1ec648ccb798d9a9c6a914d77c81'}
Status Code: 200
151

However, if there is an HTTP error, an HTTPError exception is thrown when Response.raise_for_status () is executed.

Error
Status Code: 400
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><message-start-event-errors><error><key>key</key><detail>Invalid API Key</detail></error></message-start-event-errors>

In the case above, the HTTP status code 400 “Bad Request” is returned from the Message Start Event (HTTP) API. For the meaning of each HTTP status code, refer to the following “Major HTTP status code list“.

Major HTTP status code list

Status code Description
200 “OK”. The request has been accepted by Message Start Event (HTTP) successfully. The ID of the started Process is returned in plain texts.
400 “Bad Request”. The request is incorrect. Check the undermentioned response body, and correct the data to be transmitted.
403 “Forbidden”.Do not have the access authority. Confirm whether access from the IP address you are using is permitted. To set up access authority, move to [IP Address Filtering] in [System Setting]. Also, you can check the IP address which is permitted to access the event on the detail page of each Message Start Event (HTTP).
404 “Not Found”. The resource does not exist in the destination specified by the URL. Confirm whether the URL is wrong.
500, 502, 503, 504, etc. The request is not processed because of a problem on the server side, such as overloaded or down. Please wait for a while and try sending again. If you do not solve the problem after a while, please contact support.
When sending large data, HTTP status code 100 “Continue” may be returned. This indicates that data transmission is in progress and at this point, the request has not been completed yet. As an HTTP status code will be returned when the data transmission is completed, so please confirm the transmission result in it.

To look into the error message

If the HTTP status code indicates 400, there is something wrong with the data sent by the client (user). Please review and make corrections the error message returned by the message start event (HTTP) API. Error messages are stored in the response body.

For curl command

In the case of the curl command, the response body is stdout by default. For example, as mentioned in the HTTP status code section, the following XML data is displayed. (In order to make it easier to read, I have put line feeds as appropriate in this.)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<message-start-event-errors>
<error>
<key>q_str</key>
<detail>5 or more characters required.</detail>
</error>
<error>
<key>q_selects</key>
<detail>Select more than one.</detail>
</error>
</message-start-event-errors>

What is written in between <key> and </key> is the parameter name which returned the error, written in between <detail> and </detail> is the content of the error. In the case above, error messages that are

  • “5 or more characters required.” from “q_str” (String type Data Item)
  • “Select more than one.” from “q_selects” (Select type Data Item)

are returned.

For Python 3 (utilizing Request package)

The response body is stored in the instance variable text of the Requests object. In the code example, XML data is displayed by stdout as with the curl command chapter.

Troubleshooting by error message

In case if no error has occurred but the Process does not start, please check the HTTP status code. For the meaning of each HTTP status code, refer to the “Major HTTP status code list“.
processModelInfold, nodeNumber – “not found”
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<message-start-event-errors>
<error>
<key>processModelInfoId</key>
<detail>not found</detail>
</error>
</message-start-event-errors>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<message-start-event-errors>
<error>
<key>nodeNumber</key>
<detail>not found</detail>
</error>
</message-start-event-errors>

Specified App or node does not exist. processModelInfold for App, nodeNumber for node. Confirm whether the specified number is wrong.

If nodeNumber returns “not found”, it may be the case as a result of referring to another App because processModelInfold is incorrect.

nodeNumber – “not start event (HTTP)”
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<message-start-event-errors>
<error>
<key>nodeNumber</key>
<detail>not start event (HTTP)</detail>
</error>
</message-start-event-errors>

The specified node is not Message Start Event. Confirm whether the value of processModelInfold and nodeNumber is incorrect.

key – “Invalid API key”
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<message-start-event-errors>
<error>
<key>key</key>
<detail>Invalid API Key</detail>
</error>
</message-start-event-errors>

The API key is invalid. Confirm whether the API key is incorrect.

Others

There are various cases in the error message. Even so, an error message would concretely instruct the solution, such as, for example, “the number of characters must be n characters or more” that is returned by a String type Data Item. If you get an error message, you need to confirm the contents of message and Data Item Settings.

2 thoughts on “Starting a Process from Outside of Questetra BPM Suite (Error-handling Chapter)”

  1. Pingback: Starting a Process from Outside of Questetra BPM Suite (Python Chapter) – Questetra Support

  2. Pingback: Message Start Event (HTTP) – Questetra Support

Comments are closed.

%d bloggers like this: