How was the area where you were stopped marked? No parking, no standing, or no stopping? When you say that you were on the curb and sidewalk do you mean that the tires of your vehicle were up on the sidewalk? How long had you been stopped there when the officer approached your car and what were doing while stopped there?
A couple of things for you to know. First, New York City ordinances make it illegal to stop, stand, or park on the sidewalk. If your tires were on the sidewalk, you were illegally parked and that would justify a parking citation right there. See Traffic Rule 4-08(e)(3).
Second, the ordinance definitions parking, standing, and stopping all can apply even when you are still in your car. Simply arguing that you had not got out of your car may not suffice to beat the ticket. The general rules are found in Traffic Rules section 4-08(a) as follows:
(2) Stopping prohibited. When stopping is prohibited by signs or rules, no person shall stop, stand or park a vehicle, whether attended or unattended.
(3) Standing prohibited. When standing is prohibited by signs or rules, no person shall stop a vehicle, attended or unattended, except temporarily for the purpose of and while actually engaged in expeditiously receiving or discharging passengers.
(4) Parking prohibited. When parking is prohibited by signs or rules, no person shall stop a vehicle, attended or unattended, except temporarily for the purpose of and while expeditiously receiving or discharging passengers or loading or unloading property to or from the curb.
You can read all the parking rules here: New York Traffic Rules. The parking rules start on page 29. If you are not sure what the parking restrictions were where you were located when you were stopped, New York has a web site that will tell you what the restrictions were for each block in the city, either by using a map or by specifying the location with text. You can access that here: traffic restrictions by location.
With that information, you hopefully can figure out if the ticket is good and whether you have a basis for fighting it. Note that the officer’s demeanor is not relevant to the ticket. He doesn’t have to be nice or pleasant for the ticket to be good. Taking your keys, whether or not that was proper for the officer to do, also doesn’t have any impact on whether the parking citation is good. You’ll need to focus on whether you were in fact illegally parking, standing, or stopping as the case may be. If you weren’t, you need to figure out how to convince the court of that if you contest it.