Assign a timeline reason
Assigns a timeline reason to a machine, allowing users to track specific operational events such as machine downtimes or other predefined reasons. The assignment can be used for labeling machine status changes in real-time or for historical adjustments.
curl -X POST "https://wm.novoai.de/v2/timeline/reason_assign" \
-H "Content-Type: application/json" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN (JWT)" \
-H "X-API-KEY: YOUR_API_KEY" \
-d '{
"data": [
{
"machine_id": 1,
"timeline_reason_id": 1,
"operation": "add",
"idx": 1
}
]
}'
import requests
import json
url = "https://wm.novoai.de/v2/timeline/reason_assign"
headers = {
"Content-Type": "application/json",
"accept": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN (JWT)",
"X-API-KEY": "YOUR_API_KEY"
}
data = {
"data": [
{
"machine_id": 1,
"timeline_reason_id": 1,
"operation": "add",
"idx": 1
}
]
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://wm.novoai.de/v2/timeline/reason_assign", {
method: "POST",
headers: {
"Content-Type": "application/json",
"accept": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN (JWT)",
"X-API-KEY": "YOUR_API_KEY"
},
body: JSON.stringify({
"data": [
{
"machine_id": 1,
"timeline_reason_id": 1,
"operation": "add",
"idx": 1
}
]
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"data": [
{
"machine_id": 1,
"timeline_reason_id": 1,
"operation": "add",
"idx": 1
}
]
}`)
req, err := http.NewRequest("POST", "https://wm.novoai.de/v2/timeline/reason_assign", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("accept", "application/json")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN (JWT)")
req.Header.Set("X-API-KEY", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://wm.novoai.de/v2/timeline/reason_assign')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['accept'] = 'application/json'
request['Content-Type'] = 'application/json'
request['Authorization'] = 'Bearer YOUR_API_TOKEN (JWT)'
request['X-API-KEY'] = 'YOUR_API_KEY'
request.body = '{
"data": [
{
"machine_id": 1,
"timeline_reason_id": 1,
"operation": "add",
"idx": 1
}
]
}'
response = http.request(request)
puts response.body
{
"message": "Successfully assigned timeline reason.",
"status": 1
}
{
"status": 0,
"message": "Invalid request data."
}
{
"status": 0,
"message": "Unauthorized access."
}
{
"status": 0,
"message": "Machine with ID 1 not found for the current company."
}
{
"status": 0,
"message": "An unexpected error occurred."
}
/v2/timeline/reason_assign
Target server for requests. Edit to use your own host.
JWT Bearer token authentication. Include in the Authorization header as Bearer <token>.
Bearer <token>.API-Access Key authentication. Include the generated key in the X-API-KEY header.
X-API-KEY header.The media type of the request body
Must be application/json.
Must be application/json for POST requests.
List of assignments.
Request Preview
Response
Response will appear here after sending the request
Authentication
Bearer token (JWT). JWT Bearer token authentication. Include in the Authorization header as Bearer \<token\>.
API Key for authentication. API-Access Key authentication. Include the generated key in the X-API-KEY header.
Headers
Body
List of assignments.
Responses
Success confirmation message.
Indicates the success of the request. 1 for success, 0 for failure.