How do I work with Api of New Mail?

Good afternoon. I need to make a order form where if you select city, in another impute when you enter the streets will be filled prompts of street names. I have to use API of New Mail. Documentation
I've never done this before. Request code they looks like this -
{
"modelName": "Address",
"calledMethod": "getCities",
"methodProperties": {
"Ref": "ebc0eda9-93ec-11e3-b441-0050568002cf"
},
"apiKey": "[YOUR KEY]"
}

And the answer
{
"modelName": "Address",
"calledMethod": "getCities",
"methodProperties": {
"Ref": "ebc0eda9-93ec-11e3-b441-0050568002cf"
},
"apiKey": "[YOUR KEY]"
}

59d9d4b0a3539684355964.png
Where should I move?
June 14th 19 at 19:01
2 answers
June 14th 19 at 19:03
Solution
It turned out I correctly formulated request.
June 14th 19 at 19:05
As I understand it in the object methodProperties You need to add the key "FindByString": "", prescribe a city that You need and pass the request
Roughly, it looks like this:
{
"modelName": "Address",
"calledMethod": "getCities",
"methodProperties": {
"Ref": "ebc0eda9-93ec-11e3-b441-0050568002cf",
"FindByString": Prescribe here the city 
},
"apiKey": "[YOUR KEY]"
}
And as safegate with the shame of entering the names of cities? So, for example, would, when administered to -"Days" creaking tells the name of the city is Dnipro ? - mohammed_Schmidt67 commented on June 14th 19 at 19:08
and he knows that? If able, keep track of what changed in input value and each change in the input, send a request.
Here's something similar: https://api.jquery.com/keypress/ - clark.Wiso commented on June 14th 19 at 19:11
I made a template to play with the API for new mail, and early - to connect .



 <meta charset="UTF-8">
 <title>Working with Pochta Api</title>
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
 <script src="script.js"></script> 


 <div id="text_test">



</div>




$(function(){
 var $texts=$('#text_test');
$.ajax({
 type: "GET",
 url: "https://api.novaposhta.ua/json",
 "modelName": "Address",
 "calledMethod": "searchSettlements",
 "methodProperties": {
 "CityName": "Ki",
 "Limit": 555
},
 "apiKey": "f11a8e14401ddcf710f7195b4ebe358c",
 success: function(texts){
 $.each(texts, function(i, text){
 $.orders.append('<li> Town or village:'+text.SettlementTypeCode+',Name:'+text.MainDescription+'</li>');
});
}
});

})

This thing doesn't work. It Failed to load https://api.novaposhta.ua/json: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. - mohammed_Schmidt67 commented on June 14th 19 at 19:14
blocked access, the campaign is not correctly specified data on your website. I don't know how the API of new mail) - clark.Wiso commented on June 14th 19 at 19:17

Find more questions by tags APIJavaScriptjQueryWeb Development