These are chat archives for ushahidi/Community

17th
Aug 2018
nishadhka
@nishadhka
Aug 17 2018 09:54
Hello community, trying to make a instance for Kerala flood mapping and organizing rescue requirements , made it using https://github.com/ushahidi/platform-release
is there a API preferably python to make forms and facility to import data into it, other than CSV import
while making csv import, had an issue of error with exceeding 30S to upload data
nishadhka
@nishadhka
Aug 17 2018 10:25
@cmacdonell or any body can please help on this
Sanjay Bhangar
@batpad
Aug 17 2018 20:05
:wave: looking for some help / an example on authorizing POST requests using the API to make new posts via the POST /api/v3/posts end-point ..
I don't fully understand whether one has to use the API token gotten from the admin, or some-how get another access_token by hitting the oauth end-point. I tried setting a header like Authorization: Bearer <api-key> and that did not work .. tried a few other variations .. and trying to hit the oauth end-point just gives me a 404 :(
Romina Suarez
@rowasc
Aug 17 2018 21:52
Hi @batpad . You can get a token by sending a request to /api/v3/oauth/token and the using your email+password and the default client_secret and id {"username":"something@something.com","password":"something","grant_type":"password","client_id":"ushahidiui","client_secret":"35e7f0bca957836d05ca0492211b0ac707671261","scope":"*"}
then you can use the header Authorization: Bearer {token} where {token} is the token you get from /api/v3/oauth/token to create or list posts with api/v3/posts
Romina Suarez
@rowasc
Aug 17 2018 22:07
@nishadhka you might want to temporarily make the php execution limit higher to import the data if it's a one off thing.
We don't have a python app for it,but there's a CLI tool that you could call from platform ./bin/ushahidi import {file.csv} {map.json} {values.json} where map.json is used to map csv columns and survey field ids, and values.json is a map of fields to fixed values (if if you wanted all posts to have X categories) .
/api/v3/oauth/token should be /oauth/tokenin my message above. That's what I get for not checking postman
@batpad thanks for reporting ushahidi/platform#3212