Regarding special characters and spaces in APIs

For requests or help with our API
Post Reply
beacondental
Posts: 92
Joined: Wed Mar 15, 2023 8:43 am

Regarding special characters and spaces in APIs

Post by beacondental » Tue Nov 07, 2023 2:01 am

Hello Team,

I am using Patient's simple GET API: "GET /patients/Simple?LName=smi&FName=eter&Birthdate=1976-05-24"

While incorporating this into my Java code, I encountered a scenario where there was a space in the first name. My code automatically converted that space into '%20', which resulted in incorrect results. Upon retaining the space as it is, the API worked as expected.

Could you please provide some insight into how different scenarios, especially involving spaces and special characters, are managed? This information will help me write bug-free and error-resistant code.


Thanks and regards,
GV-Opendental

DerekR
Posts: 81
Joined: Wed Aug 31, 2022 1:13 pm

Re: Regarding special characters and spaces in APIs

Post by DerekR » Tue Nov 07, 2023 9:37 am

Good Morning beacondental,

From our API Implementation page, in the "Data Types" section, we have listed that the JSON serializer may have issues with complex text. Our API methods are intended to match the functionality of Open Dental, including how whitespaces and special characters are handled.

When testing out the scenario you are describing with the Patients GET (Simple) I was able to use both whitespace and %20 to achieve the same results.

When your code converted the space into %20, did it also include the single quotation marks? In that scenario, I was not able to achieve the same results because the single quotation marks were included as part of the string, while the %20 was deserialized as a single whitespace. If that is the case, then I would recommend that in the future, instead of '%20', ensure it is converting to %20 with no single quotation marks.

Thanks!

Post Reply