1

I created json for adding new poi with fw_media data included, based on json from example_components/fw_media.json:

{"fw_core":
    {"location":{"wgs84":{"latitude":1,"longitude":1}},
    "categories":["Field"],
    "name":{"":"poljana 1"}},
"fw_media": {
     "entities": [
       {
         "type": "photo",
         "short_label": {
           "en": "Sunset at sea"
         },
         "caption": {
           "en": "Sunset on the Bothnian Bay, Northwest from Hailuoto summer 2013"
         },
         "description": {
           "": "Lorem ipsum dolor sit amet, consectetur adipisci elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat.",
           "fi": "Oli mukava retki."
         },
         "thumbnail": "http://www.example.org/sunset_on_sea_tbn.jpg",
         "url": "http://www.example.org/sunset_on_sea.jpg",
         "copyright": "Photo: Ari Okkonen"
       },
       {
         "type": "audio",
         "short_label": {
           "": "Säkkijärven polkka"
         },
         "url": "http://www.example.org/sakkijarven_polkka.mp3"
       }

     ],
"last_update": {
    "timestamp": 1390203898
}, "source": {
    "website": "http://www.cie.fi",
    "name": "CIE, University of Oulu",
    "id": "7c32c67d-cf00-4d11-9acc-2471141e03a3",
    "license": "http://www.gnu.org/licenses/gpl.html"
}
}} 

But im getting error:

JSON does not validate. Violations:
[fw_media] The property - source - is not defined and the definition      
does not allow additional properties
POI data validation failed!

Can you give me example of working fw_media json?

And also is it possible to upload image with poi in fw_media?(Not just url to image but whole image)

Milos Miletic
  • 500
  • 6
  • 19

1 Answers1

0

Corrected in master branch in GitHub.

Thank you for your report.

It seems that an old example somewhere has the fw_image.source field that is not implemented. Just edit the source structure out of the data, and it should be Ok. Of course there is no sense to have one source description common for all images, etc. for the one POI.

A source field might be usable in per-item basis. So I'll introduce it to the next release.

Please, could you tell me where that erroneous Sunset at sea is, so I can go correct it. Correction is tracked in https://github.com/Chiru/FIWARE-POIDataProvider/issues/7 I feel uploading pictures a kind of Specific Enabler stuff. So it left to the community to implement. I suggest using some media repository in combination of a standard POI-DP by a specialized client software.

Ari Okkonen
  • 165
  • 1
  • 10
  • Thanks for quick answer. Location of fw_media json is: https://github.com/Chiru/FIWARE-POIDataProvider/blob/master/php/example_components/fw_media.json You should also modify timestamp of last_update attribute because of the error: [fw_media.last_update.timestamp] string value found, but an integer is required. I removed source attribute from json as you said, but now it is returning: 500 INTERNAL SERVER ERROR Response does not contain any data. – Milos Miletic Nov 20 '15 at 13:21
  • Depending of the server it might be this error https://github.com/Chiru/FIWARE-POIDataProvider/issues/2 . Correcting the current installation: 1. Delete the `vendor` subdirectory from your POI server 2. Install the version 1.4.3 of the justinrainbow/json-schema $ wget http://getcomposer.org/composer.phar $ php composer.phar require justinrainbow/json-schema:1.4.3 $ sudo cp -r vendor /var/www/poi_dp/ (Anyway, arrange that new `vendor` subdirectory to the place where you deleted the previous one.) – Ari Okkonen Nov 20 '15 at 14:17
  • I did it but it is still the same error.I looked in the error log and i got these errors: PHP Notice: Undefined variable: source_name in /var/www/poi_dp/add_poi.php on line 107 PHP Notice: Undefined variable: source_website in /var/www/poi_dp/add_poi.php PHP Notice: Undefined variable: source_license in /var/www/poi_dp/add_poi.php PHP Notice: Undefined variable: source_id in /var/www/poi_dp/add_poi.php PHP Fatal error: Uncaught exception 'MongoException' with message 'zero-length keys are not allowed, did you use $ with double quotes?' in /var/www/poi_dp/add_poi.php:143 – Milos Miletic Nov 20 '15 at 14:44
  • Thank you for specific report. 1. That 'zero-length keys are not allowed' is supposedly caused by texts of 'default language' that initially was miserably defined having an empty string as the language code. We try to sort this out. A valid workaround is to use some language code, e.g. "en", and then define it to be the default: '"_def": "en"'. 2. Those undefineds seem to be genuine errors. Do you have any information that can be used to find the version of the POI-DP? – Ari Okkonen Nov 23 '15 at 09:27
  • I downloaded it on October 29. – Milos Miletic Nov 23 '15 at 09:32
  • Tracking of the actual errors: https://github.com/Chiru/FIWARE-POIDataProvider/issues/6 – Ari Okkonen Dec 07 '15 at 07:24
  • The branch iss6 of the POI-DP in the GitHub seems now to have a correction to the latest errors. Please verify. – Ari Okkonen Dec 10 '15 at 15:33