anchor.diff:  	Update = create_update(Stream),
   	erlang:display(Update),
   	case erlastic_search:update_doc(?INDEX, "stream", StreamId, Update) of 
  -		{error,Reason} -> {{error,Reason}, ReqData, State};
  -		{ok,List} -> {List,ReqData,State}
  -	end.
  -
  -
  -
  -
  -
  -
  +		{error,Reason} -> {false, wrq:set_resp_body(json_encode(Reason),ReqData), State};
  +		{ok,List} -> {true,wrq:set_resp_body(json_encode(List),ReqData),State}
  +	end.
  +
  +
  +
  +
  +
  +%% @doc
  +%% Function: get_stream/2
  +%% Purpose: Used to handle GET requests by giveing the document with the given
  +%%          Id or listing the documents that can be found from the restrictions
  +%%          given by the URI.
  +%% Returns: {Sucess, ReqData, State}, where Sucess is true if the PUT request is 
  +%%          sucessful and false otherwise.
  +%% @end
  +-spec get_stream(ReqData::term(),State::term()) -> {boolean(), term(), term()}.
   
   get_stream(ReqData, State) ->
   	case is_search(ReqData) of
  
positive.code: 		[{"users", _UserID}, {"resources", _ResourceID}, {"streams", _StreamID}] ->
  			{['GET', 'PUT', 'DELETE'], ReqData, State};
  		[error] ->
  		    {['POST', 'GET'], ReqData, State} % Probably should give som error message
  end.
  
  
  
negative.code: %% A code 406 is returned to the client if we cannot return the media-type that the user has requested.
  %% Returns: {[{Mediatype, Handler}], ReqData, State}
  %% @end
  -spec content_types_provided(ReqData::term(),State::term()) -> {list(), term(), term()}.
  
  content_types_provided(ReqData, State) ->
  	{[{"application/json", get_stream}], ReqData, State}.
  
  