API does not work after Update to 2.6

Post Reply
Jochen
Posts: 85
Joined: 13 Feb 2018, 20:45
Name: Joachim Suehlo
Location: Germany Hannover
Company Name: b-prisma

API does not work after Update to 2.6

Post by Jochen »

API does not work after Update to 2.6.
I have 2 installations on the same website:
With 2.5 API still works, with 2.6 not.
User avatar
support
Site Admin
Posts: 6231
Joined: 19 Oct 2014, 18:22
Name: Sergey Kharchishin
Location: Russia, Evpatoriya

Re: API does not work after Update to 2.6

Post by support »

Can't reproduce it. What do you mean "Not work". Any error messages or something like this?
Which api action do you use (insert/update/select)?
User avatar
support
Site Admin
Posts: 6231
Joined: 19 Oct 2014, 18:22
Name: Sergey Kharchishin
Location: Russia, Evpatoriya

Re: API does not work after Update to 2.6

Post by support »

Please add to your code next line so we will see full response. (see attached screenshot)
Attachments
screenshot-docs.rukovoditel.net-2020.01.png
Jochen
Posts: 85
Joined: 13 Feb 2018, 20:45
Name: Joachim Suehlo
Location: Germany Hannover
Company Name: b-prisma

Re: API does not work after Update to 2.6

Post by Jochen »

I did this:

Code: Select all

				if($result)
				{
				  $result = json_decode($result,true);
				  
				  print_r($result);	...
}
And got this result:

Code: Select all

Array ( [status] => success [data] => Array ( [0] => Array ( [id] => 1 [parent_item_id] => 5 [date_added] => 04.04.2018 14:35 [created_by] => Jochen ...
But the output still is missing.
The scripts are absolutely identical for the old and the new ruko version except the URL of the rest.php.
User avatar
support
Site Admin
Posts: 6231
Joined: 19 Oct 2014, 18:22
Name: Sergey Kharchishin
Location: Russia, Evpatoriya

Re: API does not work after Update to 2.6

Post by support »

Check fields ID and check your code.
Jochen
Posts: 85
Joined: 13 Feb 2018, 20:45
Name: Joachim Suehlo
Location: Germany Hannover
Company Name: b-prisma

Re: API does not work after Update to 2.6

Post by Jochen »

I checked my code and did not find anything.
Then I compared the print output with ruko 2.5 and 2.6, see image:
Image

Then I replaced the file "../plugins/ext/classes/api.php" from version 2.6 with the one from 2.5.
And now it works as before and the print output is identical.
Please check, what the reasons for this could be.
User avatar
support
Site Admin
Posts: 6231
Joined: 19 Oct 2014, 18:22
Name: Sergey Kharchishin
Location: Russia, Evpatoriya

Re: API does not work after Update to 2.6

Post by support »

There are two differences:
1) added parent_item_id to result. This is change nothing.
2) attachment file name now include time when it's added (at the start of file). It's like it's stored in database.
So this is might your issue. If you don't need it, you can exclude time from filename.
Jochen
Posts: 85
Joined: 13 Feb 2018, 20:45
Name: Joachim Suehlo
Location: Germany Hannover
Company Name: b-prisma

Re: API does not work after Update to 2.6

Post by Jochen »

Yes, it must be the filename. When I got in other cases not the correct filename, e.g. file-ending is missing, then there is nothing shown.
But how can I exclude time from filename?
User avatar
support
Site Admin
Posts: 6231
Joined: 19 Oct 2014, 18:22
Name: Sergey Kharchishin
Location: Russia, Evpatoriya

Re: API does not work after Update to 2.6

Post by support »

Simple use substr function. Example:

Code: Select all

$filename  = '123123123_some_file_nqme.gsm';
echo substr($filename,strpos($filename,'_')+1);
Jochen
Posts: 85
Joined: 13 Feb 2018, 20:45
Name: Joachim Suehlo
Location: Germany Hannover
Company Name: b-prisma

Re: API does not work after Update to 2.6

Post by Jochen »

Thank You much: that works well.
Post Reply