-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
FIX re-create API temp dir after purging temp files #36203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 14.0
Are you sure you want to change the base?
FIX re-create API temp dir after purging temp files #36203
Conversation
|
@lvessiller-opendsi Perhaps the REST API module should be made a core module? It should only be activated on the master entity, and if activated, then it should be activated for all entities? |
I don't know if it will be a good pratice to enable the API for all entities and it's not the problem here. |
|
A recent fix was done into develop branch to create the temp dir automatically when the code need it so there is no more need to create them. See line 63 to 70 of api.class.php |
I did it. |
|
I don't know either |
FIX re-create API temp dir after purging temp files
Before
When purge files is launched and Restler API is enabled and multicompany is enabled :
So when we try to create a third-party for an another entity, the request return a "Not allowed" response.
However the third-party is created and the result of request is not the "id" of created third-party.
The problem is the "routes.php" file for Restler API is not created for the entity (example : "2/api/temp" is not created for entity 2).
To reproduce
Enable multicompany and Rest API in entity 2.
Delete "2/api/temp" directory using purge files process or manually.
Try to create a third-party on entity 2.
curl --location --request POST 'DOLIBARR_URL/api/index.php/thirdparties'
--header 'DOLAPIKEY: USER_API_KEY'
--header 'DOLAPIENTITY: ENTITY'
--header 'Content-Type: application/json'
--data '{
"entity": ENTITY,
"name": "TEST Toto",
"name_alias": "",
"email": "[email protected]",
"phone": "",
"tva_assuj": "1",
"tva_intra": "",
"typent_id": "8",
"lastname": "TEST",
"firstname": "Toto",
"address": "Rue du test",
"zip": "00001",
"town": "AIN",
"country_id": "1",
"country_code": "FR"
}'
After
The purge files re-create all API (if API is enabled and multicompany is enabled) temp directories after puging all temp directories and files.
So the "routes.php" file can be regenerated in API temp directory when we call the API with requests.