GoFast Community API problem integration.
-
Hello,
I don't think that's the root cause of the issue, but since it could cause unexpected behavior: you don't need to specify "template_nid" if "file" is passed. In fact, "template_nid" is only useful if you wish to determine the contents of the file from a template, which is not the case if a file is already passed.
If you're using the "requests" package in Python, you need to pass the buffered reader of the file, not just the path:
If you try something like this, does it work better?
Best wishes,
Raphaël. -
First of all, thanks, @Raphaël-Badawi
Adding the open() function for the files changed the error message; I don't think the request is being processed at this point. Below is the error message.
-
Hello,
This seems to be a Python error message. From what I understand, you have put in the open() call something which was not the relative path to the file (as a string).
Let's put a complete example.
Here I have an "example.txt" file in the same folder as my script, and I want to put in in "adm" private folder ("/Sites/_adm").
With the following script :
import base64 import requests encoded_credentials = base64.b64encode(b"adm:MYPASSWORD").decode("utf-8") url = "https://gofast-integration.ceo-vision.com/api/node/node" headers = { "Authorization": f'Basic ${encoded_credentials}', } data = { 'type': 'alfresco_item', 'locations': '["/Sites/_adm"]', 'title': "example.txt", } files = { 'file': open("example.txt", "rb") } response = requests.post(url, headers=headers, data=data, files=files) print(response.text)
I have a working request:
And the content is on the platform:
I hope you will find the way,
Best regards,
Raphaël. -
Hello @Raphaël-Badawi , thank you for your contribution so far, but from what I can tell, this might be a bug for the API worth looking into. I used the information you displayed above with my minor changes for the GoFast community setup I have.
And I managed to get the same error which was unfortunate. Is it because I am using the Gofast Community or is there something that is hindering this request from working?
Even with Postman, using my Gofast community, I managed to get the same error.
But using your own server which I presume is not community version, I get a fair error that is different, and the difference is that I know what is missing there.
Thanks a lot in advance.
-
Yes of course you have an authorization error when requesting our server since this credentials check is the very first check done within the API endpoint So it doesn't actually get until the parameters check (which is the error you've got with your community).
I will send you some valid temporary test credentials in PM to see if you get an error with the enterprise version and if so what the actual error is. If the discrepancy between community and enterprise regarding this API gets confirmed, I will book some time in my agenda to so some investigation on a community installation.
Best regards,
Raphaël. -
Hi @Raphaël-Badawi
This API integration has already been done with our enterprise version, and it is working as expected over here. I do not know if it will be okay for you to test it as well in the community version to check the difference.I have a problem with the community version API, not the enterprise version. It works for enterprise Gofast. Thanks a lot.
-
Hello again,
I took the liberty to make some tests on our community demo platform.
It actually works.
What version of GoFAST community are you using? Can you give more hints about the request? Is your community instance hosted on a remote host or on localhost? Do you have the same issue when requesting the enterprise demo platform I gave you credentials in PM?
If the problem is in the end confirmed to be community-specific, I will make a fresh local community install to investigate further.
Raphaël.
-
From the indication in the compose file, seems am working on
CEO-Vision S.A.S
Project : gofast-ng-compose
Compose type : Community
Template version : 1.0
Modification date : 06.10.2023
Gofast Version : 4.1.1_hotfix_1.0
My setup is on a remote server and not on my localhost, accessible at the url below.
https://master-gofast.teoshore.com/I didn't have such issue while requesting with the enterprise credentials in my PM. Thanks a lot.
-
Hello @Raphaël-Badawi It is now working, I just restarted the containers and Gofast, and also I used the request method you showed above, and it is working. Thanks a lot. Please how do I now make it to locate the path I created in my group folder? it seems to allow upload only to my private folder. Is there anything wrong with the location below?
["/Sites/_Groups/_Odoo/_2O SLIS/_Sales/_Sales Order/S00001/"]
I keep getting the error below. that my folder cannot be found. Thanks a lot in advance.
-
You definitely can upload in any place you have contributor right into. And yes the path is the same path you see in the URL or in the filebrowser breadcrumb. It's the webdav path. So so far is I can tell the path you provide seems valid.
Have you checked that user matching the credentials you used to make the request has contributor privileges in the "Sales Order" space. If so, can you please provide the error message you got making the request?
Thanks!
Raphaël.