Create domain web forward

Description

POST https://api.netim.com/rest/1.0/domain/{fqdn}/web-forwarding/

Create a web forward.

URL Parameters

  • {fqdn}
    Hostname (Fully qualified domain name).

Headers

  • Authorization
    string

    The Autorization header must start with “Bearer ” followed by the session ID.
    Example:”Autorization: Bearer b0f13a3c01d9cce2a9a44cd729f81c26″

  • Content-type
    string

    Content type of the request

    Only “application/json” is accepted

Body

REQUIRED


  • target
    string
    (255)
    Target of the web forward.
  • type
    string
    Type of the web forward (DIRECT / MASKED / PARKING).
  • options
    object
    (StructOptionsFwd)
    Settings of the web forward as StructOptionsFwd object.

JSON example

{
	"target":"example.com",
	"type":"DIRECT",
	"options":{
		"header":301,
		"protocol":"http",
		"title":null,
		"parking":null,
	},
}

Common language examples

<?php
 
	$ch = curl_init();
 
	$body = array(
		"target" => "example.com",
		"type" => "DIRECT",
		"options" => array(
			"header" => 301,
			"protocol" => "http",
			"title" => null,
			"parking" => null,
		),
	);
 
	curl_setopt($ch, CURLOPT_URL,"https://api.netim.com/rest/1.0/domain/$fqdn/web-forwarding/");
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
	curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: Bearer $sessionID", "Content-type: application/json"]);
	curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
	curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body));
 
	$result = json_decode(curl_exec ($ch), true);
	$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
	curl_close ($ch);
 
import java.util.Base64;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
 
public class Example {
 
	public static void main(String args[]) throws Exception {
		String sessionID = "12345678";
		String fqdn= "www.example.com";
 
		String body= "{"target":"example.com","type":"DIRECT","options":{"header":301,"protocol":"http","title":null,"parking":null,},}";
 
		HttpClient client = HttpClient.newHttpClient();
		HttpRequest request = HttpRequest.newBuilder()
			.uri(URI.create("https://api.netim.com/rest/1.0/domain/" + fqdn+ "/web-forwarding/"))
			.method("POST", HttpRequest.BodyPublishers.ofString(body))
			.header("Content-Type", "application/json")
			.header("Accept-Language", "EN")
			.header("Authorization", "Bearer " + sessionID)
			.build();
		HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
 
		String result = response.body().toString();
	}
}
#!/usr/bin/python3
 
import json
import requests
 
domain = 'www.example.com'
 
url = 'https://api.netim.com/rest/1.0/domain/' + fqdn+ '/web-forwarding/'
 
data = {
	"target":"example.com",
	"type":"DIRECT",
	"options":{
		"header":301,
		"protocol":"http",
		"title":None,
		"parking":None,
	},
}
 
sessionId = "1234567"
 
headers = {"Authorization": "Bearer " + sessionId, "Content-Type": "application/json"}
 
 
response = requests.post(url, headers=headers, data=data)
curl -X POST https://api.netim.com/rest/1.0/domain/www.example.com/web-forwarding/ 
-H 'Authorization: Bearer b0f13a3c01d9cce2a9a44cd729f81c26=' 
-H 'Content-type: application/json' 
-d '{"target":"example.com","type":"DIRECT","options":"header":301,"protocol":"http","title":null,"parking":null,},}'

Need an API Client?
Speed up your integration by using our API client for SOAP