Datei via API hochladen und Workplace anhängen.
-
Hallo,
wir möchten unseren Check-In Prozess automatisieren und dafür würden wir gerne die eingescannten Übergabeformulare per Python script hochladen und dann dem Workplace zuordnen.
Die Dokumentation für so eine Funktion scheint etwas sporadisch zu sein, deswegen wollte ich bei den Profils fragen!

Die dokumentation der Endpoints ist auch nicht so hilfreich:

Ich hab bereits diesen Eintrag gefunden aber der hat leider nicht geholfen: https://community.i-doit.com/topic/4036/upload-file-using-api
Wir möchten die .pdfs wiefolgt anhängen:

Also wir möchten Übergabeformular-pdfs über python hochladen indem wir den Workplacenamen angeben und die Datei automatisch an diesen Workplace gehangen wird.
An sich wissen wir wie die API funktioniert, wir brauchen nur hilfe für diesen Endpoint.
-
das Problem bei Dateien ist, die müssen als Base64 kodiert sein
.Datei Objekt erstellen und eine Datei hochladen:
{ "id": 1, "version": "2.0", "method": "cmdb.object.create", "params": { "type": "C__OBJTYPE__FILE", "title": "UserImage", "categories": { "C__CATS__FILE_VERSIONS": [ { "file_physical": "UserImage.png", "file_content": "BASE64=", "file_title": "UserImage.png" } ] }, "apikey": "key", "language": "en" } }Dann hab ich hier noch ein Beispiel für das Zuweisen einer Datei zu einem Objekt:
{ "id": 1, "version": "2.0", "method": "cmdb.category.save", "params": { "object": 1123375323, "category": "C__CATG__FILE", "data": { "file": 1123375614, "link": null, "description": null }, "apikey": "key", "language": "en" } }Ps. wenn ich versuche die Datei hochzuladen und direkt zuzuweisen, bekomme ich einen 500er.
AH01071: Got error 'PHP message: PHP Fatal error: Uncaught TypeError: isys_application::getUploadFilePath(): Argument #1 ($fileName) must be of type string, null given,Dazu erstelle ich einen Bug Report

{ "id": 1, "version": "2.0", "method": "cmdb.object.create", "params": { "type": "C__OBJTYPE__FILE", "title": "UserImage", "categories": { "C__CATS__FILE_VERSIONS": [ { "file_physical": "UserImage.png", "file_content": "BASE64=", "file_title": "UserImage.png" } ], "C__CATS__FILE_OBJECTS": [ { "assigned_objects": 9 } ] }, "apikey": "key", "language": "en" } }
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login