Endpoints

Address

Endpoint: const url = "https://projects.sbw.media/Address";

Update: const url = `https://projects.sbw.media/Address/${addressId}`;

Note: views are not updatable

key: is auto increment: ja

Fields:

address: {
	ID: 0,                 // type: int
	StreetNr: "",          // type: string
	ZIP: "",               // type: string
	City: "",              // type: string
	CountryID: "",         // type: string
}
Country

Endpoint: const url = "https://projects.sbw.media/Country";

Update: const url = `https://projects.sbw.media/Country/${countryId}`;

Note: views are not updatable

key: is auto increment: nein

Fields:

country: {
	ISO: "",               // type: string
	German: "",            // type: string
}
Customer

Endpoint: const url = "https://projects.sbw.media/Customer";

Update: const url = `https://projects.sbw.media/Customer/${customerId}`;

Note: views are not updatable

key: is auto increment: ja

Fields:

customer: {
	ID: 0,                 // type: int
	Name: "",              // type: string
	Email: "",             // type: string
	AddressID: 0,          // type: int
	BillingAddressID: 0,   // type: int
}
CustomerView

Endpoint: const url = "https://projects.sbw.media/CustomerView";

Update: const url = `https://projects.sbw.media/CustomerView/${customerViewId}`;

Note: views are not updatable

key: is auto increment: nein

Fields:

customerView: {
	ID: 0,                 // type: int
	Name: "",              // type: string
	Email: "",             // type: string
	AddressID: 0,          // type: int
	StreetNr: "",          // type: string
	ZIP: "",               // type: string
	City: "",              // type: string
	Country: "",           // type: string
}
Department

Endpoint: const url = "https://projects.sbw.media/Department";

Update: const url = `https://projects.sbw.media/Department/${departmentId}`;

Note: views are not updatable

key: is auto increment: ja

Fields:

department: {
	ID: 0,                 // type: int
	Name: "",              // type: string
}
DepartmentMember

Endpoint: const url = "https://projects.sbw.media/DepartmentMember";

Update: const url = `https://projects.sbw.media/DepartmentMember/${departmentMemberId}`;

Note: views are not updatable

key: is auto increment: ja

Fields:

departmentMember: {
	ID: 0,                 // type: int
	DepartmentID: 0,       // type: int
	StudentID: 0,          // type: int
	FromDate: "",          // type: Date
}
DepartmentMemberView

Endpoint: const url = "https://projects.sbw.media/DepartmentMemberView";

Update: const url = `https://projects.sbw.media/DepartmentMemberView/${departmentMemberViewId}`;

Note: views are not updatable

key: is auto increment: nein

Fields:

departmentMemberView: {
	ID: 0,                 // type: int
	StudentID: 0,          // type: int
	fullname: "",          // type: string
	year: 0,               // type: int
	DepartmentID: 0,       // type: int
	Name: "",              // type: string
	FromDate: "",          // type: Date
}
Equipment

Endpoint: const url = "https://projects.sbw.media/Equipment";

Update: const url = `https://projects.sbw.media/Equipment/${equipmentId}`;

Note: views are not updatable

key: is auto increment: ja

Fields:

equipment: {
	ID: 0,                 // type: int
	EquipmentTypeID: 0,    // type: int
	Name: "",              // type: string
	Number: "",            // type: string
	Description: "",       // type: string
}
EquipmentReservation

Endpoint: const url = "https://projects.sbw.media/EquipmentReservation";

Update: const url = `https://projects.sbw.media/EquipmentReservation/${equipmentReservationId}`;

Note: views are not updatable

key: is auto increment: ja

Fields:

equipmentReservation: {
	ID: 0,                 // type: int
	EquipmentID: 0,        // type: int
	StudentID: 0,          // type: int
	Start: "",             // type: Date
	End: "",               // type: Date
}
EquipmentView

Endpoint: const url = "https://projects.sbw.media/EquipmentView";

Update: const url = `https://projects.sbw.media/EquipmentView/${equipmentViewId}`;

Note: views are not updatable

key: is auto increment: nein

Fields:

equipmentView: {
	ID: 0,                 // type: int
	Name: "",              // type: string
	Number: "",            // type: string
	Description: "",       // type: string
	Type: "",              // type: string
}
Equipmenttype

Endpoint: const url = "https://projects.sbw.media/Equipmenttype";

Update: const url = `https://projects.sbw.media/Equipmenttype/${equipmenttypeId}`;

Note: views are not updatable

key: is auto increment: ja

Fields:

equipmenttype: {
	ID: 0,                 // type: int
	Name: "",              // type: string
}
Project

Endpoint: const url = "https://projects.sbw.media/Project";

Update: const url = `https://projects.sbw.media/Project/${projectId}`;

Note: views are not updatable

key: is auto increment: ja

Fields:

