Beschreibung:
Sendet eine http-Post-Request und empfängt die Antwort.
VBScript:
<!--#include-once file="...\Scripts\v_JSON\v_Script.vbs"-->
<!--#include-once file="...\Scripts\v_JSON\v_JSON.vbs"-->
Const sURL = "https://httpbin.org/post"
Const sHeader = "[{""key"": ""cumstom_key"", ""value"": ""custom_value""}, {""key"": ""Content-Type"", ""value"": ""application/json""}]"
Const sData = "[{""key"": ""test_key"", ""value"": ""test_value""}]"
Dim sAnswer : sAnswer = cRM.HTTPPost(sURL, sHeader, sData)
Set json = New v_JSON
Call json.FromString(sAnswer)
MsgBox "Statuscode: " & CStr(json.Item("status"))
MsgBox "Response: " & json.Item("response")
C#-Script:
//<!--#include-once file=@"...\Scripts\v_JSON\v_Script.vbs"-->
//<!--#include-once file=@"...\Scripts\v_JSON\v_JSON.vbs"-->
using System.Windows.Forms;
using combit.cRM.COM;
using Newtonsoft.Json;
cRMApplication cRM = new cRMApplication(EApplicationStartType.GetActiveobject);
string url = "https://httpbin.org/post";
string header = @"[{""key"": ""cumstom_key"", ""value"": ""custom_value""}, {""key"": ""Content-Type"", ""value"": ""application/json""}]";
string data = @"[{""key"": ""test_key"", ""value"": ""test_value""}]";
string answer = cRM.HTTPPost(url, header, data);
var responseDefinition = new { status = 0, response = ""};
var response = JsonConvert.DeserializeAnonymousType(answer, responseDefinition);
MessageBox.Show(response.status.ToString());
MessageBox.Show(response.response);
TypeScript:
import { cRM } from "./sdk/combitCRM.SDK.WindowsClient.v13";
//<!--#include-once file=@"...\Scripts\v_JSON\v_Script.vbs"-->
//<!--#include-once file=@"...\Scripts\v_JSON\v_JSON.vbs"-->
const url : string = "https://httpbin.org/post";
const header : string = `[{""key"": ""cumstom_key"", ""value"": ""custom_value""}, {""key"": ""Content-Type"", ""value"": ""application/json""}]`;
const data : string = `[{""key"": ""test_key"", ""value"": ""test_value""}]`;
const answer : string = cRM.HTTPPost(url, header, data);
var response =JSON.parse(answer);
let responseStatus : number = response.status;
let responseResponse : string = response.response;
cRM.DialogMessageBox(responseStatus.toString(), "Response Status", 0);
cRM.DialogMessageBox(responseResponse, "Response", 0);