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

An error returned from the API!

You will probably encounter a situation while you are dealing with the Message Start Event (HTTP) API when you might think “I don’t know why, but it doesn’t work”. In this article, I will explain the errors returned by the Message Start Event (HTTP) API.

How to check for errors

Please check the HTTP status code and the error message returned by the API in the event that the Process does not start even though Message Start Event (HTTP) was accessed. You can roughly tell where an error occurred with the HTTP status code, and the API error message points out what needs to be fixed when the client (user) side has a deficiency.

Check the HTTP status code

For curl command

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

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

For example, a response header will be like the following.

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 400s and 500s 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 the Major HTTP status code list.

For Python 3 (utilizing Request package)

The code example shown in the Python chapter has been designed so the HTTP status code will 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 the 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 HTTP Error 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 text.
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 Settings]. 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 being 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 a large amount of data the 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, please check the transmission results.

Check the error message

If the HTTP status code indicates 400 then there is something wrong with the data sent by the client (user). Please review and make corrections to 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 curl commands 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 inserted line feeds as appropriate.)

<?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>

Between <key> and </key> is the parameter name which returned the error, and between <detail> and </detail> is the content of the error. In the case above, the following error messages are returned.

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

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


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>

The specified App or node does not exist. In the case of processModelInfold it is an App, and nodeNumber for a node. Confirm whether the specified number is wrong.

If nodeNumber returns “not found”, it may be referring to another App because the 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 a Message Start Event. Confirm that the value of processModelInfold and nodeNumber is correct.

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 types of error messages. Even so, an error message would specifically instruct the solution, such as for example, “the number of characters must be n characters or more” for a String-type Data Item. If a specific error message is returned, check the contents of the message and the Data Item Settings.

Discover more from Questetra Support

Subscribe now to keep reading and get access to the full archive.

Continue reading

Scroll to Top