API now returns just the content in the body.
- Instead of returning Meta-Data (status) in the header and the body, we now only return the content in the body, except in error when we return the error message. - JSON entries use the 'id' name for entity ids (instead of 'username', 'timeline_id', and 'entry_id')
This commit is contained in:
@ -7,7 +7,7 @@ encode_record(Record) -> lists:flatten(json:encode(record_to_ejson(Record))).
|
||||
|
||||
record_to_ejson(Record=#ts_user{}) ->
|
||||
{struct, [
|
||||
{username, atom_to_list(Record#ts_user.username)},
|
||||
{id, atom_to_list(Record#ts_user.username)},
|
||||
{name, Record#ts_user.name},
|
||||
{email, Record#ts_user.email},
|
||||
{join_date, encode_datetime(Record#ts_user.join_date)}]};
|
||||
@ -18,8 +18,8 @@ record_to_ejson(Record=#ts_timeline{}) ->
|
||||
|
||||
% create the EJSON struct
|
||||
{struct, [
|
||||
{username, atom_to_list(Username)},
|
||||
{timeline_id, atom_to_list(TimelineId)},
|
||||
{user_id, atom_to_list(Username)},
|
||||
{id, atom_to_list(TimelineId)},
|
||||
{created, encode_datetime(Record#ts_timeline.created)},
|
||||
{description, Record#ts_timeline.desc}]};
|
||||
|
||||
@ -32,9 +32,9 @@ record_to_ejson(Record=#ts_entry{}) ->
|
||||
|
||||
% create the EJSON struct
|
||||
{struct, [
|
||||
{username, atom_to_list(Username)},
|
||||
{user_id, atom_to_list(Username)},
|
||||
{timeline_id, atom_to_list(TimelineId)},
|
||||
{entry_id, EntryId},
|
||||
{id, EntryId},
|
||||
{timestamp, encode_datetime(DateTime)},
|
||||
{mark, Record#ts_entry.mark},
|
||||
{notes, Record#ts_entry.notes}]}.
|
||||
|
Reference in New Issue
Block a user