HTTPS POST程序样例1

用于工业标识解析体系数据上传样例

//获取token var url='http://119.96.251.21:8081/identity/token'; var username="testuser"; var password="123456@"; var SendMessage='{"username":"'+username+'","password":"'+password+'"}'; alert('SendMessage='+SendMessage); var Re=HttpPost(url,'application/json;charset=utf-8',SendMessage); alert('获取token响应='+Re); var status = GetJSONData(Re,'status'); alert('status='+status); var message = GetJSONData(Re,'message'); alert('message='+message); var token = GetJSONData(Re,'token'); alert('token='+token); //发送标识 if(message=="success") { var url='http://127.0.0.1:8081/identity/data'; var handle="88.175.985/II0006"; var value1=ReadFromTag('Name'); alert('value1='+value1); var SendMessage='{"handle": "'+handle+'",'+ '"templateVersion": "test",'+ '"id": "1111",'+ '"prefix": "88.175.985",'+ '"value": ['+ '{"data": '+ '{"format": "string","value":"'+value1+'"},'+ '"index": "2001",'+ '"type": "yavData"'+ '}'+ ']'+ '}'; alert('SendMessage='+SendMessage); var Re=HttpPost(url,'application/json'+"\r\n"+"Authorization:"+token,SendMessage); alert('注册响应='+Re); }
2023-10-25
1 0