Home > Net >  Give me a interface, a url, how to push the data in the past?
Give me a interface, a url, how to push the data in the past?

Time:09-30

The URL address: http://XXX.XXX.XXX.XXX
Parameter of type
Organizes the List with five field values (organizeCode organizeName, parentCode, corpCode) from the database detected data on my side
AppKey String
Sign the String
Timestamp Long
Return parameter description:
The return type: List
If successful sync and returns a organizeCode as the key, the 32-bit uuid for the value of the Map, if the synchronization failure the corresponding value reference information for error

Can you tell me how to write?

Now only know the url on the web. Config in
In the CS file
.Private string postString=System. The Configuration. The ConfigurationManager. AppSettings [r]. "urlStrings" ToString ();


CodePudding user response:

Simulated HTTP request is submitted

CodePudding user response:

What concept of push,,,
Just pass arguments, you first know each other a json or XML parameter, and then a data format to give him good

CodePudding user response:

http://XXX.XXX.XXX.XXX? Organizes=xxx& AppKey=XXX,
Turn json objects are generally

CodePudding user response:

refer to the second floor is nu month god reply:
what push concept,,,
Just pass arguments, you first know each other a json or XML parameter, and then a data format to give him a good

Thank god's guidance, I look for the other party under the ~

CodePudding user response:

The
reference 3 floor hands on the keyboard to knock very light response:
http://XXX.XXX.XXX.XXX? Organizes=xxx& AppKey=XXX,
Objects are generally turn json

Is indeed a Json format, just confirm ~

CodePudding user response:

Look at the WebAPI request two ways, Post/Get
Also can download a Postman simulation request interface

CodePudding user response:

refer to the second floor is nu month god reply:
what push concept,,,
Just pass arguments, you first know each other a json or XML parameter, and then a data format to give him a good

Is there any code can consult? A great god

CodePudding user response:

refer to 7th floor weixin_42559302 response:
Quote: refer to the second floor is nu month god reply:

What concept of push,,,
Just pass arguments, you first know each other a json or XML parameter, and then a data format to give him a good

Is there any code can consult? The great spirit

This is a c # backstage access webapi
https://blog.csdn.net/hanjun0612/article/details/60126445
This is the ajax access webapi
https://blog.csdn.net/hanjun0612/article/details/51918059

CodePudding user response:

Interface, if you didn't have written this, is very troublesome drop... Each interface is different, or get help the people in the project

CodePudding user response:

Give you a simulation of the HTTP request method, if the request parameters as json, should be post submission,

Public static void Post (url string, the string strRequestData, out string result)
{
Result=string. The Empty;

HttpWebRequest request=null;
HttpWebResponse response=null;
StreamWriter reqStream=null;
The Stream respStream=null;
StreamReader reader=null;

Try
{
Request=(HttpWebRequest) HttpWebRequest. Create (url);

Request. The Method="POST";
Request. The ContentType="application/x - WWW - form - urlencoded";
ReqStream=new StreamWriter (request. GetRequestStream ());
ReqStream. Write (strRequestData);
ReqStream. Close ();

The response=(HttpWebResponse) request. The method GetResponse ();
RespStream=response. GetResponseStream ();
Reader=new StreamReader (respStream, Encoding UTF8);
RespStream. Flush ();

Result=reader. ReadToEnd ();
}
The catch (Exception ex)
{
//the log
}
The finally
{
If (request!=null)
Request. The Abort ();

if (response !=null)
The response. The Close ();

If (reqStream!=null)
ReqStream. Close ();

If (reader!=null)
Reader. The Close ();
}
}

CodePudding user response:

The ah, such as through ajax
Var temp={
"IsSuper" : 1,
"RoleCode" : "'
"RoleDesc" : $(" # txtMeetingDesc "). Val (),
"RoleName" : $(" # input - 6 "). Val ()
}
//alert (JSON. Stringify (temp));
Var saveRoleUrl=getSaveRole ();
$. Ajax ({
Type: "post",
Url: saveRoleUrl,
ContentType: "application/json,"
Data: JSON. Stringify (temp),
BeforeSend: function (XHR) {
XHR. SetRequestHeader (" token ", token);
},
XhrFields: {
WithCredentials: true
},
CrossDomain: true,
Success: the function (MSG) {
If (MSG. Code==200) {
Alert (" success ");
//return interface
Window. The location. Href="https://bbs.csdn.net/topics/roleManagement.html";
}
The else {
Alert (MSG. Message);
}

},
Error: function (MSG) {
Alert (" system error ");
}
})
  • Related