project: {
	ID: 0,                 // type: int
	ParentID: 0,           // type: int
	Number: "",            // type: string
	Name: "",              // type: string
	Description: "",       // type: string
	TypeID: 0,             // type: int
	CustomerID: 0,         // type: int
	Coach: "",             // type: string
	Status: 0,             // type: int
}
Projectrole

Endpoint: const url = "https://projects.sbw.media/Projectrole";

Update: const url = `https://projects.sbw.media/Projectrole/${projectroleId}`;

Note: views are not updatable

key: is auto increment: nein

Fields:

projectrole: {
	ID: "",                // type: string
	Name: "",              // type: string
}
Projecttype

Endpoint: const url = "https://projects.sbw.media/Projecttype";

Update: const url = `https://projects.sbw.media/Projecttype/${projecttypeId}`;

Note: views are not updatable

key: is auto increment: ja

Fields:

projecttype: {
	ID: 0,                 // type: int
	Name: "",              // type: string
}
Student

Endpoint: const url = "https://projects.sbw.media/Student";

Update: const url = `https://projects.sbw.media/Student/${studentId}`;

Note: views are not updatable

key: is auto increment: ja

Fields:

student: {
	ID: 0,                 // type: int
	Firstname: "",         // type: string
	Name: "",              // type: string
	Year: 0,               // type: int
	Fullname: "",          // type: string
}
Studentroleproject

Endpoint: const url = "https://projects.sbw.media/Studentroleproject";

Update: const url = `https://projects.sbw.media/Studentroleproject/${studentroleprojectId}`;

Note: views are not updatable

key: is auto increment: ja

Fields:

studentroleproject: {
	ID: 0,                 // type: int
	StudentID: 0,          // type: int
	ProjectID: 0,          // type: int
	Start: "",             // type: Date
	ProjectRoleID: "",     // type: string
	End: "",               // type: Date
}
Task

Endpoint: const url = "https://projects.sbw.media/Task";

Update: const url = `https://projects.sbw.media/Task/${taskId}`;

Note: views are not updatable

key: is auto increment: ja

Fields:

task: {
	ID: 0,                 // type: int
	ProjectID: 0,          // type: int
	StudentID: 0,          // type: int
	Name: "",              // type: string
	Start: "",             // type: Date
	Due: "",               // type: Date
	Done: 0,               // type: int
}
TaskView

Endpoint: const url = "https://projects.sbw.media/TaskView";

Update: const url = `https://projects.sbw.media/TaskView/${taskViewId}`;

Note: views are not updatable

key: is auto increment: nein

Fields:

taskView: {
	ID: 0,                 // type: int
	ProjectID: 0,          // type: int
	ProjectName: "",       // type: string
	StudentID: 0,          // type: int
	StudentName: "",       // type: string
	TaskName: "",          // type: string
	Start: "",             // type: Date
	Due: "",               // type: Date
	done: 0,               // type: int
}
Teacher

Endpoint: const url = "https://projects.sbw.media/Teacher";

Update: const url = `https://projects.sbw.media/Teacher/${teacherId}`;

Note: views are not updatable

key: is auto increment: nein

Fields:

teacher: {
	Abbr: "",              // type: string
	Name: "",              // type: string
	Firstname: "",         // type: string
	FullName: "",          // type: string
}
Test

Endpoint: const url = "https://projects.sbw.media/Test";

Update: const url = `https://projects.sbw.media/Test/${testId}`;

Note: views are not updatable

key: is auto increment: ja

Fields:

test: {
	test_ID: 0,            // type: int
	Name: "",              // type: string
	Size: "",              // type: float
	Date: "",              // type: Date
}
Timesheet

Endpoint: const url = "https://projects.sbw.media/Timesheet";

Update: const url = `https://projects.sbw.media/Timesheet/${timesheetId}`;

Note: views are not updatable

key: is auto increment: ja

Fields:

timesheet: {
	ID: 0,                 // type: int
	ProjectID: 0,          // type: int
	StudentID: 0,          // type: int
	Date: "",              // type: Date
	Minutes: 0,            // type: int
	Approved: 0,           // type: int
}
TimesheetView

Endpoint: const url = "https://projects.sbw.media/TimesheetView";

Update: const url = `https://projects.sbw.media/TimesheetView/${timesheetViewId}`;

Note: views are not updatable

key: is auto increment: nein

Fields:

timesheetView: {
	ID: 0,                 // type: int
	StudentID: 0,          // type: int
	Fullname: "",          // type: string
	ProjectName: "",       // type: string
	Number: "",            // type: string
	Date: "",              // type: Date
	Minutes: 0,            // type: int
	Approved: 0,           // type: int
}
Vacation

Endpoint: const url = "https://projects.sbw.media/Vacation";

Update: const url = `https://projects.sbw.media/Vacation/${vacationId}`;

