| const options = { |
| method: 'POST', |
| headers: {accept: 'application/json', 'content-type': 'application/json'}, |
| body: JSON.stringify({type: 'text', recipient_type: 'individual'}) |
| }; |
| |
| fetch('https://apis.cequens.com/conversation/wab/v1/messages/', options) |
| .then(response => response.json()) |
| .then(response => console.log(response)) |
| .catch(err => console.error(err)); |
| require 'uri' |
| require 'net/http' |
| |
| url = URI("https://apis.cequens.com/conversation/wab/v1/messages/") |
| |
| http = Net::HTTP.new(url.host, url.port) |
| http.use_ssl = true |
| |
| request = Net::HTTP::Post.new(url) |
| request["accept"] = 'application/json' |
| request["content-type"] = 'application/json' |
| request.body = "{\"type\":\"text\",\"recipient_type\":\"individual\"}" |
| |
| response = http.request(request) |
| puts response.read_body |
| request('POST', 'https://apis.cequens.com/conversation/wab/v1/messages/', [ |
| 'body' => '{"type":"text","recipient_type":"individual"}', |
| 'headers' => [ |
| 'accept' => 'application/json', |
| 'content-type' => 'application/json', |
| ], |
| ]); |
| |
| echo $response->getBody(); |
| import requests |
| |
| url = "https://apis.cequens.com/conversation/wab/v1/messages/" |
| |
| payload = { |
| "type": "text", |
| "recipient_type": "individual" |
| } |
| headers = { |
| "accept": "application/json", |
| "content-type": "application/json" |
| } |
| |
| response = requests.post(url, json=payload, headers=headers) |
| |
| print(response.text) |
| using RestSharp; |
| |
| |
| var options = new RestClientOptions("https://apis.cequens.com/conversation/wab/v1/messages/"); |
| var client = new RestClient(options); |
| var request = new RestRequest(""); |
| request.AddHeader("accept", "application/json"); |
| request.AddJsonBody("{\"type\":\"text\",\"recipient_type\":\"individual\"}", false); |
| var response = await client.PostAsync(request); |
| |
| Console.WriteLine("{0}", response.Content); |
| OkHttpClient client = new OkHttpClient(); |
| |
| MediaType mediaType = MediaType.parse("application/json"); |
| RequestBody body = RequestBody.create(mediaType, "{\"type\":\"text\",\"recipient_type\":\"individual\"}"); |
| Request request = new Request.Builder() |
| .url("https://apis.cequens.com/conversation/wab/v1/messages/") |
| .post(body) |
| .addHeader("accept", "application/json") |
| .addHeader("content-type", "application/json") |
| .build(); |
| |
| Response response = client.newCall(request).execute(); |
| package main |
| |
| import ( |
| "fmt" |
| "strings" |
| "net/http" |
| "io" |
| ) |
| |
| func main() { |
| |
| url := "https://apis.cequens.com/conversation/wab/v1/messages/" |
| |
| payload := strings.NewReader("{\"type\":\"text\",\"recipient_type\":\"individual\"}") |
| |
| req, _ := http.NewRequest("POST", url, payload) |
| |
| req.Header.Add("accept", "application/json") |
| req.Header.Add("content-type", "application/json") |
| |
| res, _ := http.DefaultClient.Do(req) |
| |
| defer res.Body.Close() |
| body, _ := io.ReadAll(res.Body) |
| |
| fmt.Println(string(body)) |
| |
| } |