API Integration Tools and Examples
|
API Integration Tools and Examples with Source Code
API integration tools and tutorial examples
|
Use of API integration in software solutions
|
Learn how to use of API technology for development and data interchange.
JSON javascript shell PowerShell python curl C C# C++ HTTP Java Go Objective-C R Swift
|
API use in shell
curl --request POST \
--url https://tecni.com/tech/api-person-search.php \
--header 'Accept: application/json'
--data-raw '{
"id": "1234567890",
"callbackUrl": "{{callback_URL}}"
}'
|
API use in python
python -m pip install requests
import requests
url = "https://tecni.com/tech/api-person-search.php"
headers = {
"accept": "application/json",
"content-type": "application/json",
"authorization": "Bearer [object Object]"
}
response = requests.post(url, headers=headers)
print(response.text)
|
API use in Powershell
$headers=@{}
$headers.Add("accept", "application/json")
$headers.Add("content-type", "application/json")
$headers.Add("authorization", "Bearer [object Object]")
$response = Invoke-WebRequest -Uri 'https://tecni.com/tech/api-person-search.php' -Method POST -Headers $headers
|
API use in javascript
const options = {
method: 'POST',
headers: {
accept: 'application/json',
'content-type': 'application/json',
authorization: 'Bearer [object Object]'
}
};
fetch('https://tecni.com/tech/api-person-search.php', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
|
API use in C# / DotNet
C# / dotnet add package RestSharp
using RestSharp;
var options = new RestClientOptions("https://tecni.com/tech/api-person-search.php");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "Bearer [object Object]");
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
|
API use in HTTP
POST /tech/api-person-search.php HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer [object Object]
Host: tecni.com
|
API use in node.js
import mati from '@api/mati';
mati.auth('[object Object]');
mati.techCostaRicaTse()
.then(({ data }) => console.log(data))
.catch(err => console.error(err));
|
API use in C
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://tecni.com/tech/api-person-search.php");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "accept: application/json");
headers = curl_slist_append(headers, "content-type: application/json");
headers = curl_slist_append(headers, "authorization: Bearer [object Object]");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
|
API use in java
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://tecni.com/tech/api-person-search.php")
.post(null)
.addHeader("accept", "application/json")
.addHeader("content-type", "application/json")
.addHeader("authorization", "Bearer [object Object]")
.build();
Response response = client.newCall(request).execute();
|
API use in PHP
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://tecni.com/tech/api-person-search.php', [
'headers' => [
'accept' => 'application/json',
'authorization' => 'Bearer [object Object]',
'content-type' => 'application/json',
],
]);
echo $response->getBody();
|
API use in GO
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://tecni.com/tech/api-person-search.php"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("accept", "application/json")
req.Header.Add("content-type", "application/json")
req.Header.Add("authorization", "Bearer [object Object]")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
|
API use in RUBY
require 'uri'
require 'net/http'
url = URI("https://tecni.com/tech/api-person-search.php")
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["authorization"] = 'Bearer [object Object]'
response = http.request(request)
puts response.read_body
|
API use in R
library(httr)
url < - "https://tecni.com/tech/api-person-search.php"
response < - VERB("POST", url,
add_headers("authorization" = "Bearer [object Object]"),
content_type("application/octet-stream"),
accept("application/json"))
content(response, "text")
|
API use in Objetive-C
#import < Foundation/Foundation.h >
NSDictionary *headers = @{ @"accept": @"application/json",
@"content-type": @"application/json",
@"authorization": @"Bearer [object Object]" };
NSMutableURLRequest *request = [
NSMutableURLRequest requestWithURL:[
NSURL URLWithString:@"https://tecni.com/tech/api-person-search.php"
]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
|
API use in swift
import Foundation
let url = URL(string: "https://tecni.com/tech/api-person-search.php")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.timeoutInterval = 10
request.allHTTPHeaderFields = [
"accept": "application/json",
"content-type": "application/json",
"authorization": "Bearer [object Object]"
]
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))
|