Skip to content

Add import and export endpoints#11

Open
paultrimor wants to merge 4 commits into
ictinnovations:masterfrom
paultrimor:feature/csv
Open

Add import and export endpoints#11
paultrimor wants to merge 4 commits into
ictinnovations:masterfrom
paultrimor:feature/csv

Conversation

@paultrimor

Copy link
Copy Markdown

No description provided.

@ictvision ictvision left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix all the mentioned points, further please note that you also need to provide an API for sample csv file i.e.
@url GET /users/sample/csv

Comment thread core/Api/UserApi.php Outdated
/**
* Export all users form DB
*
* @url POST /users/csv

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it not supposed to be a GET API?
@url GET /users/csv

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update on latest commit.

Comment thread core/Api/UserApi.php Outdated
/**
* Import new users from into DB
*
* @url GET /users/csv

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it not supposed to be a POST API?
@url POST /users/csv

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update on latest commit.

Comment thread core/Api/UserApi.php
$fields = array('username', 'passwd', 'first_name', 'last_name', 'email', 'address', 'company', 'active');
$query = 'SELECT ' . implode(", ", $fields) . ' FROM usr';
$result = DB::query('usr', $query);
$filepath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'users.csv';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use random file name, tempname function ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure what you mean by this. Could you please elaborate? thanks

@ictvision

Copy link
Copy Markdown

One thing more, please also update API guides accordingly. i.e.

docs/api.md
docs/ApiGuide.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants