PractiTest Discussion Forum

API posts requests don't accept any accent

Good afternoon,

I made some posts through Practitest API and when we put any accent in the json post in “description” or “expected-results” or “actual-results” the post request fail.

It would be possible to fix it to avoid any problems when we work in our case in french which gets accents ?

Thank you in advance for your help and your answer.

Best regards.

Hello Thomas,
Can you please provide us the exact data:

  • A request itself
  • a data sent in a request?

We’ll investigate and get back to you with the results.

Thank you,
Alex from PractiTest

Hello Alex,

For exemple if I post this json, it fails due to french accents :

{“data”: {
“type”: “instances”,
“attributes”: {
“instance-id”: id},
“steps”: {“data”:
[{ “name”: “Connexion”,
“expected-results” : “Résultat attendu connexion”,
“actual-results”: “Connexion avec succès”,
“status”: “PASSED”}]
}
}
}

I have voluntary put id instead the exact numeric value for instance-id.
When I try to post it I get an error 500 Server internal error

Thank you in advance for your help.

Best regards,

Hello Thomas,
The issue with this specific request was not the accent letters. Moreover, I can confirm that these letters can be part of any text values in API request.

The issue in this request was a different type of double quotation marks in the actual results row - both in “actual-results”, and the value itself. It is different from expected results row as well.
This type of quotation marks you’re using there comes in conflict with json format.

Please adjust the marks and let us know if the issue persists.
If it does, please send us the data again.

Additional reason for 500 error can be just a slight misconnection between our servers and yours. In this case, resending of a request should be successful.

Alex

Hello Alex,

I send you a screenshot with the double quotation used to analyze better with you, I have used the same as mentionned in API Practitest documentation and it fails.
I have tried to use simple quotation and it follows failing.

In mi screenshot I have hidden and cut the token.

Could you specify exactly what’s wrong ? → accent put in “actual-results” line for trying.

Thank you in advance for your support.

Best regards,

Thomas

Hello Thomas,
The “Bad Request” error usually leads to something incorrect with the json/request structure.

  1. Can you please once more send the full data in a json AND the request itself?
  2. Can you please try to send the request via cURL or Postman and see if the results are the same?

Thank you.

Alex from PractiTest

Hello Alex,

I give you here the request :

https://api.practitest.com/api/v2/projects/25419/runs.json?api_token=########################################

I paste here the json file because the forum doesn’t authorize to put json file nor text file in attachment :

{“data”: {
“type”: “instances”,
“attributes”: {
“instance-id”: ########},
“steps”: {“data”:
[{ “name”: “Connexion”,
“description” : “Description connexion”,
“expected-results” : “Resultat attendu connexion”,
“actual-results”: “Connexion avec succes”,
“status”: “PASSED”},

		  {  "name": "Action",
		    "description" : "Description action",
			"expected-results" : "Resultat attendu action",		
			"actual-results": "Action ko", 
		    "status": "PASSED"},

		  {  "name": "Deconnexion",
		    "description" : "Description deconnexion",
			"expected-results" : "Resultat attendu deconnexion",		
			"actual-results": "Deconnexion avec succes", 
		    "status": "PASSED"},
		    
		  {  "name": "Step supplementaire",
		    "description" : "Description step supplementaire",
			"expected-results" : "Resultat attendu step supplementaire",		
			"actual-results": "resultat actuel step supplémentaire", 
		    "status": "PASSED"}
		    ] 
		    }
		}

}

There is no subjects about json format because when I try the same request that I put in the json file (which contains the accent), the same test without any accent works perfectly and I could post some results in this way : putting accent cause a request error.

Thank you in advance for your support.

Thomas.

Hello Thomas,
Again the same issue with the quotations.
The first part of a json was with the incorrect quotes. I needed to fix them all in the Postman and the run passed successfully, with all the relevant accent:

I believe that you should contact our Customer Support for the session, during which they can analyze online what exactly is going wrong and fix accordingly.