Ash FrameworkAF
Ash Framework8mo ago
11 replies
Abhishek Tripathi

ash json api - update by other field

  json_api do
    type "tasks"

    routes do
      base "/tasks"
      get :read_by_task_id, route: "/:task_id"
      index :read
      post :create
      patch :update_by_task_id, route: "/:task_id"
    end
  end


 actions do
    default_accept :*
    defaults [:create, :read, :update, :destroy]

    read :read_by_task_id do
      get_by :task_id
    end

    read :read_by_rlhf_link do
      get_by :task_rlhf_link
    end

    update :update_by_task_id do
 <<< how to read it by task id first and then uodate? >>
    end
end



Here is what I want to do

1. read the task by task_id and update the params received in the json api for that task.
Was this page helpful?