Note: views are not updatable

key: is auto increment: ja

Fields:

vacation: {
	ID: 0,                 // type: int
	VacationTypeID: 0,     // type: int
	StudentID: 0,          // type: int
	FromDate: "",          // type: Date
	ToDate: "",            // type: Date
}
VacationView

Endpoint: const url = "https://projects.sbw.media/VacationView";

Update: const url = `https://projects.sbw.media/VacationView/${vacationViewId}`;

Note: views are not updatable

key: is auto increment: nein

Fields:

vacationView: {
	ID: 0,                 // type: int
	VacationType: "",      // type: string
	StudentID: 0,          // type: int
	Fullname: "",          // type: string
	FromDate: "",          // type: Date
	ToDate: "",            // type: Date
}
Vacationtype

Endpoint: const url = "https://projects.sbw.media/Vacationtype";

Update: const url = `https://projects.sbw.media/Vacationtype/${vacationtypeId}`;

Note: views are not updatable

key: is auto increment: ja

Fields:

vacationtype: {
	ID: 0,                 // type: int
	Name: "",              // type: string
}

Suchen

Endpoints
Bei Endpoints gross und kleinschreiben beachten.
Resultate
Resultate sind immer ein Objekt mit folgende Struktur

	  const result = {
	      partial:   <boolean>, // true wenn nich vollständig
	      first:     <id>,      // Id der erste Resource
	      last:      <id>,      // id der letzten Resource
	      count:     <number>   // Anzahl Resources in  resources
	      links:     [],        // array von Navigationslinks
	      resources: [],        // array von Resourcen als Objekt
	  
	  };
	  
By ID
In alle endpoints kann gesucht werden und zwar nach ID: Beispiel "https://projects.sbw.media/Endpoint/34" sucht nach endpoint mit id gleich '34'. Resultat bei gefunden 200, bei nicht gefunden 404. Bei Erfolg ist das Resultat in JSON Objekt
By Example
Auf alle andere Attribute kann gesucht werden mit query-string. Beispiel "https://projects.sbw.media/Endpoint?title=hello". Gross-/Kleinschreiben bei Key (title) beachten, beim Wert (helle) spielt is keine Rolle. Auch Jokerzeichen sind möglich "https://projects.sbw.media/Endpoint/?title=h*" sucht alle endpoints mit Feld title beginnend mit 'h'. Bei Erfolg (200) ist das Resultat immer ein JSON Array von Objekte. Resultat bei Key nicht gefunden (missspelled): 400 Bad Request, bei nicht gefunden 204 no content

Methoden

Die folgenden Methoden sind zulässig:

GET
Daten für Endpunkt abrufen

  async function get() {
    const url = 'https://projects.sbw.media/endpoint';
    const response = await fetch(url);

    if(!response.ok) {
      throw new Error('HTTP error! status: ' + response.status');
    }

    const data = await response.json();
    return data.resources;
  }
  
POST
Erstellen Sie eine neue Resource. Als Payload ein Object mit Properties.

      async function post(payload) {
        const url = 'https://projects.sbw.media/Endpoint';
        const response = await fetch(url, {
          method: 'POST',
          headers: {
            'Content-Type': 'application/json'
          },
          body: JSON.stringify(payload)
        });
    
        if(!response.ok) {
          throw new Error('HTTP error! status: ' + response.status');
        }
    
        const data = await response.json();
        return data;
      }
      
PUT
Vorhandenen Eintrag für Endpunkt aktualisieren. Der mit ID angegebene Resource wird aktualisiert. Als Payload ein Object mit Properties.

      async function put(id, payload) {
        const url = 'https://projects.sbw.media/Endpoint' + id;
        const response = await fetch(url, {
          method: 'POST',
          headers: {
            'Content-Type': 'application/json'
          },
          body: JSON.stringify(payload)
        });
    
        if(!response.ok) {
          throw new Error('HTTP error! status: ' + response.status');
        }
    
        const data = await response.json();
        return data;
      }
      
LÖSCHEN
Vorhandenen Eintrag für Endpunkt entfernen. Das mit ID angegebene Objekt wird entfernt.

      async function delete(id) {
        const url = 'https://projects.sbw.media/Endpoint' + id;
        const response = await fetch(url,
          {
            method: 'DELETE'
          });
    
        if(!response.ok) {
          throw new Error('HTTP error! status: ' + response.status');
        }
    
        const data = await response.json();
        return data;
      }
      

Statuscodes

Der Dienst folgt REST-Standards mit den folgenden HTTP_Statuscodes:

200
Erfolg
204
Erfolg, aber keine Ergebnisse.
400
Ungültige Anfrage. Der Text enthält Details.
404
Endpunkt nicht gefunden. Inhalt leer
500
Interner Serverfehler. Der Text enthält Details.