Resultcode 400 when inserting (POST) or updating (PUT) assets to Jira Asset

We use Jira Asset to handle our ITIL changes. Now we want to synchronize our Jira Asstes with the architecture management tool LeanIX and I began to use the REST API to handle the updates.

I tried to create new attributes or to change attributes using the endpoint “PUT /rest/assets/{version}/object/{id}” or “POST /rest/assets/{version}/object/create” in our Jira Server installation. I used Python with the requests package.

Everthing works quite fine when I tested with the first objects and attributes, also requesting objects was easy.

But when I started the tests with little bigger batches (about 10 objects with inserts or updates for 2 or 3 attributes), I got an result code

400: "requests.exceptions.HTTPError: 400 Client Error: for url:

Because of the client error I looked very detailed to all the calls and JSON structures to be sure, that there are no mistakes - even if it worked fine before with the same code.

After some hours of seeking I got an idea: after each POST and PUT I waited some time in my code - between 0,3 and 3 seconds each transaction. From about 0.8 seconds upwards everything works fine again and I can update and insert without errors.

I assume, Insight/Jira writes new data asynchronously to the database and the write process of the new data did not yet finish. So, it would prefer to get an “202 Accepted” instead and an API endpoint to check if the server is still working (or an result code “201 Created” after finishing the write process.

But if the design is as it is for now: Is there any option to retrieve, if the server is still busy? The wating routine is not what I like and it is not so stable for daily synchronizazion jobs …

It tried with “GET /rest/assets/{version}/progress/category/{category}/{resourceid}”, but this endpoint answers always status=NONE

category=insight-reindex, REST-Returncode: 200 {‘progressInPercent’: -1, ‘status’: ‘NONE’, ‘currentWorkUnits’: 0, ‘currentStepTotalWorkUnits’: 0, ‘totalWorkUnits’: 0, ‘result’: ‘OK’}
category=async-task, REST-Returncode: 200: {‘progressInPercent’: -1, ‘status’: ‘NONE’, ‘currentWorkUnits’: 0, ‘currentStepTotalWorkUnits’: 0, ‘totalWorkUnits’: 0, ‘result’: ‘OK’}
category=cache-query, REST-Returncode: 200. {‘progressInPercent’: -1, ‘status’: ‘NONE’, ‘currentWorkUnits’: 0, ‘currentStepTotalWorkUnits’: 0, ‘totalWorkUnits’: 0, ‘result’: ‘OK’}

Thanks for any help or ideas, Ulrich

1 Like