Download Bills URL - m3ter Documentation

Download Bills URL

cURL

curl --request POST \
  --url https://api.m3ter.com/organizations/{orgId}/bills/download/csv/url \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "startDate": "2019-08-24T14:15:22Z",
  "endDate": "2019-08-24T14:15:22Z",
  "externalSystem": "STANDARD"
}
'```

```python
import requests

url = "https://api.m3ter.com/organizations/{orgId}/bills/download/csv/url"

payload = {
    "startDate": "2019-08-24T14:15:22Z",
    "endDate": "2019-08-24T14:15:22Z",
    "externalSystem": "STANDARD"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    startDate: '2019-08-24T14:15:22Z',
    endDate: '2019-08-24T14:15:22Z',
    externalSystem: 'STANDARD'
  })
};

fetch('https://api.m3ter.com/organizations/{orgId}/bills/download/csv/url', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.m3ter.com/organizations/{orgId}/bills/download/csv/url",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'startDate' => '2019-08-24T14:15:22Z',
    'endDate' => '2019-08-24T14:15:22Z',
    'externalSystem' => 'STANDARD'
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
?>
package main

import (
    "fmt"
    "strings"
    "net/http"
    "io"
)

func main() {

url := "https://api.m3ter.com/organizations/{orgId}/bills/download/csv/url"

payload := strings.NewReader("{\n  \"startDate\": \"2019-08-24T14:15:22Z\",\n  \"endDate\": \"2019-08-24T14:15:22Z\",\n  \"externalSystem\": \"STANDARD\"\}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
    req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
    body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))
}
HttpResponse<String> response = Unirest.post("https://api.m3ter.com/organizations/{orgId}/bills/download/csv/url")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"startDate\": \"2019-08-24T14:15:22Z\",\n  \"endDate\": \"2019-08-24T14:15:22Z\",\n  \"externalSystem\": \"STANDARD\"\}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.m3ter.com/organizations/{orgId}/bills/download/csv/url")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"startDate\": \"2019-08-24T14:15:22Z\",\n  \"endDate\": \"2019-08-24T14:15:22Z\",\n  \"externalSystem\": \"STANDARD\"\}"

response = http.request(request)
puts response.read_body

Response

Success Responses

Authorizations

Field Type In Required Description
authorization string header Yes m3ter supports machine to machine authentication using the clientCredentials OAuth2 flow.

Path Parameters

Parameter Type Required Description
orgId string Yes The unique identifier (UUID) of your Organization. The Organization represents your company as a direct customer of our service.

Request Body

Field Type Required Description
startDate string Yes Specifies the start date of the billing period for downloading Bills.
endDate string Yes Specifies the end date of the billing period for downloading Bills.
externalInvoiceDateStart string No (Optional). Specifies the start date in ISO 8601 format for filtering Bills by external invoice date.
externalInvoiceDateEnd string No (Optional). Specifies the end date in ISO 8601 format for filtering Bills by external invoice date.
externalSystem enum Yes Use this parameter for integration with Xero system. Available options: STANDARD, XERO.

Response Structure

{
  "downloadUrl": "<string>"
}
{
  "message": "<string>"
}