## Copy LookupTableRevisionData

### cURL

```bash
curl --request POST \
  --url https://api.m3ter.com/organizations/{orgId}/lookuptables/{lookupTableId}/revisions/{lookupTableRevisionId}/data/copy \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "revisionId": "<string>"
}
'```

### Python

```python
import requests

url = "https://api.m3ter.com/organizations/{orgId}/lookuptables/{lookupTableId}/revisions/{lookupTableRevisionId}/data/copy"

payload = { "revisionId": "<string>" }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.text)
```

### JavaScript (Fetch)

```javascript
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({revisionId: '<string>'})
};

fetch('https://api.m3ter.com/organizations/{orgId}/lookuptables/{lookupTableId}/revisions/{lookupTableRevisionId}/data/copy', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### PHP

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, [\
  CURLOPT_URL => "https://api.m3ter.com/organizations/{orgId}/lookuptables/{lookupTableId}/revisions/{lookupTableRevisionId}/data/copy",\
  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([\
    'revisionId' => '<string>'\\
  ]),\
  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;
}
?>
```

### Go

```go
package main

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

func main() {

url := "https://api.m3ter.com/organizations/{orgId}/lookuptables/{lookupTableId}/revisions/{lookupTableRevisionId}/data/copy"

payload := strings.NewReader("{\n  \"revisionId\": \"<string>\"\n}")

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))
}
```

### Java (Unirest)

```java
HttpResponse<String> response = Unirest.post("https://api.m3ter.com/organizations/{orgId}/lookuptables/{lookupTableId}/revisions/{lookupTableRevisionId}/data/copy")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"revisionId\": \"<string>\"\n}")
  .asString();
```

### Ruby

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.m3ter.com/organizations/{orgId}/lookuptables/{lookupTableId}/revisions/{lookupTableRevisionId}/data/copy")

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  \"revisionId\": \"<string>\"\n}"

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

### HTTP Status Codes

- **200**: Returns the Data JobId and target RevisionId
  
```json
{
  "jobId": "<string>",
  "revisionId": "<string>"
}
```

- **4XX**: Error messages in the format
  
```json
{
  "message": "<string>"
}
```

- **5XX**: Error messages in the format
  
```json
{
  "message": "<string>"
}
```

### Authorizations

- **Authorization**: Required, string in header. It supports machine to machine authentication using the `clientCredentials` OAuth2 flow. 
 
### Path Parameters

- `orgId`: Required, UUID of the Organization. The Organization represents your company as a direct customer of the m3ter service.
- `lookupTableId`: Required, UUID of the Lookup Table.
- `lookupTableRevisionId`: Required, UUID of the source Lookup Table Revision to copy from.

### Body

- `revisionId`: The target Revision id that the source Revision's data will be copied to. _(Optional)_

### Response

Returns the Data JobId and target RevisionId.
