NAV Navbar
Wattics.com
shell ruby java python javascript
  • Introduction
  • Data Push API
  • Dashboard Management API
  • Introduction

    Welcome to the Wattics API! You can use our two APIs to push or manage your data stored in our Dashboard database.

    We have examples in Shell, Ruby, Java, Javascript, Python. You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.

    Data Push API

    Push Data

    curl --location --request POST 'https://web-collector.wattics.com/measurements/v2/unifiedjson/' \
    --header 'Content-Type: text/json' \
    --header 'Authorization: Basic encryptedCredential' \
    --data-raw '{ "id": "uniqueMeterId", "tsISO8601": "2019-06-02T00:00:00.000+00:00", "aP_1":1000.0, "pC_1":2000.0 }'
    
    require "uri"
    require "net/http"
    
    url = URI("https://web-collector.wattics.com/measurements/v2/unifiedjson/")
    
    https = Net::HTTP.new(url.host, url.port);
    https.use_ssl = true
    
    request = Net::HTTP::Post.new(url)
    request["Content-Type"] = "text/json"
    request["Authorization"] = "Basic encryptedCredential"
    request.body = "{ \"id\": \"uniqueMeterId\", \"tsISO8601\": \"2019-06-02T00:00:00.000+00:00\", \"aP_1\":1000.0, \"pC_1\":2000.0 }"
    
    response = https.request(request)
    puts response.read_body
    
    Unirest.setTimeouts(0, 0);
    HttpResponse<String> response = Unirest.post("https://web-collector.wattics.com/measurements/v2/unifiedjson/")
      .header("Content-Type", "text/json")
      .header("Authorization", "Basic encryptedCredential")
      .body("{ \"id\": \"uniqueMeterId\", \"tsISO8601\": \"2019-06-02T00:00:00.000+00:00\", \"aP_1\":1000.0, \"pC_1\":2000.0 }")
      .asString();
    
    import requests
    
    url = "https://web-collector.wattics.com/measurements/v2/unifiedjson/"
    
    payload = "{ \"id\": \"uniqueMeterId\", \"tsISO8601\": \"2019-06-02T00:00:00.000+00:00\", \"aP_1\":1000.0, \"pC_1\":2000.0 }"
    headers = {
      'Content-Type': 'text/json',
      'Authorization': 'Basic encryptedCredential'
    }
    
    response = requests.request("POST", url, headers=headers, data = payload)
    
    print(response.text.encode('utf8'))
    
    
    var data = "{ \"id\": \"uniqueMeterId\", \"tsISO8601\": \"2019-06-02T00:00:00.000+00:00\", \"aP_1\":1000.0, \"pC_1\":2000.0 }";
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function() {
      if(this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("POST", "https://web-collector.wattics.com/measurements/v2/unifiedjson/");
    xhr.setRequestHeader("Content-Type", "text/json");
    xhr.setRequestHeader("Authorization", "Basic encryptedCredential");
    
    xhr.send(data);
    

    This API request has a different endpoint and Authentication. You will need to have a special user and password credential that will be used in the HTTPS Authorization header.

    Once you have this credentials, you will need the unique Meter/Appliance ID that you want to send data to. It can be found in the Admin/Organizations section in your Dashboard.

    In the code example aside we are sending only two parameters: Active Power and Power Consumption. But you can send all parameters you want.

    HTTP Request

    POST https://web-collector.wattics.com/measurements/v2/unifiedjson/

    Available Parameters

    Parameter Description Optional
    id The unique Meter/Appliance ID NO
    tsISO8601 The data timestamp in ISO8601 format NO
    aP_1 Active Power phase 1 in (W) YES
    aP_2 Active Power phase 2 in (W) YES
    aP_3 Active Power phase 3 in (W) YES
    rP_1 Reactive Power phase 1 in (VA reactive) YES
    rP_2 Reactive Power phase 2 in (VA reactive) YES
    rP_3 Reactive Power phase 3 in (VA reactive) YES
    apP_1 Apparent Power phase 1 in (VA) YES
    apP_2 Apparent Power phase 2 in (VA) YES
    apP_3 Apparent Power phase 3 in (VA) YES
    v_1 Voltage phase 1 in (Volts) YES
    v_2 Voltage phase 2 in (Volts) YES
    v_3 Voltage phase 3 in (Volts) YES
    c_1 Current phase 1 in (Ampere) YES
    c_2 Current phase 2 in (Ampere) YES
    c_3 Current phase 3 in (Ampere) YES
    pC_1 Energy consumed since beginning in phase 1 in (Wh) YES
    pC_2 Energy consumed since beginning in phase 2 in (Wh) YES
    pC_3 Energy consumed since beginning in phase 3 in (Wh) YES
    v_12 Phase-To-Phase Voltage between phase 1 and 2 in (Volts) YES
    v_13 Phase-To-Phase Voltage between phase 1 and 3 in (Volts) YES
    v_23 Phase-To-Phase Voltage between phase 2 and 3 in (Volts) YES
    value For gas/water/numeric values (temperature, production, etc) YES

    Push Partial Data

    curl --location --request POST 'https://web-collector.wattics.com/measurements/v2/unifiedjson_partial/' \
    --header 'Content-Type: text/json' \
    --header 'Authorization: Basic encryptedCredential' \
    --data-raw '{ "id": "uniqueMeterId", "tsISO8601": "2019-06-02T00:00:00.000+00:00", "aP_1":1000.0, "pC_1":2000.0 }'
    
    require "uri"
    require "net/http"
    
    url = URI("https://web-collector.wattics.com/measurements/v2/unifiedjson_partial/")
    
    https = Net::HTTP.new(url.host, url.port);
    https.use_ssl = true
    
    request = Net::HTTP::Post.new(url)
    request["Content-Type"] = "text/json"
    request["Authorization"] = "Basic encryptedCredential"
    request.body = "{ \"id\": \"uniqueMeterId\", \"tsISO8601\": \"2019-06-02T00:00:00.000+00:00\", \"aP_1\":1000.0, \"pC_1\":2000.0 }"
    
    response = https.request(request)
    puts response.read_body
    
    Unirest.setTimeouts(0, 0);
    HttpResponse<String> response = Unirest.post("https://web-collector.wattics.com/measurements/v2/unifiedjson_partial/")
      .header("Content-Type", "text/json")
      .header("Authorization", "Basic encryptedCredential")
      .body("{ \"id\": \"uniqueMeterId\", \"tsISO8601\": \"2019-06-02T00:00:00.000+00:00\", \"aP_1\":1000.0, \"pC_1\":2000.0 }")
      .asString();
    
    import requests
    
    url = "https://web-collector.wattics.com/measurements/v2/unifiedjson_partial/"
    
    payload = "{ \"id\": \"uniqueMeterId\", \"tsISO8601\": \"2019-06-02T00:00:00.000+00:00\", \"aP_1\":1000.0, \"pC_1\":2000.0 }"
    headers = {
      'Content-Type': 'text/json',
      'Authorization': 'Basic encryptedCredential'
    }
    
    response = requests.request("POST", url, headers=headers, data = payload)
    
    print(response.text.encode('utf8'))
    
    
    var data = "{ \"id\": \"uniqueMeterId\", \"tsISO8601\": \"2019-06-02T00:00:00.000+00:00\", \"aP_1\":1000.0, \"pC_1\":2000.0 }";
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function() {
      if(this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("POST", "https://web-collector.wattics.com/measurements/v2/unifiedjson_partial/");
    xhr.setRequestHeader("Content-Type", "text/json");
    xhr.setRequestHeader("Authorization", "Basic encryptedCredential");
    
    xhr.send(data);
    

    The main difference between this endpoint and the regular Push Data is how the measurements are processed. On this endpoint the API waits until the timestamp changes to process the reading. In other words, it will aggregate the parameters (e.g.: pC_1, aP_1, etc) as if they were sent together, even if they are sent in different requests, and process this aggregated data once the timestamp changes.

    This API request has a different endpoint and Authentication. You will need to have a special user and password credential that will be used in the HTTPS Authorization header.

    Once you have this credentials, you will need the unique Meter/Appliance ID that you want to send data to. It can be found in the Admin/Organizations section in your Dashboard.

    In the code example aside we are sending only two parameters: Active Power and Power Consumption. But you can send all parameters you want.

    HTTP Request

    POST https://web-collector.wattics.com/measurements/v2/unifiedjson_partial/

    Available Parameters

    Parameter Description Optional
    id The unique Meter/Appliance ID NO
    tsISO8601 The data timestamp in ISO8601 format NO
    aP_1 Active Power phase 1 in (W) YES
    aP_2 Active Power phase 2 in (W) YES
    aP_3 Active Power phase 3 in (W) YES
    rP_1 Reactive Power phase 1 in (VA reactive) YES
    rP_2 Reactive Power phase 2 in (VA reactive) YES
    rP_3 Reactive Power phase 3 in (VA reactive) YES
    apP_1 Apparent Power phase 1 in (VA) YES
    apP_2 Apparent Power phase 2 in (VA) YES
    apP_3 Apparent Power phase 3 in (VA) YES
    v_1 Voltage phase 1 in (Volts) YES
    v_2 Voltage phase 2 in (Volts) YES
    v_3 Voltage phase 3 in (Volts) YES
    c_1 Current phase 1 in (Ampere) YES
    c_2 Current phase 2 in (Ampere) YES
    c_3 Current phase 3 in (Ampere) YES
    pC_1 Energy consumed since beginning in phase 1 in (Wh) YES
    pC_2 Energy consumed since beginning in phase 2 in (Wh) YES
    pC_3 Energy consumed since beginning in phase 3 in (Wh) YES
    v_12 Phase-To-Phase Voltage between phase 1 and 2 in (Volts) YES
    v_13 Phase-To-Phase Voltage between phase 1 and 3 in (Volts) YES
    v_23 Phase-To-Phase Voltage between phase 2 and 3 in (Volts) YES
    value For gas/water/numeric values (temperature, production, etc) YES

    Get Last Data Received

    curl --location --request GET 'https://web-collector.wattics.com/measurements/v2/unifiedjson/?stream=uniqueMeterId' \
    --header 'Content-Type: text/json' \
    --header 'Authorization: Basic encryptedUserAndPassword'
    
    require "uri"
    require "net/http"
    
    url = URI("https://web-collector.wattics.com/measurements/v2/unifiedjson/?stream=uniqueMeterId")
    
    https = Net::HTTP.new(url.host, url.port);
    https.use_ssl = true
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = "text/json"
    request["Authorization"] = "Basic encryptedUserAndPassword"
    
    response = https.request(request)
    puts response.read_body
    
    Unirest.setTimeouts(0, 0);
    HttpResponse<String> response = Unirest.get("https://web-collector.wattics.com/measurements/v2/unifiedjson/?stream=uniqueMeterId")
      .header("Content-Type", "text/json")
      .header("Authorization", "Basic encryptedUserAndPassword")
      .asString();
    
    import requests
    
    url = "https://web-collector.wattics.com/measurements/v2/unifiedjson/?stream=uniqueMeterId"
    
    headers = {
      'Content-Type': 'text/json',
      'Authorization': 'Basic encryptedUserAndPassword'
    }
    
    response = requests.request("GET", url, headers=headers)
    
    print(response.text.encode('utf8'))
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function() {
      if(this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "https://web-collector.wattics.com/measurements/v2/unifiedjson/?stream=uniqueMeterId");
    xhr.setRequestHeader("Content-Type", "text/json");
    xhr.setRequestHeader("Authorization", "Basic encryptedUserAndPassword");
    
    xhr.send();
    

    The above command returns JSON structured like this:

    {
      "id": "uniqueMeterId",
      "timestamp": 1562111700,
      "tsISO8601": "2019-07-02T23:55:00.000+0000",
      "value": 0.0,
      "aP_1": 4287000.0,
      "aP_2": 0.0,
      "aP_3": 0.0,
      "rP_1": 0.0,
      "rP_2": 0.0,
      "rP_3": 0.0,
      "apP_1": 0.0,
      "apP_2": 0.0,
      "apP_3": 0.0,
      "v_1": 0.0,
      "v_2": 0.0,
      "v_3": 0.0,
      "c_1": 0.0,
      "c_2": 0.0,
      "c_3": 0.0,
      "pC_1": 0.0,
      "pC_2": 0.0,
      "pC_3": 0.0,
      "v_12": 0.0,
      "v_13": 0.0,
      "v_23": 0.0,
      "vTHD_1": 0.0,
      "vTHD_2": 0.0,
      "vTHD_3": 0.0,
      "cTHD_1": 0.0,
      "cTHD_2": 0.0,
      "cTHD_3": 0.0
    }
    

    You can check which was the last packet sent to a specific meter using our endpoint.

    Dashboard Management API

    Authentication

    To authorize all requests from this point bellow, use your user's API Token created on Dashboard as an Authorization header in the request.

    curl -X GET \
      https://api.wattics.com/api/v1/RESOURCE \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
    
    require 'uri'
    require 'net/http'
    
    url = URI("http://api.wattics.com/api/v1/RESOURCE")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.get("http://api.wattics.com/api/v1/RESOURCEhttps://api.wattics.com/api/v1/RESOURCE")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .asString();
    
    import requests
    
    url = "http://api.wattics.com/api/v1/RESOURCE"
    
    payload = ""
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("GET", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify(false);
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "http://api.wattics.com/api/v1/RESOURCE");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    Make sure to replace YOUR_API_TOKEN_HERE with your API key.

    To make API calls you will need your personal API token which can be found under My Account.

    Wattics API expects for the API key to be included in all API requests to the server in a header that looks like the following:

    Authorization: YOUR_API_TOKEN_HERE

    Users - Create

    curl -X POST \
      https://api.wattics.com/api/v1/users \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
      -d '{
      "user": {
        "name": "John",
        "surname": "Doe",
        "email": "[email protected]",
        "plan": "Data import"
      }
    }'
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/users")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Post.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    request.body = "{\n\t\"user\": {\n\t\t\"name\": \"John\",\n\t\t\"surname\": \"Doe\",\n\t\t\"email\": \"[email protected]\",\n\t\t\"plan\": \"Data import\"\n\t}\n}"
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.post("https://api.wattics.com/api/v1/users")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .body("{\n\t\"user\": {\n\t\t\"name\": \"John\",\n\t\t\"surname\": \"Doe\",\n\t\t\"email\": \"[email protected]\",\n\t\t\"plan\": \"Data import\"\n\t}\n}")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/users"
    
    payload = "{\n\t\"user\": {\n\t\t\"name\": \"John\",\n\t\t\"surname\": \"Doe\",\n\t\t\"email\": \"[email protected]\",\n\t\t\"plan\": \"Data import\"\n\t}\n}"
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE"
        }
    
    response = requests.request("POST", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify({
      "user": {
        "name": "John",
        "surname": "Doe",
        "email": "[email protected]",
        "plan": "Data import"
      }
    });
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("POST", "https://api.wattics.com/api/v1/users");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    {
      "success": true,
      "id": NEW_USER_ID
    }
    

    This endpoint creates a new user.

    HTTP Request

    POST https://api.wattics.com/api/v1/users

    User Parameters

    Parameter Description Optional
    NAME The name of the user NO
    SURNAME The surname of the user NO
    E-MAIL The e-mail of the user NO
    PLAN The plan of the user NO

    Users - Associate to Site

    curl -X PATCH \
      https://api.wattics.com/api/v1/users/USER_ID/grant_site_access \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
      -d '{
      "site_id": 1
    }'
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/users/USER_ID/grant_site_access")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Patch.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    request.body = "{\n\t\"site_id\": 1\n}"
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.patch("https://api.wattics.com/api/v1/users/USER_ID/grant_site_access")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .body("{\n\t\"site_id\": 1\n}")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/users/USER_ID/grant_site_access"
    
    payload = "{\n\t\"site_id\": 1\n}"
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE"
        }
    
    response = requests.request("PATCH", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify({
      "site_id": 1
    });
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("PATCH", "https://api.wattics.com/api/v1/users/USER_ID/grant_site_access");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    {
      "success": true
    }
    

    This endpoint grants permission to a specific user to access a specific site.

    HTTP Request

    PATCH https://api.wattics.com/api/v1/users/{USER_ID}/grant_site_access

    URL Parameters

    Parameter Description Optional
    USER_ID The ID of the user NO

    Body Parameters

    Parameter Description Optional
    SITE_ID The ID of the site NO

    Users - Disassociate from Site

    curl -X PATCH \
      https://api.wattics.com/api/v1/users/USER_ID/remove_site_access \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
      -d '{
      "site_id": 1
    }'
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/users/USER_ID/remove_site_access")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Patch.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    request.body = "{\n\t\"site_id\": 1\n}"
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.patch("https://api.wattics.com/api/v1/users/USER_ID/remove_site_access")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .body("{\n\t\"site_id\": 1\n}")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/users/USER_ID/remove_site_access"
    
    payload = "{\n\t\"site_id\": 1\n}"
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE"
        }
    
    response = requests.request("PATCH", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify({
      "site_id": 1
    });
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("PATCH", "https://api.wattics.com/api/v1/users/USER_ID/remove_site_access");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    {
      "success": true
    }
    

    This endpoint removes permission to an specific user to access a specific site.

    HTTP Request

    PATCH https://api.wattics.com/api/v1/users/{USER_ID}/remove_site_access

    URL Parameters

    Parameter Description Optional
    USER_ID The ID of the user NO

    Body Parameters

    Parameter Description Optional
    SITE_ID The ID of the site NO

    Users - List associated sites

    curl --location --request GET 'https://api.wattics.com/api/v1/users/USER_ID/associated_sites' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: YOUR_API_TOKEN_HERE' \
    --header 'Content-Type: text/plain'
    
    require "uri"
    require "net/http"
    
    url = URI("https://api.wattics.com/api/v1/users/USER_ID/associated_sites")
    
    https = Net::HTTP.new(url.host, url.port);
    https.use_ssl = true
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = ["application/json", "text/plain"]
    request["Authorization"] = "YOUR_API_TOKEN_HERE"
    
    response = https.request(request)
    puts response.read_body
    
    
    Unirest.setTimeouts(0, 0);
    HttpResponse<String> response = Unirest.get("https://api.wattics.com/api/v1/users/USER_ID/associated_sites")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .header("Content-Type", "text/plain")
      .asString();
    
    
    import requests
    
    url = "https://api.wattics.com/api/v1/users/USER_ID/associated_sites"
    
    payload = ""
    headers = {
      'Content-Type': 'application/json',
      'Authorization': 'YOUR_API_TOKEN_HERE',
      'Content-Type': 'text/plain'
    }
    
    response = requests.request("GET", url, headers=headers, data = payload)
    
    print(response.text.encode('utf8'))
    
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function() {
      if(this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "https://api.wattics.com/api/v1/users/USER_ID/associated_sites");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    xhr.setRequestHeader("Content-Type", "text/plain");
    
    xhr.send();
    

    The above command returns JSON structured like this:

    [
        {
            "id": 1,
            "name": "Site 1",
            "organization": {
                "id": 1,
                "name": "Organization 1"
            }
        },
        {
            "id": 2,
            "name": "Site 2",
            "organization": {
                "id": 2,
                "name": "Organization 2"
            }
        },
        ...
    ]
    

    This endpoint returns all sites a user is associated to.

    HTTP Request

    GET https://api.wattics.com/api/v1/users/{USER_ID}/associated_sites

    URL Parameters

    Parameter Description Optional
    USER_ID The ID of the user NO

    Users - Show Details by E-mail

    curl -X GET \
      https://api.wattics.com/api/v1/users/show_by_email?email=[email protected] \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json'
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/users/[email protected]")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.get("https://api.wattics.com/api/v1/users/[email protected]")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/users/[email protected]"
    
    payload = ""
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE"
        }
    
    response = requests.request("GET", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify(false);
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "https://api.wattics.com/api/v1/users/[email protected]");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    {
      "id": 1,
      "name": "John",
      "surname": "Doe",
      "email": "[email protected]",
      "notes": "Something noted"
    }
    

    This endpoint shows the details of a certain user searching by its e-mail.

    HTTP Request

    GET https://api.wattics.com/api/v1/users/show_by_email?email={EMAIL}

    URL Parameters

    Parameter Description Optional
    EMAIL E-mail of the user NO

    Users - Add to Report Definition

    curl -X PATCH \
      https://api.wattics.com/api/v1/users/USER_ID/associate_to_report \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
      -d '{
      "report_definition_id": REPORT_DEFINITION_ID
    }'
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/users/USER_ID/associate_to_report")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Patch.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    request.body = "{\n\t\"report_definition_id\": REPORT_DEFINITION_ID\n}"
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.patch("https://api.wattics.com/api/v1/users/USER_ID/associate_to_report")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .body("{\n\t\"report_definition_id\": REPORT_DEFINITION_ID\n}")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/users/USER_ID/associate_to_report"
    
    payload = "{\n\t\"report_definition_id\": REPORT_DEFINITION_ID\n}"
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("PATCH", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = '{\n\t"report_definition_id": REPORT_DEFINITION_ID\n}';
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open(
      "PATCH",
      "https://api.wattics.com/api/v1/users/USER_ID/associate_to_report"
    );
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    {
      "success": true
    }
    

    This endpoint grants permission to a specific user to receive a specific report.

    HTTP Request

    PATCH https://api.wattics.com/api/v1/users/{USER_ID}/associate_to_report

    URL Parameters

    Parameter Description Optional
    USER_ID The ID of the user NO

    Body Parameters

    Parameter Description Optional
    REPORT_DEFINITION_ID The ID of the report definition NO

    Organizations - Create

    curl -X POST \
      https://api.wattics.com/api/v1/organizations \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
      -d '{
      "organization": {
        "name": "My New Organization"
      }
    }'
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/organizations")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Post.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    request.body = "{\n\t\"organization\": {\n\t\t\"name\": \"My New Organization\"\n\t}\n}"
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.post("https://api.wattics.com/api/v1/organizations")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .body("{\n\t\"organization\": {\n\t\t\"name\": \"My New Organization\"\n\t}\n}")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/organizations"
    
    payload = "{\n\t\"organization\": {\n\t\t\"name\": \"My New Organization\"\n\t}\n}"
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("POST", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify({
      "organization": {
        "name": "My New Organization"
      }
    });
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("POST", "https://api.wattics.com/api/v1/organizations");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    {
      "success": true,
      "id": NEW_ORGANIZATION_ID
    }
    

    This endpoint creates a new organization.

    HTTP Request

    POST https://api.wattics.com/api/v1/organizations

    Organization Parameters

    Parameter Description Optional
    NAME The name of the organization NO

    Organizations - Update

    curl -X PATCH \
      https://api.wattics.com/api/v1/organizations/ORGANIZATION_ID \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
      -d '{
      "organization": {
        "name": "Other name"
      }
    }'
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/organizations/ORGANIZATION_ID")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Patch.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    request.body = "{\n\t\"organization\": {\n\t\t\"name\": \"Other name\"\n\t}\n}"
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.patch("https://api.wattics.com/api/v1/organizations/ORGANIZATION_ID")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .body("{\n\t\"organization\": {\n\t\t\"name\": \"Other name\"\n\t}\n}")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/organizations/ORGANIZATION_ID"
    
    payload = "{\n\t\"organization\": {\n\t\t\"name\": \"Other name\"\n\t}\n}"
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("PATCH", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify({
      "organization": {
        "name": "Other name"
      }
    });
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("PATCH", "https://api.wattics.com/api/v1/organizations/ORGANIZATION_ID");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    {
      "success": true
    }
    

    This endpoint updates an existing organization.

    HTTP Request

    PATCH https://api.wattics.com/api/v1/organizations/{ORGANIZATION_ID}

    URL Parameters

    Parameter Description Optional
    ORGANIZATION_ID id of the organization NO

    Body Parameters

    Parameter Description Optional
    NAME The name of the organization YES

    Organizations - Delete

    curl -X DELETE \
      https://api.wattics.com/api/v1/organizations/ORGANIZATION_ID \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json'
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/organizations/ORGANIZATION_ID")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Delete.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    
    response = http.request(request)
    
    HttpResponse<String> response = Unirest.delete("https://api.wattics.com/api/v1/organizations/ORGANIZATION_ID")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/organizations/ORGANIZATION_ID"
    
    payload = "{\n\t\"organization\": {\n\t\t\"name\": \"Other name\"\n\t}\n}"
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("DELETE", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify({
      "organization": {
        "name": "Other name"
      }
    });
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("DELETE", "https://api.wattics.com/api/v1/organizations/ORGANIZATION_ID");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    {
      "success": true
    }
    

    This endpoint deletes an existing organization.

    HTTP Request

    DELETE https://api.wattics.com/api/v1/organizations/{ORGANIZATION_ID}

    URL Parameters

    Parameter Description Optional
    ORGANIZATION_ID id of the organization NO

    Organizations - List

    curl -X GET \
      https://api.wattics.com/api/v1/organizations \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/organizations")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.get("https://api.wattics.com/api/v1/organizations")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/organizations"
    
    payload = ""
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("GET", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify(false);
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "https://api.wattics.com/api/v1/organizations");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above commands returns JSON structured like this:

    [
      {
        "id": 1,
        "name": "Organization 1"
      },
      {
        "id": 2,
        "name": "Organization 2"
      },
      {
        "id": 3,
        "name": "Organization 3"
      }
    ]
    

    This endpoint retrieves all organizations that the api token owner has access.

    HTTP Request

    GET https://api.wattics.com/api/v1/organizations

    Sites - Create

    curl -X POST \
      https://api.wattics.com/api/v1/sites \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
      -d '{
      "site": {
        "organization_id": 1,
        "name": "Dublin Office",
        "city": "Dublin",
        "country": "Ireland",
        "address": "Taylors Lane",
        "contact_name": "John Doe",
        "contact_email": "[email protected]"
      }
    }'
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/sites")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Post.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    request.body = "{ \n\t\"site\": {\n\t\t\"organization_id\": 1,\n\t\t\"name\": \"Dublin Office\",\n\t\t\"city\": \"Dublin\",\n\t\t\"country\": \"Ireland\",\n\t\t\"address\": \"Taylors Lane\",\n\t\t\"contact_name\": \"John Doe\",\n\t\t\"contact_email\": \"[email protected]\"\n\t}\n}"
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.post("https://api.wattics.com/api/v1/sites")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .body("{ \n\t\"site\": {\n\t\t\"organization_id\": 1,\n\t\t\"name\": \"Dublin Office\",\n\t\t\"city\": \"Dublin\",\n\t\t\"country\": \"Ireland\",\n\t\t\"address\": \"Taylors Lane\",\n\t\t\"contact_name\": \"John Doe\",\n\t\t\"contact_email\": \"[email protected]\"\n\t}\n}")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/sites"
    
    payload = "{ \n\t\"site\": {\n\t\t\"organization_id\": 1,\n\t\t\"name\": \"Dublin Office\",\n\t\t\"city\": \"Dublin\",\n\t\t\"country\": \"Ireland\",\n\t\t\"address\": \"Taylors Lane\",\n\t\t\"contact_name\": \"John Doe\",\n\t\t\"contact_email\": \"[email protected]\"\n\t}\n}"
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("POST", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify({
      "site": {
        "organization_id": 1,
        "name": "Dublin Office",
        "city": "Dublin",
        "country": "Ireland",
        "address": "Taylors Lane",
        "contact_name": "John Doe",
        "contact_email": "[email protected]"
      }
    });
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("POST", "https://api.wattics.com/api/v1/sites");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    {
      "success": true,
      "id": NEW_SITE_ID
    }
    

    This endpoint creates a new site.

    HTTP Request

    POST https://api.wattics.com/api/v1/sites

    Site Parameters

    Parameter Description Optional
    ORGANIZATION_ID The organization to place the site in NO
    NAME The name of the site NO
    COUNTRY The country where the site is located NO
    CITY The city where the site is located NO
    CONTACT_NAME Site contact name NO
    CONTACT_EMAIL Site contact email NO
    ADDRESS The address where the site is located YES
    LATITUDE The latitude where the site is located YES
    LONGITUDE The longitude where the site is located YES
    CONTACT_PHONE Site contact landline phone number YES
    CONTACT_MOBILE Site contact mobile phone number YES
    INTEGRATION_TIMEZONE Specific timezone used for some integration scenarios YES

    Sites - Update

    curl -X PATCH \
      https://api.wattics.com/api/v1/sites/SITE_ID \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
      -d '{
      "site": {
        "name": "New name"
      }
    }'
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/sites/SITE_ID")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Patch.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    request.body = "{\n\t\"organization\": {\n\t\t\"name\": \"Other name\"\n\t}\n}"
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.patch("https://api.wattics.com/api/v1/sites/SITE_ID")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .body("{\n\t\"organization\": {\n\t\t\"name\": \"Other name\"\n\t}\n}")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/sites/SITE_ID"
    
    payload = "{\n\t\"organization\": {\n\t\t\"name\": \"Other name\"\n\t}\n}"
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("PATCH", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify({
      "site": {
        "name": "New name"
      }
    });
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("PATCH", "https://api.wattics.com/api/v1/sites/SITE_ID");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    {
      "success": true
    }
    

    This endpoint updates an existing site.

    HTTP Request

    PATCH https://api.wattics.com/api/v1/sites/{SITE_ID}

    Site Parameters

    Parameter Description Optional
    SITE_ID id of the site to be updated NO
    NAME The name of the site YES
    COUNTRY The country where the site is located YES
    CITY The city where the site is located YES
    CONTACT_NAME Site contact name YES
    CONTACT_EMAIL Site contact email YES
    ADDRESS The address where the site is located YES
    LATITUDE The latitude where the site is located YES
    LONGITUDE The longitude where the site is located YES
    CONTACT_PHONE Site contact landline phone number YES
    CONTACT_MOBILE Site contact mobile phone number YES
    INTEGRATION_TIMEZONE Specific timezone used for some integration scenarios YES

    Sites - Delete

    curl -X DELETE \
      https://api.wattics.com/api/v1/sites/SITE_ID \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json'
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/sites/SITE_ID")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Delete.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    
    response = http.request(request)
    
    HttpResponse<String> response = Unirest.delete("https://api.wattics.com/api/v1/sites/SITE_ID")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/sites/SITE_ID"
    
    payload = "{\n\t\"organization\": {\n\t\t\"name\": \"Other name\"\n\t}\n}"
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("DELETE", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify({
      "organization": {
        "name": "Other name"
      }
    });
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("DELETE", "https://api.wattics.com/api/v1/sites/{SITE_ID}");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    {
      "success": true
    }
    

    This endpoint deletes an existing site.

    HTTP Request

    DELETE https://api.wattics.com/api/v1/sites/{SITE_ID}

    Site Parameters

    Parameter Description Optional
    SITE_ID id of the site NO

    Sites - Get

    curl -X GET \
      https://api.wattics.com/api/v1/sites/1 \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/sites/1")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.get("https://api.wattics.com/api/v1/sites/1")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/sites/1"
    
    payload = ""
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("GET", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify(false);
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "https://api.wattics.com/api/v1/sites/1");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    
    {
      "id": 1,
      "name": "Site 1",
      "address": {
        "line_1": "The Guinness Enterprise Center",
        "line_2": "Taylor’s Ln",
        "line_3": "Dublin 8, Ireland",
        "city": "Dublin",
        "county": "Dublin",
        "country": "Ireland"
      },
      "contact": {
        "name": "John Doe",
        "email": "[email protected]",
        "phone_number": "353 01234 5678",
        "mobile_phone_number": "353 01234 5678"
      }
    }
    

    This endpoint retrieves a specific site of an organization.

    HTTP Request

    GET http://api.wattics.com/api/v1/sites/{SITE_ID}

    URL Parameters

    Parameter Description Optional
    SITE_ID The ID of the site to retrieve NO

    Sites - List from Organization

    curl -X GET \
      https://api.wattics.com/api/v1/sites \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/sites?organization_id=1")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.get("https://api.wattics.com/api/v1/sites?organization_id=1")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/sites?organization_id=1"
    
    payload = ""
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("GET", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify(false);
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "https://api.wattics.com/api/v1/sites?organization_id=1");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    [
      {
        "id": 1,
        "name": "Site 1",
        "address": {
          "line_1": "The Guinness Enterprise Center",
          "line_2": "Taylor’s Ln",
          "line_3": "Dublin 8, Ireland",
          "city": "Dublin",
          "county": "Dublin",
          "country": "Ireland"
        },
        "contact": {
          "name": "John Doe",
          "email": "[email protected]",
          "phone_number": "353 01234 5678",
          "mobile_phone_number": "353 01234 5678"
        }
      },
      {
        "id": 2,
        "name": "Site 2",
        "address": {
          "line_1": "College Green",
          "line_2": "Dublin 2, Ireland",
          "line_3": "",
          "city": "Dublin",
          "county": "Dublin",
          "country": "Ireland"
        },
        "contact": {
          "name": "Mike Doe",
          "email": "[email protected]",
          "phone_number": "353 01234 5678",
          "mobile_phone_number": "353 01234 5678"
        }
      }
    ]
    

    This endpoint retrieves all sites of an organization that the api token owner has access.

    HTTP Request

    GET https://api.wattics.com/api/v1/sites?organization_id=<ORGANIZATION_ID>

    URL Parameters

    Parameter Description OPTIONAL
    ORGANIZATION_ID The ID of the organization that contains the sites. Use it if you want to filter them. NO

    Sites - List users

    curl --location --request GET 'https://api.wattics.com/api/v1/sites/SITE_ID/associated_users' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: YOUR_API_TOKEN_HERE' \
    --header 'Content-Type: text/plain'
    
    require "uri"
    require "net/http"
    
    url = URI("https://api.wattics.com/api/v1/sites/SITE_ID/associated_users")
    
    https = Net::HTTP.new(url.host, url.port);
    https.use_ssl = true
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = ["application/json", "text/plain"]
    request["Authorization"] = "YOUR_API_TOKEN_HERE"
    
    response = https.request(request)
    puts response.read_body
    
    
    Unirest.setTimeouts(0, 0);
    HttpResponse<String> response = Unirest.get("https://api.wattics.com/api/v1/sites/SITE_ID/associated_users")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .header("Content-Type", "text/plain")
      .asString();
    
    
    import requests
    
    url = "https://api.wattics.com/api/v1/sites/SITE_ID/associated_users"
    
    payload = ""
    headers = {
      'Content-Type': 'application/json',
      'Authorization': 'YOUR_API_TOKEN_HERE',
      'Content-Type': 'text/plain'
    }
    
    response = requests.request("GET", url, headers=headers, data = payload)
    
    print(response.text.encode('utf8'))
    
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function() {
      if(this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "https://api.wattics.com/api/v1/sites/SITE_ID/associated_users");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    xhr.setRequestHeader("Content-Type", "text/plain");
    
    xhr.send();
    

    The above command returns JSON structured like this:

    [
        {
            "id": 1,
            "email": "[email protected]"
        },
        {
            "id": 2,
            "email": "[email protected]"
        },
        {
            "id": 3,
            "email": "[email protected]"
        }
    ]
    

    This endpoint returns all users a site is associated to.

    HTTP Request

    GET https://api.wattics.com/api/v1/sites/{SITE_ID}/associated_users

    URL Parameters

    Parameter Description Optional
    SITE_ID The ID of the site NO

    Sites - List from Partner

    curl -X GET \
      https://api.wattics.com/api/v1/sites?pageSize=2&pageNumber=1 \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json'
      -d '{"q": {"name_cont": "Site"}, "fields": "id, name, address"}'
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/sites?pageSize=2&pageNumber=1")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.get("https://api.wattics.com/api/v1/sites?pageSize=2&pageNumber=1")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/sites?pageSize=2&pageNumber=1"
    
    payload = ""
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("GET", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify(false);
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "https://api.wattics.com/api/v1/sites?pageSize=2&pageNumber=1");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    [
      {
      "id": 1,
      "name": "Site 1",
      "address": {
        "line_1": "The Guinness Enterprise Center",
        "line_2": "Taylor’s Ln",
        "line_3": "Dublin 8, Ireland",
        "city": "Dublin",
        "county": "Dublin",
        "country": "Ireland"
      }
      },
      {
      "id": 2,
      "name": "Site 2",
      "address": {
        "line_1": "Blackrock, Co. Dublin, Ireland",
        "line_2": "",
        "line_3": "",
        "city": "Blackrock",
        "county": "County Dublin",
        "country": "Ireland"
      }
      }
    ]
    

    This endpoint retrieves all sites of a partner that the API token owner can access.

    HTTP Request

    GET https://api.wattics.com/api/v1/sites?pageSize={NUMBER_OF_SITES_PER_PAGE}&pageNumber={PAGE_NUMBER}

    URL Parameters

    Parameter Description Optional
    pageSize Number of sites per page in the response YES
    pageNumber The page of the response to be shown YES
    name_cont Return sites whose names contain the specified name filter YES
    name_eq Returns sites whose names exactly match the specified name filter YES
    fields A comma separated list of params to be included in the response YES

    Meters - Create

    curl -X POST \
      https://api.wattics.com/api/v1/meters \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
      -d '{
      "meter": {
        "name": "Meter 1",
        "site_id": 1,
        "type": "electricity",
        "reference": "meter-1234-0000",
        "param_type": "all",
        "reading": "cum",
        "process_sampling_rate": 5
      }
    }'
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/meters")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Post.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    request.body = "{\n\t\"meter\": {\n\t\t\"name\": \"Meter 1\",\n\t\t\"site_id\": 1,\n\t\t\"type\": \"electricity\",\n\t\t\"reference\": \"meter-1234-0000\",\n\t\t\"param_type\": \"all\",\n\t\t\"reading\": \"cum\",\n\t\t\"process_sampling_rate\": 5\n\t}\n}"
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.post("https://api.wattics.com/api/v1/meters")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .body("{\n\t\"meter\": {\n\t\t\"name\": \"Meter 1\",\n\t\t\"site_id\": 1,\n\t\t\"type\": \"electricity\",\n\t\t\"reference\": \"meter-1234-0000\",\n\t\t\"param_type\": \"all\",\n\t\t\"reading\": \"cum\",\n\t\t\"process_sampling_rate\": 5\n\t}\n}")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/meters"
    
    payload = "{\n\t\"meter\": {\n\t\t\"name\": \"Meter 1\",\n\t\t\"site_id\": 1,\n\t\t\"type\": \"electricity\",\n\t\t\"reference\": \"meter-1234-0000\",\n\t\t\"param_type\": \"all\",\n\t\t\"reading\": \"cum\",\n\t\t\"process_sampling_rate\": 5\n\t}\n}"
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("POST", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify({
      "meter": {
        "name": "Meter 1",
        "site_id": 1,
        "type": "electricity",
        "reference": "meter-1234-0000",
        "param_type": "all",
        "reading": "cum",
        "process_sampling_rate": 5
      }
    });
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("POST", "https://api.wattics.com/api/v1/meters");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    {
      "success": true,
      "id": NEW_METER_ID
    }
    

    This endpoint creates a new meter.

    HTTP Request

    POST https://api.wattics.com/api/v1/meters

    Meter Parameters

    Parameter Description Optional
    SITE_ID site to place meter NO
    NAME meter name NO
    REFERENCE meter unique reference NO
    TYPE electricity/gas/water/numeric_value NO
    REAL_METER true/false Use only with electricity
    READING cum (cumulative) / avg (interval) NO
    UNIT kWh for example NO
    PARAM_TYPE channel param type all/one NO
    PROCESS_SAMPLING_RATE minutes - 5/10/15/30/60/1440 (1 day) NO
    DATA_TYPE hdd/cdd Use only with numeric values
    YEARS_TO_IMPORT amount of years before today Use only with numeric values
    TEMPERATURE_UNIT C (celsius) / F (Fareinheit) Use only with numeric values HDD and CDD
    BASE_TEMPERATURE base temperature Use only with numeric values
    AGGREGATION_ELABORATION cum/avg Use only with numeric values
    CT_FACTOR - YES
    PT_FACTOR - YES
    CONVERSION_FACTOR Set to 1000 to convert electric meter units from Wh to KWh YES
    OFFSET - YES
    IS_SHARED_ACROSS_SITES - YES
    USE_ACTIVE_ENERGY_RECEIVED - YES
    USE_THRESHOLD_INTERPOLATION - YES
    THRESHOLD_INTERPOLATION_VALUE - YES

    Meters - Update

    curl -X PATCH \
      https://api.wattics.com/api/v1/meters/METER_ID \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
      -d '{
      "meter": {
        "name": "New name"
      }
    }'
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/meters/METER_ID")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Patch.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    request.body = "{\n\t\"meter\": {\n\t\t\"name\": \"Other name\"\n\t}\n}"
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.patch("https://api.wattics.com/api/v1/meters/METER_ID")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .body("{\n\t\"meter\": {\n\t\t\"name\": \"Other name\"\n\t}\n}")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/meters/METER_ID"
    
    payload = "{\n\t\"meter\": {\n\t\t\"name\": \"Other name\"\n\t}\n}"
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("PATCH", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify({
      "meter": {
        "name": "New name"
      }
    });
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("PATCH", "https://api.wattics.com/api/v1/meters/METER_ID");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    {
      "success": true
    }
    

    This endpoint updates an existing meter.

    HTTP Request

    PATCH https://api.wattics.com/api/v1/meters/{METER_ID}

    Meter Parameters

    Parameter Description Optional
    METER_ID meter id NO
    NAME meter name NO
    REFERENCE meter unique reference YES
    REAL_METER true/false Use only with electricity
    READING cum (cumulative) / avg (interval) YES
    UNIT kWh / Wh / Pulse Count/ m3 for example. Units for electricity meters are preset (refer to conversion factor parameter for more details). For other types of meters (gas, water and numeric) use this field to provide the unit of measurement (m3, ft3, °C, ppm, units, etc) YES
    OFFSET - YES
    PARAM_TYPE channel param type all/one YES
    PROCESS_SAMPLING_RATE minutes - 5/10/15/30/60/1440 (1 day) YES
    DATA_TYPE hdd/cdd Use only with numeric values
    YEARS_TO_IMPORT amount of years before today Use only with numeric values
    TEMPERATURE_UNIT °C (celsius) / °F (Fareinheit) Use only with numeric values HDD and CDD
    BASE_TEMPERATURE base temperature Use only with numeric values
    AGGREGATION_ELABORATION cum/avg Use only with numeric values
    CT_FACTOR - YES
    PT_FACTOR - YES
    conversion_factor Set value to 1000 for electricity energy readings in kWh and to 1 for readings in Wh YES
    OFFSET - YES
    IS_SHARED_ACROSS_SITES - YES
    USE_ACTIVE_ENERGY_RECEIVED - YES
    USE_THRESHOLD_INTERPOLATION - YES
    THRESHOLD_INTERPOLATION_VALUE - YES
    IAQ_PARAMETER - NO (IAQ meters)

    Meters - Delete

    curl -X DELETE \
      https://api.wattics.com/api/v1/meters/METER_ID \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json'
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/meters/METER_ID")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Delete.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    
    response = http.request(request)
    
    HttpResponse<String> response = Unirest.delete("https://api.wattics.com/api/v1/meters/METER_ID")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/meters/METER_ID"
    
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("DELETE", url, headers=headers)
    
    print(response.text)
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("DELETE", "https://api.wattics.com/api/v1/meters/METER_ID");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send();
    

    The above command returns JSON structured like this:

    {
      "success": true
    }
    

    This endpoint deletes an existing meter.

    HTTP Request

    DELETE https://api.wattics.com/api/v1/meters/METER_ID

    Meter Parameters

    Parameter Description Optional
    METER_ID id of the meter NO

    Meters - Get

    curl -X GET \
      "https://api.wattics.com/api/v1/meters/1" \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/meters/1")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.get("https://api.wattics.com/api/v1/meters/1")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/meters/1"
    
    payload = ""
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("GET", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify(false);
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "https://api.wattics.com/api/v1/meters/1");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    {
      "id": 1,
      "reference": "m01234345",
      "name": "Meter 01",
      "type": "electricity",
      "process_sampling_rate_minutes": 5,
      "unit": "Watt",
      "wh_per_pulse": 1,
      "reading": "Interval",
      "real_meter": true,
      "is_shared_across_sites": false,
      "data_type": "generic",
      "temperature_unit": null,
      "base_temperature": null,
      "years_to_import": null,
      "station_id": null
    }
    

    This endpoint retrieves a specific meter of a site.

    HTTP Request

    GET https://api.wattics.com/api/v1/meters/{METER_ID}

    URL Parameters

    Parameter Description Optional
    ORGANIZATION_ID The ID of the organization that contains the meter NO
    SITE_ID The ID of the site that contains the meters NO
    METER_ID The ID of the meter to retrieve NO

    Meters - List from Site

    curl -X GET \
      https://api.wattics.com/api/v1/meters?organization_id=1&site_id=1 \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/meters?organization_id=1&site_id=1")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.get("https://api.wattics.com/api/v1/meters?organization_id=1&site_id=1")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/meters?organization_id=1&site_id=1"
    
    payload = ""
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("GET", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify(false);
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "https://api.wattics.com/api/v1/meters?organization_id=1&site_id=1");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    [
      {
        "id": 1,
        "reference": "m01234345",
        "name": "Meter 01",
        "type": "electricity",
        "process_sampling_rate_minutes": 5,
        "unit": "Watt",
        "wh_per_pulse": 1,
        "reading": "Interval",
        "real_meter": true,
        "is_shared_across_sites": false,
        "data_type": "generic",
        "temperature_unit": null,
        "base_temperature": null,
        "years_to_import": null,
        "station_id": null
      },
      {
        "id": 2,
        "reference": "7874878",
        "name": "Meter 02",
        "type": "water",
        "process_sampling_rate_minutes": 15,
        "unit": null,
        "wh_per_pulse": 1,
        "reading": "Interval",
        "real_meter": true,
        "is_shared_across_sites": false,
        "data_type": "generic",
        "temperature_unit": null,
        "base_temperature": null,
        "years_to_import": null,
        "station_id": null
      },
      {
        "id": 3,
        "reference": "223133",
        "name": "Meter 03",
        "type": "gas",
        "process_sampling_rate_minutes": 15,
        "unit": null,
        "wh_per_pulse": 1,
        "reading": "Interval",
        "real_meter": true,
        "is_shared_across_sites": false,
        "data_type": "generic",
        "temperature_unit": null,
        "base_temperature": null,
        "years_to_import": null,
        "station_id": null
      },
      {
        "id": 4,
        "reference": "abc46583",
        "name": " Meter 04 Generic",
        "type": "numeric_value",
        "process_sampling_rate_minutes": 5,
        "unit": "1",
        "wh_per_pulse": 1,
        "reading": "Interval",
        "real_meter": true,
        "is_shared_across_sites": false,
        "data_type": "generic",
        "temperature_unit": null,
        "base_temperature": null,
        "years_to_import": null,
        "station_id": null
      }
    ]
    

    This endpoint retrieves all meters of a site that the api token owner has access.

    HTTP Request

    GET https://api.wattics.com/api/v1/meters?organization_id={ORGANIZATION_ID}&site_id={SITE_ID}

    URL Parameters

    Parameter Description Optional
    ORGANIZATION_ID The ID of the organization that contains the meter NO
    SITE_ID The ID of the site that contains the meters NO

    Meters - List from Partner

    curl -X GET \
      https://api.wattics.com/api/v1/meters?pageSize=2&pageNumber=1 \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' -d '{"q": {"name_cont": "Meter"}, "fields": "id, name, reference, site_id, site_name"}'
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/meters?pageSize=2&pageNumber=1")
    body = {"q": {"name_cont": "Meter"}, "fields": "id, name, reference, site_id, site_name"}
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.get("https://api.wattics.com/api/v1/meters?pageSize=2&pageNumber=1")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/meters?pageSize=2&pageNumber=1"
    
    payload = ""
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("GET", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify(false);
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "https://api.wattics.com/api/v1/meters?pageSize=2&pageNumber=1");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    [
      {
        "id": 1,
        "reference": "m01234345",
        "name": "Meter 01",
        "site_id": 219,
        "site_name": "TestTest"
      },
      {
        "id": 2,
        "reference": "7874878",
        "name": "Meter 02",
        "site_id": 219,
        "site_name": "TestTest"
      }
    ]
    

    This endpoint retrieves all meters of a partner that the API token owner can access.

    HTTP Request

    GET https://api.wattics.com/api/v1/meters?pageSize={NUMBER_OF_METERS_PER_PAGE}&pageNumber={PAGE_NUMBER}

    URL Parameters

    Parameter Description Optional
    pageSize Number of meters per page in the response YES
    pageNumber The page of the response to be shown YES
    name_cont Return meters whose names contain the specified name filter YES
    name_eq Returns meters whose names exactly match the specified name filter YES
    fields A comma separated list of params to be included in the response YES

    Appliances - Create

    curl -X POST \
      https://api.wattics.com/api/v1/appliances \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
      -d '{
      "appliance": {
        "meter_id": 1,
        "name": "Fan",
        "reference": "app0123-99",
        "process_sampling_rate": 5,
        "reading": "avg",
        "channel_param_type": "one"
      }
    }'
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/appliances")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Post.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    request.body = "{\n\t\"appliance\": {\n\t\t\"meter_id\": 1, \n\t\t\"name\": \"Fan\",\n\t\t\"reference\": \"app0123-99\",\n\t\t\"process_sampling_rate\": 5,\n\t\t\"reading\": \"avg\",\n\t\t\"channel_param_type\": \"one\"\n\t}\n}"
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.post("https://api.wattics.com/api/v1/appliances")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .body("{\n\t\"appliance\": {\n\t\t\"meter_id\": 1, \n\t\t\"name\": \"Fan\",\n\t\t\"reference\": \"app0123-99\",\n\t\t\"process_sampling_rate\": 5,\n\t\t\"reading\": \"avg\",\n\t\t\"channel_param_type\": \"one\"\n\t}\n}")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/appliances"
    
    payload = "{\n\t\"appliance\": {\n\t\t\"meter_id\": 1, \n\t\t\"name\": \"Fan\",\n\t\t\"reference\": \"app0123-99\",\n\t\t\"process_sampling_rate\": 5,\n\t\t\"reading\": \"avg\",\n\t\t\"channel_param_type\": \"one\"\n\t}\n}"
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("POST", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify({
      "appliance": {
        "meter_id": 1,
        "name": "Fan",
        "reference": "app0123-99",
        "process_sampling_rate": 5,
        "reading": "avg",
        "channel_param_type": "one"
      }
    });
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("POST", "https://api.wattics.com/api/v1/appliances");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    {
      "success": true,
      "id": NEW_APPLIANCE_ID
    }
    

    This endpoint creates a new appliance.

    HTTP Request

    POST https://api.wattics.com/api/v1/appliances

    Appliance Parameters

    Parameter Description Optional
    METER_ID meter to place appliance NO
    NAME meter name NO
    REFERENCE meter unique reference NO
    READING cum (cumulative) / avg (interval) NO
    PROCESS_SAMPLING_RATE minutes - 5/10/15/30/60/1440 (1 day) NO
    CHANNEL_PARAM_TYPE channel param type all/one NO
    CT_FACTOR - YES
    PT_FACTOR - YES
    CONVERSION_FACTOR - YES
    OFFSET - YES

    Appliances - Update

    curl -X PATCH \
      https://api.wattics.com/api/v1/appliances/APPLIANCE_ID \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
      -d '{
      "appliance": {
        "name": "New name"
      }
    }'
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/appliances/APPLIANCE_ID")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Patch.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    request.body = "{\n\t\"appliance\": {\n\t\t\"name\": \"Other name\"\n\t}\n}"
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.patch("https://api.wattics.com/api/v1/appliances/APPLIANCE_ID")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .body("{\n\t\"appliance\": {\n\t\t\"name\": \"Other name\"\n\t}\n}")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/appliances/APPLIANCE_ID"
    
    payload = "{\n\t\"appliance\": {\n\t\t\"name\": \"Other name\"\n\t}\n}"
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("PATCH", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify({
      "appliance": {
        "name": "New name"
      }
    });
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("PATCH", "https://api.wattics.com/api/v1/appliances/APPLIANCE_ID");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    {
      "success": true
    }
    

    This endpoint updates an existing appliance.

    HTTP Request

    PATCH https://api.wattics.com/api/v1/appliances/{APPLIANCE_ID}

    Appliance Parameters

    Parameter Description Optional
    APPLIANCE_ID appliance id NO
    METER_ID meter to place appliance YES
    NAME appliance name YES
    REFERENCE appliance unique reference YES
    READING cum (cumulative) / avg (interval) YES
    PROCESS_SAMPLING_RATE minutes - 5/10/15/30/60/1440 (1 day) YES
    CHANNEL_PARAM_TYPE channel param type all/one YES
    CT_FACTOR - YES
    PT_FACTOR - YES
    conversion_factor Set value to 1000 for electricity energy readings in kWh and to 1 for readings in Wh YES
    OFFSET - YES

    Appliances - Delete

    curl -X DELETE \
      https://api.wattics.com/api/v1/appliances/APPLIANCE_ID \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json'
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/appliances/APPLIANCE_ID")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Delete.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    
    response = http.request(request)
    
    HttpResponse<String> response = Unirest.delete("https://api.wattics.com/api/v1/appliances/APPLIANCE_ID")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/appliances/APPLIANCE_ID"
    
    payload = "{\n\t\"organization\": {\n\t\t\"name\": \"Other name\"\n\t}\n}"
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("DELETE", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify({
      "organization": {
        "name": "Other name"
      }
    });
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("DELETE", "https://api.wattics.com/api/v1/appliances/APPLIANCE_ID");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    {
      "success": true
    }
    

    This endpoint deletes an existing appliance.

    HTTP Request

    DELETE https://api.wattics.com/api/v1/appliances/{APPLIANCE_ID}

    Appliance Parameters

    Parameter Description Optional
    APPLIANCE_ID id of the appliance NO

    Appliances - Get

    curl -X GET \
      https://api.wattics.com/api/v1/appliances/1 \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/appliances/1")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.get("https://api.wattics.com/api/v1/appliances/1")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/appliances/1"
    
    payload = ""
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("GET", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify(false);
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "https://api.wattics.com/api/v1/appliances/1");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    {
      "id": 1,
      "reference": "ap9011",
      "name": "A001",
      "process_sampling_rate_minutes": 15,
      "unit": "Watt",
      "reading": "Interval"
    }
    

    This endpoint retrieves a specific appliance of a meter.

    HTTP Request

    GET https://api.wattics.com/api/v1/appliances/{APPLIANCE_ID}

    URL Parameters

    Parameter Description Optional
    APPLIANCE_ID The ID of the appliance to retrieves NO

    Appliances - List from Meter

    curl -X GET \
      https://api.wattics.com/api/v1/appliances?organization_id=1&site_id=1&meter_id=1 \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/appliances?organization_id=1&site_id=1&meter_id=1")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.get("https://api.wattics.com/api/v1/appliances?organization_id=1&site_id=1&meter_id=1")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/appliances?organization_id=1&site_id=1&meter_id=1"
    
    payload = ""
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("GET", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify(false);
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "https://api.wattics.com/api/v1/appliances?organization_id=1&site_id=1&meter_id=1");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    [
      {
        "id": 1,
        "reference": "ap9011",
        "name": "A001",
        "process_sampling_rate_minutes": 15,
        "unit": "Watt",
        "reading": "Interval"
      },
      {
        "id": 2,
        "reference": "ap9012",
        "name": "A002",
        "process_sampling_rate_minutes": 15,
        "unit": "Watt",
        "reading": "Interval"
      }
    ]
    

    This endpoint retrieves all appliances of a meter that the api token owner has access.

    HTTP Request

    GET https://api.wattics.com/api/v1/appliances?organization_id={ORGANIZATION_ID}&site_id={SITE_ID}&meter_id={METER_ID}

    URL Parameters

    Parameter Description Optional
    ORGANIZATION_ID The ID of the organization that contains the appliances NO
    SITE_ID The ID of the site that contains the appliances NO
    METER_ID The ID of the meter that contains the appliances NO

    Metadata - From Site

    curl -X GET \
      https://api.wattics.com/api/v1/sites/SITE_ID/metadata \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/sites/SITE_ID/metadata")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.get("https://api.wattics.com/api/v1/sites/SITE_ID/metadatahttps://api.wattics.com/api/v1/sites/SITE_ID/metadata")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/sites/SITE_ID/metadata"
    
    payload = ""
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("GET", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify(false);
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "https://api.wattics.com/api/v1/sites/SITE_ID/metadata");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    [
      {
        "title": "What is the size of the building in m2?",
        "type": "double",
        "value": 200.5
      },
      {
        "title": "How many employees?",
        "type": "int",
        "value": 80
      }
    ]
    

    This endpoint retrieves all metadata of a site that the api token owner has access.

    HTTP Request

    GET https://api.wattics.com/api/v1/sites/{SITE_ID}/metadata

    URL Parameters

    Parameter Description Optional
    SITE_ID The ID of the site that contains the metadata NO

    Metadata - From Meter

    curl -X GET \
      https://api.wattics.com/api/v1/meters/ID/metadata \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/meters/ID/metadata")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.get("https://api.wattics.com/api/v1/meters/ID/metadata")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/meters/ID/metadata"
    
    payload = ""
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("GET", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify(false);
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "https://api.wattics.com/api/v1/meters/ID/metadata");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    [
      {
        "title": "Which is the model of the meter?",
        "type": "text",
        "value": "M01234"
      },
      {
        "title": "Is the meter a new model?",
        "type": "bool",
        "value": true
      }
    ]
    

    This endpoint retrieves all metadata of a meter that the api token owner has access.

    HTTP Request

    GET https://api.wattics.com/api/v1/meters/{METER_ID}/metadata

    URL Parameters

    Parameter Description Optional
    METER_ID The ID of the meter that contains the metadata NO

    Raw Data - From Meter

    curl -X GET \
      https://api.wattics.com/api/v1/meters/36/raw_data?from=01/01/2018&to=01/03/2018&data_type=active_power \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/meters/36/raw_data?from=01/01/2018&to=01/03/2018&data_type=active_power")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.get("https://api.wattics.com/api/v1/meters/36/raw_data?from=01/01/2018&to=01/03/2018&data_type=active_power")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/meters/36/raw_data?from=01/01/2018&to=01/03/2018&data_type=active_power"
    
    payload = ""
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("GET", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify(false);
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "https://api.wattics.com/api/v1/meters/36/raw_data?from=01/01/2018&to=01/03/2018&data_type=active_power");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    [
      {
        "timestamp": "2018-01-01T20:00:00Z",
        "phase A": 8862.4,
        "phase B": 1413.43,
        "phase C": 2487.5
      },
      {
        "timestamp": "2018-01-01T22:00:00Z",
        "phase A": 8660.86,
        "phase B": 1402.85,
        "phase C": 2481.67
      }
    ]
    
    // Or if SHOW_PHASES is false:
    [
      {
        "timestamp": "2018-01-01T20:00:00Z",
        "total": 12763.33
      },
      {
        "timestamp": "2018-01-01T22:00:00Z",
        "total": 12545.38
      }
    ]
    
    

    HTTP Request

    GET https://api.wattics.com/api/v1/meters/{METER_ID}/raw_data?from={FROM}&to={TO}&data_type={DATA_TYPE}&show_phases={SHOW_PHASES}

    URL Parameters

    Parameter Description Mandatory? Default
    METER_ID The ID of the meter that contains the raw data. YES -
    FROM Initial Date or DateTime for collect data. YES -
    TO Final Date or DateTime for collect data. The maximum allowed time interval is 90 days. YES -
    DATA_TYPE Used in case of electricity entities. Possible values are: active_power, apparent_power, power_factor, reactive_power, rms_volts, volts and rms_current YES for electricity entities -
    SHOW_PHASES Used in case of electricity entities. Set to false if you don't want to separate phases. NO true
    DETAILED Set this to true if you want the time interval to be the meter's sampling period. NO false

    Raw Data - From Appliance

    curl -X GET \
      https://api.wattics.com/api/v1/appliances/1/raw_data?from=31/05/2018&to=30/06/2018&data_type=active_power&show_phases=true \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/appliances/1/raw_data?from=31/05/2018&to=30/06/2018&data_type=active_power&show_phases=true")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.get("https://api.wattics.com/api/v1/appliances/1/raw_data?from=31/05/2018&to=30/06/2018&data_type=active_power&show_phases=true")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/appliances/1/raw_data?from=31/05/2018&to=30/06/2018&data_type=active_power&show_phases=true"
    
    payload = ""
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("GET", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify(false);
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "https://api.wattics.com/api/v1/appliances/1/raw_data?from=31/05/2018&to=30/06/2018&data_type=active_power&show_phases=true");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    [
      {
        "timestamp": "2018-01-01T20:00:00Z",
        "phase A": 8862.4,
        "phase B": 1413.43,
        "phase C": 2487.5
      },
      {
        "timestamp": "2018-01-01T22:00:00Z",
        "phase A": 8660.86,
        "phase B": 1402.85,
        "phase C": 2481.67
      }
    ]
    
    // Or if SHOW_PHASES is false:
    [
      {
        "timestamp": "2018-01-01T20:00:00Z",
        "total": 12763.33
      },
      {
        "timestamp": "2018-01-01T22:00:00Z",
        "total": 12545.38
      }
    ]
    
    

    HTTP Request

    GET https://api.wattics.com/api/v1/appliances/{APPLIANCES_ID}/raw_data?from={FROM}&to={TO}&data_type={DATA_TYPE}&show_phases={SHOW_PHASES}

    URL Parameters

    Parameter Description Mandatory? Default
    APPLIANCES_ID The ID of the appliance that contains the raw data. YES -
    FROM Initial Date or DateTime for collect data. YES -
    TO Final Date or DateTime for collect data. The maximum allowed time interval is 90 days. YES -
    DATA_TYPE Used in case of electricity entities. Possible values are: active_power, apparent_power, power_factor, reactive_power, rms_volts, volts and rms_current YES for electricity entities -
    SHOW_PHASES Used in case of electricity entities. Set to false if you don't want to separate phases. NO true
    DETAILED Set this to true if you want the time interval to be the appliance's sampling period. NO false

    Consumptions - From Meter

    curl -X GET \
      https://api.wattics.com/api/v1/meters/1/consumptions?month=10&year=2018&detailed=true \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/meters/1/consumptions?month=10&year=2018&detailed=true")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.get("https://api.wattics.com/api/v1/meters/1/consumptions?month=10&year=2018&detailed=true")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/meters/1/consumptions?month=10&year=2018&detailed=true"
    
    payload = ""
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("GET", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify(false);
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "https://api.wattics.com/api/v1/meters/1/consumptions?month=10&year=2018&detailed=true");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    [
      {
        "date": "2018-06-01",
        "weekday": "Friday",
        "total_consumption": "300500.0 Watt"
      },
      {
        "date": "2018-06-02",
        "weekday": "Saturday",
        "total_consumption": "301700.0 Watt"
      }
    ]
    
    // Or if DETAILED is true:
    [
      {
        "date": "2018-06-01",
        "weekday": "Friday",
        "total_consumption": "300500.0 Watt",
        "consumption_by_time": {
          "00h00m": "1024.03 Watt",
          "00h05m": "1011.52 Watt",
          "00h10m": "1088.15 Watt",
          "00h15m": "1037.87 Watt",
          "00h20m": "1007.05 Watt",
          ...
        }
      },
      ...
    ]
    
    

    HTTP Request

    GET https://api.wattics.com/api/v1/meters/{METER_ID}/consumptions?month={MONTH}&year={YEAR}&detailed={DETAILED}

    URL Parameters

    Parameter Description Mandatory? Default
    METER_ID The ID of the meter that contains the consumption. YES -
    MONTH The month you want to check the consumptions. YES -
    YEAR The year you want to check the consumptions. YES -
    DETAILED Set this to true if you want to check consumption by time intervals. NO false

    Consumptions - From Appliance

    curl -X GET \
      https://api.wattics.com/api/v1/appliances/1/consumptions?month=10&year=2018&detailed=true \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/appliances/1/consumptions?month=10&year=2018&detailed=true")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.get("https://api.wattics.com/api/v1/appliances/1/consumptions?month=10&year=2018&detailed=true")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/appliances/1/consumptions?month=10&year=2018&detailed=true"
    
    payload = ""
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("GET", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify(false);
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "https://api.wattics.com/api/v1/appliances/1/consumptions?month=10&year=2018&detailed=true");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    [
      {
        "date": "2018-06-01",
        "weekday": "Friday",
        "total_consumption": "300500.0 Watt"
      },
      {
        "date": "2018-06-02",
        "weekday": "Saturday",
        "total_consumption": "301700.0 Watt"
      }
    ]
    
    // Or if DETAILED is true:
    [
      {
        "date": "2018-06-01",
        "weekday": "Friday",
        "total_consumption": "300500.0 Watt",
        "consumption_by_time": {
          "00h00m": "1024.03 Watt",
          "00h05m": "1011.52 Watt",
          "00h10m": "1088.15 Watt",
          "00h15m": "1037.87 Watt",
          "00h20m": "1007.05 Watt",
          ...
        }
      },
      ...
    ]
    
    

    HTTP Request

    GET https://api.wattics.com/api/v1/appliances/{APPLIANCE_ID}/consumptions?month={MONTH}&year={YEAR}&detailed={DETAILED}

    URL Parameters

    Parameter Description Mandatory? Default
    APPLIANCE_ID The ID of the appliance that contains the consumption. YES -
    MONTH The month you want to check the consumptions. YES -
    YEAR The year you want to check the consumptions. YES -
    DETAILED Set this to true if you want to check consumption by time intervals. NO false

    Costs - From Meter

    curl -X GET \
      https://api.wattics.com/api/v1/meters/1/costs?month=10&year=2018&detailed=true \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/meters/1/costs?month=10&year=2018&detailed=true")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.get("https://api.wattics.com/api/v1/meters/1/costs?month=10&year=2018&detailed=true")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/meters/1/costs?month=10&year=2018&detailed=true"
    
    payload = ""
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("GET", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify(false);
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "https://api.wattics.com/api/v1/meters/1/costs?month=10&year=2018&detailed=true");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    [
      {
        "date": "2018-06-01",
        "weekday": "Friday",
        "total_cost": 52.500
      },
      {
        "date": "2018-06-02",
        "weekday": "Saturday",
        "total_cost": 30.000
      }
    ]
    
    // Or if DETAILED is true:
    [
      {
        "date": "2018-06-01",
        "weekday": "Friday",
        "total_cost": 30.500,
        "cost_by_time": {
          "00h00m": 0.163845,
          "00h05m": 0.161843,
          "00h10m": 0.174103,
          "00h15m": 0.166059,
          ...
        }
      },
      ...
    ]
    
    

    HTTP Request

    GET https://api.wattics.com/api/v1/meters/{METER_ID}/costs?month={MONTH}&year={YEAR}&detailed={DETAILED}

    URL Parameters

    Parameter Description Mandatory? Default
    METER_ID The ID of the meter that contains the consumption. YES -
    MONTH The month you want to check the costs. YES -
    YEAR The year you want to check the costs. YES -
    DETAILED Set this to true if you want to check consumption by time intervals. NO false

    Costs - From Appliance

    curl -X GET \
      https://api.wattics.com/api/v1/appliances/1/costs?month=10&year=2018&detailed=true \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/appliances/1/costs?month=10&year=2018&detailed=true")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.get("https://api.wattics.com/api/v1/appliances/1/costs?month=10&year=2018&detailed=true")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/appliances/1/costs?month=10&year=2018&detailed=true"
    
    payload = ""
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("GET", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify(false);
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "https://api.wattics.com/api/v1/appliances/1/costs?month=10&year=2018&detailed=true");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    [
      {
        "date": "2018-06-01",
        "weekday": "Friday",
        "total_cost": 52.500
      },
      {
        "date": "2018-06-02",
        "weekday": "Saturday",
        "total_cost": 30.000
      }
    ]
    
    // Or if DETAILED is true:
    [
      {
        "date": "2018-06-01",
        "weekday": "Friday",
        "total_cost": 30.500,
        "cost_by_time": {
          "00h00m": 0.163845,
          "00h05m": 0.161843,
          "00h10m": 0.174103,
          "00h15m": 0.166059,
          ...
        }
      },
      ...
    ]
    
    

    HTTP Request

    GET https://api.wattics.com/api/v1/appliances/{APPLIANCE_ID}/costs?month={MONTH}&year={YEAR}&detailed={DETAILED}

    URL Parameters

    Parameter Description Mandatory? Default
    APPLIANCE_ID The ID of the appliance that contains the costs. YES -
    MONTH The month you want to check the costs. YES -
    YEAR The year you want to check the costs. YES -
    DETAILED Set this to true if you want to check costs by time intervals. NO false

    Tariffs - Create

    curl -X POST \
      https://api.wattics.com/api/v1/tariffs \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
      -d '{
        "site_id": 1,
        "starting_date": "2021-01-01",
        "ending_date": "2021-06-01",
        "name": "From API",
        "tariff_type": "electricity",
        "co2_factor": 0.2,
        "periods": [
            {
                "from_day": 1,
                "from_month": 1,
                "until_day": 28,
                "until_month": 2,
                "pricings": [
                    {
                        "day_of_week": 0,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 1,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 2,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 3,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 4,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 5,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 6,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    }
                ]
            },
            {
                "from_day": 1,
                "from_month": 3,
                "until_day": 31,
                "until_month": 12,
                "pricings": [
                    {
                        "day_of_week": 0,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 1,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 2,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 3,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 4,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 5,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 6,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    }
                ]
            }
        ]
    }'
    
    require 'uri'
    require 'net/http'
    data = {
        "site_id": 1,
        "starting_date": "2021-01-01",
        "ending_date": "2021-06-01",
        "name": "From API",
        "tariff_type": "electricity",
        "co2_factor": 0.2,
        "periods": [
            {
                "from_day": 1,
                "from_month": 1,
                "until_day": 28,
                "until_month": 2,
                "pricings": [
                    {
                        "day_of_week": 0,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 1,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 2,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 3,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 4,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 5,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 6,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    }
                ]
            },
            {
                "from_day": 1,
                "from_month": 3,
                "until_day": 31,
                "until_month": 12,
                "pricings": [
                    {
                        "day_of_week": 0,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 1,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 2,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 3,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 4,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 5,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 6,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    }
                ]
            }
        ]
    }
    url = URI("https://api.wattics.com/api/v1/tariffs")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Post.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    request.body = data.to_json
    
    response = http.request(request)
    puts response.read_body
    
    data = {
        "site_id": 1,
        "starting_date": "2021-01-01",
        "ending_date": "2021-06-01",
        "name": "From API",
        "tariff_type": "electricity",
        "co2_factor": 0.2,
        "periods": [
            {
                "from_day": 1,
                "from_month": 1,
                "until_day": 28,
                "until_month": 2,
                "pricings": [
                    {
                        "day_of_week": 0,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 1,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 2,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 3,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 4,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 5,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 6,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    }
                ]
            },
            {
                "from_day": 1,
                "from_month": 3,
                "until_day": 31,
                "until_month": 12,
                "pricings": [
                    {
                        "day_of_week": 0,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 1,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 2,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 3,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 4,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 5,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 6,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    }
                ]
            }
        ]
    }
    HttpResponse<String> response = Unirest.post("https://api.wattics.com/api/v1/tariffs")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .body(data)
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/tariffs"
    
    payload = {
        "site_id": 1,
        "starting_date": "2021-01-01",
        "ending_date": "2021-06-01",
        "name": "From API",
        "tariff_type": "electricity",
        "co2_factor": 0.2,
        "periods": [
            {
                "from_day": 1,
                "from_month": 1,
                "until_day": 28,
                "until_month": 2,
                "pricings": [
                    {
                        "day_of_week": 0,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 1,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 2,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 3,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 4,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 5,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 6,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    }
                ]
            },
            {
                "from_day": 1,
                "from_month": 3,
                "until_day": 31,
                "until_month": 12,
                "pricings": [
                    {
                        "day_of_week": 0,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 1,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 2,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 3,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 4,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 5,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 6,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    }
                ]
            }
        ]
    }
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("POST", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify({
        "site_id": 1,
        "starting_date": "2021-01-01",
        "ending_date": "2021-06-01",
        "name": "From API",
        "tariff_type": "electricity",
        "co2_factor": 0.2,
        "periods": [
            {
                "from_day": 1,
                "from_month": 1,
                "until_day": 28,
                "until_month": 2,
                "pricings": [
                    {
                        "day_of_week": 0,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 1,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 2,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 3,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 4,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 5,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 6,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    }
                ]
            },
            {
                "from_day": 1,
                "from_month": 3,
                "until_day": 31,
                "until_month": 12,
                "pricings": [
                    {
                        "day_of_week": 0,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 1,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 2,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 3,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 4,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 5,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 6,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    }
                ]
            }
        ]
    });
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("POST", "https://api.wattics.com/api/v1/tariffs");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    {
      "success": true,
      "id": NEW_TARIFF_ID
    }
    

    This endpoint creates a new tariff.

    HTTP Request

    POST https://api.wattics.com/api/v1/tariffs

    Tariff Parameters

    Parameter Description Optional
    SITE_ID Site to place the tariff NO
    STARTING_DATE Start of tariff validity NO
    ENDING_DATE End of tariff validity NO
    NAME Name for the tariff NO
    TARIFF_TYPE Type of data point to apply the tariff (electricity / gas / water) NO
    CO2_FACTOR CO2 factor to be used when doing analysis (e.g.: breakdown tab) YES
    PERIODS Periods containing the different parts of the year and its pricings NO
    PERIODS - FROM_DAY Day of the beginning of the pricing period NO
    PERIODS - FROM_MONTH Month of the beginning of the pricing period NO
    PERIODS - UNTIL_DAY Day of the end of the pricing period NO
    PERIODS - UNTIL_MONTH Month of the end of the pricing period NO
    PERIODS - PRICINGS List of pricings separated by day of the week (0 is Sunday) NO

    Tariffs - Update

    curl -X PUT \
      https://api.wattics.com/api/v1/tariffs/TARIFF_ID \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
      -d '{
        "starting_date": "2021-01-01",
        "ending_date": "2021-06-01",
        "name": "From API",
        "co2_factor": 0.2,
        "periods": [
            {
                "from_day": 1,
                "from_month": 1,
                "until_day": 28,
                "until_month": 2,
                "pricings": [
                    {
                        "day_of_week": 0,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 1,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 2,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 3,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 4,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 5,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 6,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    }
                ]
            },
            {
                "from_day": 1,
                "from_month": 3,
                "until_day": 31,
                "until_month": 12,
                "pricings": [
                    {
                        "day_of_week": 0,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 1,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 2,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 3,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 4,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 5,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 6,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    }
                ]
            }
        ]
    }'
    
    require 'uri'
    require 'net/http'
    body = {
        "starting_date": "2021-01-01",
        "ending_date": "2021-06-01",
        "name": "From API",
        "co2_factor": 0.2,
        "periods": [
            {
                "from_day": 1,
                "from_month": 1,
                "until_day": 28,
                "until_month": 2,
                "pricings": [
                    {
                        "day_of_week": 0,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 1,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 2,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 3,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 4,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 5,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 6,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    }
                ]
            },
            {
                "from_day": 1,
                "from_month": 3,
                "until_day": 31,
                "until_month": 12,
                "pricings": [
                    {
                        "day_of_week": 0,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 1,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 2,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 3,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 4,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 5,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 6,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    }
                ]
            }
        ]
    }
    url = URI("https://api.wattics.com/api/v1/tariffs/TARIFF_ID")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Put.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    request.body = body.to_json
    
    response = http.request(request)
    puts response.read_body
    
    data = {
        "starting_date": "2021-01-01",
        "ending_date": "2021-06-01",
        "name": "From API",
        "co2_factor": 0.2,
        "periods": [
            {
                "from_day": 1,
                "from_month": 1,
                "until_day": 28,
                "until_month": 2,
                "pricings": [
                    {
                        "day_of_week": 0,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 1,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 2,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 3,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 4,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 5,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 6,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    }
                ]
            },
            {
                "from_day": 1,
                "from_month": 3,
                "until_day": 31,
                "until_month": 12,
                "pricings": [
                    {
                        "day_of_week": 0,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 1,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 2,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 3,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 4,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 5,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 6,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    }
                ]
            }
        ]
    }
    HttpResponse<String> response = Unirest.put("https://api.wattics.com/api/v1/tariffs/TARIFF_ID")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .body(data)
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/tariffs/TARIFF_ID"
    
    payload = {
        "starting_date": "2021-01-01",
        "ending_date": "2021-06-01",
        "name": "From API",
        "co2_factor": 0.2,
        "periods": [
            {
                "from_day": 1,
                "from_month": 1,
                "until_day": 28,
                "until_month": 2,
                "pricings": [
                    {
                        "day_of_week": 0,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 1,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 2,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 3,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 4,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 5,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 6,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    }
                ]
            },
            {
                "from_day": 1,
                "from_month": 3,
                "until_day": 31,
                "until_month": 12,
                "pricings": [
                    {
                        "day_of_week": 0,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 1,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 2,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 3,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 4,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 5,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 6,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    }
                ]
            }
        ]
    }
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("PUT", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify({
        "starting_date": "2021-01-01",
        "ending_date": "2021-06-01",
        "name": "From API",
        "co2_factor": 0.2,
        "periods": [
            {
                "from_day": 1,
                "from_month": 1,
                "until_day": 28,
                "until_month": 2,
                "pricings": [
                    {
                        "day_of_week": 0,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 1,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 2,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 3,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 4,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 5,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    },
                    {
                        "day_of_week": 6,
                        "00_00": 0.3, "00_30": 0.3, "01_00": 0.3, "01_30": 0.3, "02_00": 0.3, "02_30": 0.3, "03_00": 0.3, "03_30": 0.3, "04_00": 0.3, "04_30": 0.3, "05_00": 0.3, "05_30": 0.3, "06_00": 0.3, "06_30": 0.3, "07_00": 0.3, "07_30": 0.3, "08_00": 0.3, "08_30": 0.3, "09_00": 0.3, "09_30": 0.3, "10_00": 0.3, "10_30": 0.3, "11_00": 0.3, "11_30": 0.3, "12_00": 0.3, "12_30": 0.3, "13_00": 0.3, "13_30": 0.3, "14_00": 0.3, "14_30": 0.3, "15_00": 0.3, "15_30": 0.3, "16_00": 0.3, "16_30": 0.3, "17_00": 0.3, "17_30": 0.3, "18_00": 0.3, "18_30": 0.3, "19_00": 0.3, "19_30": 0.3, "20_00": 0.3, "20_30": 0.3, "21_00": 0.3, "21_30": 0.3, "22_00": 0.3, "22_30": 0.3, "23_00": 0.3, "23_30": 0.3
                    }
                ]
            },
            {
                "from_day": 1,
                "from_month": 3,
                "until_day": 31,
                "until_month": 12,
                "pricings": [
                    {
                        "day_of_week": 0,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 1,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 2,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 3,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 4,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 5,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    },
                    {
                        "day_of_week": 6,
                        "00_00": 0.5, "00_30": 0.5, "01_00": 0.5, "01_30": 0.5, "02_00": 0.5, "02_30": 0.5, "03_00": 0.5, "03_30": 0.5, "04_00": 0.5, "04_30": 0.5, "05_00": 0.5, "05_30": 0.5, "06_00": 0.5, "06_30": 0.5, "07_00": 0.5, "07_30": 0.5, "08_00": 0.5, "08_30": 0.5, "09_00": 0.5, "09_30": 0.5, "10_00": 0.5, "10_30": 0.5, "11_00": 0.5, "11_30": 0.5, "12_00": 0.5, "12_30": 0.5, "13_00": 0.5, "13_30": 0.5, "14_00": 0.5, "14_30": 0.5, "15_00": 0.5, "15_30": 0.5, "16_00": 0.5, "16_30": 0.5, "17_00": 0.5, "17_30": 0.5, "18_00": 0.5, "18_30": 0.5, "19_00": 0.5, "19_30": 0.5, "20_00": 0.5, "20_30": 0.5, "21_00": 0.5, "21_30": 0.5, "22_00": 0.5, "22_30": 0.5, "23_00": 0.5, "23_30": 0.5
                    }
                ]
            }
        ]
    });
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("PUT", "https://api.wattics.com/api/v1/tariffs/TARIFF_ID");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    {
      "success": true
    }
    

    This endpoint updates a tariff.

    HTTP Request

    PUT https://api.wattics.com/api/v1/tariffs/{TARIFF_ID}

    Tariff Parameters

    Parameter Description Optional
    TARIFF_ID Id of the tariff NO
    STARTING_DATE Start of tariff validity NO
    ENDING_DATE End of tariff validity NO
    NAME Name for the tariff NO
    CO2_FACTOR CO2 factor to be used when doing analysis (e.g.: breakdown tab) YES
    PERIODS Periods containing the different parts of the year and its pricings NO
    PERIODS - FROM_DAY Day of the beginning of the pricing period NO
    PERIODS - FROM_MONTH Month of the beginning of the pricing period NO
    PERIODS - UNTIL_DAY Day of the end of the pricing period NO
    PERIODS - UNTIL_MONTH Month of the end of the pricing period NO
    PERIODS - PRICINGS List of pricings separated by day of the week (0 is Sunday) NO

    Tariffs - Delete

    curl -X DELETE \
      https://api.wattics.com/api/v1/tariffs/TARIFF_ID \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json'
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/tariffs/TARIFF_ID")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Delete.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    
    response = http.request(request)
    
    HttpResponse<String> response = Unirest.delete("https://api.wattics.com/api/v1/tariffs/TARIFF_ID")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/tariffs/TARIFF_ID"
    
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("DELETE", url, headers=headers)
    
    print(response.text)
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("DELETE", "https://api.wattics.com/api/v1/tariffs/TARIFF_ID");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send();
    

    The above command returns JSON structured like this:

    {
      "success": true
    }
    

    This endpoint deletes an existing tariff.

    HTTP Request

    DELETE https://api.wattics.com/api/v1/tariffs/{TARIFF_ID}

    Tariff Parameters

    Parameter Description Optional
    TARIFF_ID id of the tariff NO

    Tariffs - Get

    curl -X GET \
      https://api.wattics.com/api/v1/tariffs/ID \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/tariffs/ID")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.get("https://api.wattics.com/api/v1/tariffs/ID")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/tariffs/ID"
    
    payload = ""
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("GET", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify(false);
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "https://api.wattics.com/api/v1/tariffs/ID");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    {
      "name": "Airtricity",
      "tariff_periods": [
        {
          "from": "01/01",
          "to": "31/03",
          "monday": {
            "00h00m": -0.12,
            "00h30m": -0.12,
            "01h00m": -0.12,
            "01h30m": -0.12,
            "02h00m": -0.12,
            ...
            "tuesday": {
              "00h00m": -0.12,
              "00h30m": -0.12,
              "01h00m": -0.12,
              "01h30m": -0.12,
              "02h00m": -0.12,
              ...
              ...
    
    

    This endpoint retrieves a specific tariff.

    HTTP Request

    GET http://api.wattics.com/api/v1/tariffs/{TARIFF_ID}

    URL Parameters

    Parameter Description Optional
    TARIFF_ID The ID of the tariff to retrieve NO

    Tariffs - From Site

    curl -X GET \
      https://api.wattics.com/api/v1/sites/ID/tariffs \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/sites/ID/tariffs")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.get("https://api.wattics.com/api/v1/sites/ID/tariffs")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/sites/ID/tariffs"
    
    payload = ""
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("GET", url, data=payload, headers=headers)
    
    print(response.text)
    
    var data = JSON.stringify(false);
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "https://api.wattics.com/api/v1/sites/ID/tariffs");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above command returns JSON structured like this:

    {
      "electricity": [
        {
          "id": 1,
          "name": "Tariff1",
          "from": "2012-08-01",
          "to": "2018-03-31"
        },
        {
          "id": 2,
          "name": "Tariff2",
          "from": "2018-04-01",
          "to": "2018-04-28"
        },
        {
          "id": 3,
          "name": "Tariff3",
          "from": "2018-04-28",
          "to": "now"
        }
      ],
      "water": [
        {
          "id": 4,
          "name": "Tariff4",
          "from": "2015-12-30",
          "to": "now"
        }
      ],
      "gas": [
        {
          "id": 5,
          "name": "Tariff5",
          "from": "2015-12-30",
          "to": "now"
        }
      ]
    }
    

    This endpoint retrieves all sites of an organization that the api token owner has access.

    HTTP Request

    GET https://api.wattics.com/api/v1/sites/{SITE_ID}/tariffs

    URL Parameters

    Parameter Description Optional
    SITE_ID The ID of the site that contains the tariffs NO

    Report Definitions - List

    curl -X GET \
      https://api.wattics.com/api/v1/report_definitions \
      -H 'Authorization: YOUR_API_TOKEN_HERE' \
      -H 'Content-Type: application/json' \
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.wattics.com/api/v1/report_definitions")
    
    http = Net::HTTP.new(url.host, url.port)
    
    request = Net::HTTP::Get.new(url)
    request["Content-Type"] = 'application/json'
    request["Authorization"] = 'YOUR_API_TOKEN_HERE'
    
    response = http.request(request)
    puts response.read_body
    
    HttpResponse<String> response = Unirest.get("https://api.wattics.com/api/v1/report_definitions")
      .header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_TOKEN_HERE")
      .asString();
    
    import requests
    
    url = "https://api.wattics.com/api/v1/report_definitions"
    
    headers = {
        'Content-Type': "application/json",
        'Authorization': "YOUR_API_TOKEN_HERE",
        }
    
    response = requests.request("GET", url, headers=headers)
    
    print(response.text)
    
    var data = null;
    
    var xhr = new XMLHttpRequest();
    
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "https://api.wattics.com/api/v1/report_definitions");
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");
    
    xhr.send(data);
    

    The above commands returns JSON structured like this:

    [
        {
            "id": 1,
            "name": "Report 1",
            "users": [
                {
                    "id": 1,
                    "email": "[email protected]",
                },
                {
                    "id": 2,
                    "email": "[email protected]",
                }
            ],
            "sites_used": "SPECIFIC_LIST",
            "sites": [
                {
                    "id": 1,
                    "name": "Site 1"
                },
                {
                    "id": 2,
                    "name": "Site 2"
                }
            ]
        },
        {
            "id": 2,
            "name": "Report 2",
            "users": [
                {
                    "id": 1,
                    "email": "[email protected]"
                }
            ],
            "sites_used": "ALL_ASSOCIATED_TO_USERS"
        }
    ]
    

    This endpoint retrieves all report definitions created in the partner dashboard that the api-token's owner has access. If the report is associated to specific sites, the response will contain the sites list.

    HTTP Request

    GET https://api.wattics.com/api/v1/report_definitions

    Errors

    The Wattics API uses the following error codes:

    Error Code Meaning
    400 Bad Request -- Your request is invalid.
    401 Unauthorized -- Your API key is wrong.
    403 Forbidden -- The resource requested is not allowed to the user who owns the token.
    404 Not Found -- The specified resource could not be found.
    422 Unprocessable Entity -- Resource transformation invalid
    500 Internal Server Error -- We had a problem with our server. Try again later.
    503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.