How to include 'created_at', 'update_at' field in response with AshJsonApi

Hi,
I have two questions.

  1. How to include the created_at, update_at fields in the JSON response.
  2. How to use created_at, update_at fields when sorting . i.e. ?sort=created_at

example resource

json_api do
    type ""

    routes do
      base("/")
      post(:create)
      get(:read)
      patch(:update)
      delete(:destroy)
    end
  end

attributes do
    uuid_primary_key :id
    attribute :user_id, :string do
      allow_nil? false
    end
    create_timestamp :created_at
    update_timestamp :update_at
  end

Mark the timestamps as private?: false

1 Like

Thank you so much for your answer

1 Like